diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cb2478c74ae..3e877cb45a8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # CHANGELOG +## `v55.3.0` + +### New Packages + +- `github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks` +- `github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid` +- `github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-08-01/trafficmanager` + +### Breaking Changes + +| Package Path | Changelog | +| :--- | :---: | +| `github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security` | [details](https://github.com/Azure/azure-sdk-for-go/tree/master/services/preview/security/mgmt/v3.0/security/CHANGELOG.md) | + ## `v55.2.0` ### New Packages @@ -12,8 +26,8 @@ | Package Path | Changelog | | :--- | :---: | -| `github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers` | [details](https://github.com/Azure/azure-sdk-for-go/tree/master/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/CHANGELOG.md) | -| `github.com/Azure/azure-sdk-for-go/services/web/mgmt/2020-12-01/web` | [details](https://github.com/Azure/azure-sdk-for-go/tree/master/services/web/mgmt/2020-12-01/web/CHANGELOG.md) | +| `github.com/Azure/azure-sdk-for-go/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers` | [details](https://github.com/Azure/azure-sdk-for-go/blob/v55.2.0/services/preview/postgresql/mgmt/2020-02-14-preview/postgresqlflexibleservers/CHANGELOG.md) | +| `github.com/Azure/azure-sdk-for-go/services/web/mgmt/2020-12-01/web` | [details](https://github.com/Azure/azure-sdk-for-go/blob/v55.2.0/services/web/mgmt/2020-12-01/web/CHANGELOG.md) | ## `v55.1.0` diff --git a/profiles/latest/trafficmanager/mgmt/trafficmanager/models.go b/profiles/latest/trafficmanager/mgmt/trafficmanager/models.go index b24721973c4e..980db1dc0574 100644 --- a/profiles/latest/trafficmanager/mgmt/trafficmanager/models.go +++ b/profiles/latest/trafficmanager/mgmt/trafficmanager/models.go @@ -8,21 +8,30 @@ package trafficmanager -import original "github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-04-01/trafficmanager" +import original "github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-08-01/trafficmanager" const ( DefaultBaseURI = original.DefaultBaseURI ) +type AllowedEndpointRecordType = original.AllowedEndpointRecordType + +const ( + AllowedEndpointRecordTypeAny AllowedEndpointRecordType = original.AllowedEndpointRecordTypeAny + AllowedEndpointRecordTypeDomainName AllowedEndpointRecordType = original.AllowedEndpointRecordTypeDomainName + AllowedEndpointRecordTypeIPv4Address AllowedEndpointRecordType = original.AllowedEndpointRecordTypeIPv4Address + AllowedEndpointRecordTypeIPv6Address AllowedEndpointRecordType = original.AllowedEndpointRecordTypeIPv6Address +) + type EndpointMonitorStatus = original.EndpointMonitorStatus const ( - CheckingEndpoint EndpointMonitorStatus = original.CheckingEndpoint - Degraded EndpointMonitorStatus = original.Degraded - Disabled EndpointMonitorStatus = original.Disabled - Inactive EndpointMonitorStatus = original.Inactive - Online EndpointMonitorStatus = original.Online - Stopped EndpointMonitorStatus = original.Stopped + EndpointMonitorStatusCheckingEndpoint EndpointMonitorStatus = original.EndpointMonitorStatusCheckingEndpoint + EndpointMonitorStatusDegraded EndpointMonitorStatus = original.EndpointMonitorStatusDegraded + EndpointMonitorStatusDisabled EndpointMonitorStatus = original.EndpointMonitorStatusDisabled + EndpointMonitorStatusInactive EndpointMonitorStatus = original.EndpointMonitorStatusInactive + EndpointMonitorStatusOnline EndpointMonitorStatus = original.EndpointMonitorStatusOnline + EndpointMonitorStatusStopped EndpointMonitorStatus = original.EndpointMonitorStatusStopped ) type EndpointStatus = original.EndpointStatus @@ -35,9 +44,9 @@ const ( type MonitorProtocol = original.MonitorProtocol const ( - HTTP MonitorProtocol = original.HTTP - HTTPS MonitorProtocol = original.HTTPS - TCP MonitorProtocol = original.TCP + MonitorProtocolHTTP MonitorProtocol = original.MonitorProtocolHTTP + MonitorProtocolHTTPS MonitorProtocol = original.MonitorProtocolHTTPS + MonitorProtocolTCP MonitorProtocol = original.MonitorProtocolTCP ) type ProfileMonitorStatus = original.ProfileMonitorStatus @@ -60,12 +69,12 @@ const ( type TrafficRoutingMethod = original.TrafficRoutingMethod const ( - Geographic TrafficRoutingMethod = original.Geographic - MultiValue TrafficRoutingMethod = original.MultiValue - Performance TrafficRoutingMethod = original.Performance - Priority TrafficRoutingMethod = original.Priority - Subnet TrafficRoutingMethod = original.Subnet - Weighted TrafficRoutingMethod = original.Weighted + TrafficRoutingMethodGeographic TrafficRoutingMethod = original.TrafficRoutingMethodGeographic + TrafficRoutingMethodMultiValue TrafficRoutingMethod = original.TrafficRoutingMethodMultiValue + TrafficRoutingMethodPerformance TrafficRoutingMethod = original.TrafficRoutingMethodPerformance + TrafficRoutingMethodPriority TrafficRoutingMethod = original.TrafficRoutingMethodPriority + TrafficRoutingMethodSubnet TrafficRoutingMethod = original.TrafficRoutingMethodSubnet + TrafficRoutingMethodWeighted TrafficRoutingMethod = original.TrafficRoutingMethodWeighted ) type TrafficViewEnrollmentStatus = original.TrafficViewEnrollmentStatus @@ -147,6 +156,9 @@ func NewUserMetricsKeysClientWithBaseURI(baseURI string, subscriptionID string) func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } +func PossibleAllowedEndpointRecordTypeValues() []AllowedEndpointRecordType { + return original.PossibleAllowedEndpointRecordTypeValues() +} func PossibleEndpointMonitorStatusValues() []EndpointMonitorStatus { return original.PossibleEndpointMonitorStatusValues() } diff --git a/profiles/latest/trafficmanager/mgmt/trafficmanager/trafficmanagerapi/models.go b/profiles/latest/trafficmanager/mgmt/trafficmanager/trafficmanagerapi/models.go index 9fed180a135b..ec89458a2c78 100644 --- a/profiles/latest/trafficmanager/mgmt/trafficmanager/trafficmanagerapi/models.go +++ b/profiles/latest/trafficmanager/mgmt/trafficmanager/trafficmanagerapi/models.go @@ -8,7 +8,7 @@ package trafficmanagerapi -import original "github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-04-01/trafficmanager/trafficmanagerapi" +import original "github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-08-01/trafficmanager/trafficmanagerapi" type EndpointsClientAPI = original.EndpointsClientAPI type GeographicHierarchiesClientAPI = original.GeographicHierarchiesClientAPI diff --git a/profiles/preview/preview/databricks/mgmt/databricks/databricksapi/models.go b/profiles/preview/preview/databricks/mgmt/databricks/databricksapi/models.go new file mode 100644 index 000000000000..0e00a70cce09 --- /dev/null +++ b/profiles/preview/preview/databricks/mgmt/databricks/databricksapi/models.go @@ -0,0 +1,17 @@ +// +build go1.9 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package databricksapi + +import original "github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/databricksapi" + +type OperationsClientAPI = original.OperationsClientAPI +type PrivateEndpointConnectionsClientAPI = original.PrivateEndpointConnectionsClientAPI +type PrivateLinkResourcesClientAPI = original.PrivateLinkResourcesClientAPI +type VNetPeeringClientAPI = original.VNetPeeringClientAPI +type WorkspacesClientAPI = original.WorkspacesClientAPI diff --git a/profiles/preview/preview/databricks/mgmt/databricks/models.go b/profiles/preview/preview/databricks/mgmt/databricks/models.go new file mode 100644 index 000000000000..2c3af63d386d --- /dev/null +++ b/profiles/preview/preview/databricks/mgmt/databricks/models.go @@ -0,0 +1,278 @@ +// +build go1.9 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/tools/profileBuilder + +package databricks + +import ( + "context" + + original "github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks" +) + +const ( + DefaultBaseURI = original.DefaultBaseURI +) + +type CreatedByType = original.CreatedByType + +const ( + CreatedByTypeApplication CreatedByType = original.CreatedByTypeApplication + CreatedByTypeKey CreatedByType = original.CreatedByTypeKey + CreatedByTypeManagedIdentity CreatedByType = original.CreatedByTypeManagedIdentity + CreatedByTypeUser CreatedByType = original.CreatedByTypeUser +) + +type CustomParameterType = original.CustomParameterType + +const ( + CustomParameterTypeBool CustomParameterType = original.CustomParameterTypeBool + CustomParameterTypeObject CustomParameterType = original.CustomParameterTypeObject + CustomParameterTypeString CustomParameterType = original.CustomParameterTypeString +) + +type KeySource = original.KeySource + +const ( + KeySourceDefault KeySource = original.KeySourceDefault + KeySourceMicrosoftKeyvault KeySource = original.KeySourceMicrosoftKeyvault +) + +type PeeringProvisioningState = original.PeeringProvisioningState + +const ( + PeeringProvisioningStateDeleting PeeringProvisioningState = original.PeeringProvisioningStateDeleting + PeeringProvisioningStateFailed PeeringProvisioningState = original.PeeringProvisioningStateFailed + PeeringProvisioningStateSucceeded PeeringProvisioningState = original.PeeringProvisioningStateSucceeded + PeeringProvisioningStateUpdating PeeringProvisioningState = original.PeeringProvisioningStateUpdating +) + +type PeeringState = original.PeeringState + +const ( + PeeringStateConnected PeeringState = original.PeeringStateConnected + PeeringStateDisconnected PeeringState = original.PeeringStateDisconnected + PeeringStateInitiated PeeringState = original.PeeringStateInitiated +) + +type PrivateEndpointConnectionProvisioningState = original.PrivateEndpointConnectionProvisioningState + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = original.PrivateEndpointConnectionProvisioningStateCreating + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = original.PrivateEndpointConnectionProvisioningStateDeleting + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = original.PrivateEndpointConnectionProvisioningStateFailed + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = original.PrivateEndpointConnectionProvisioningStateSucceeded + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = original.PrivateEndpointConnectionProvisioningStateUpdating +) + +type PrivateLinkServiceConnectionStatus = original.PrivateLinkServiceConnectionStatus + +const ( + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = original.PrivateLinkServiceConnectionStatusApproved + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = original.PrivateLinkServiceConnectionStatusDisconnected + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = original.PrivateLinkServiceConnectionStatusPending + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = original.PrivateLinkServiceConnectionStatusRejected +) + +type ProvisioningState = original.ProvisioningState + +const ( + ProvisioningStateAccepted ProvisioningState = original.ProvisioningStateAccepted + ProvisioningStateCanceled ProvisioningState = original.ProvisioningStateCanceled + ProvisioningStateCreated ProvisioningState = original.ProvisioningStateCreated + ProvisioningStateCreating ProvisioningState = original.ProvisioningStateCreating + ProvisioningStateDeleted ProvisioningState = original.ProvisioningStateDeleted + ProvisioningStateDeleting ProvisioningState = original.ProvisioningStateDeleting + ProvisioningStateFailed ProvisioningState = original.ProvisioningStateFailed + ProvisioningStateReady ProvisioningState = original.ProvisioningStateReady + ProvisioningStateRunning ProvisioningState = original.ProvisioningStateRunning + ProvisioningStateSucceeded ProvisioningState = original.ProvisioningStateSucceeded + ProvisioningStateUpdating ProvisioningState = original.ProvisioningStateUpdating +) + +type PublicNetworkAccess = original.PublicNetworkAccess + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = original.PublicNetworkAccessDisabled + PublicNetworkAccessEnabled PublicNetworkAccess = original.PublicNetworkAccessEnabled +) + +type RequiredNsgRules = original.RequiredNsgRules + +const ( + RequiredNsgRulesAllRules RequiredNsgRules = original.RequiredNsgRulesAllRules + RequiredNsgRulesNoAzureDatabricksRules RequiredNsgRules = original.RequiredNsgRulesNoAzureDatabricksRules + RequiredNsgRulesNoAzureServiceRules RequiredNsgRules = original.RequiredNsgRulesNoAzureServiceRules +) + +type AddressSpace = original.AddressSpace +type BaseClient = original.BaseClient +type CreatedBy = original.CreatedBy +type Encryption = original.Encryption +type EncryptionEntitiesDefinition = original.EncryptionEntitiesDefinition +type EncryptionV2 = original.EncryptionV2 +type EncryptionV2KeyVaultProperties = original.EncryptionV2KeyVaultProperties +type ErrorDetail = original.ErrorDetail +type ErrorInfo = original.ErrorInfo +type ErrorResponse = original.ErrorResponse +type GroupIDInformation = original.GroupIDInformation +type GroupIDInformationProperties = original.GroupIDInformationProperties +type ManagedIdentityConfiguration = original.ManagedIdentityConfiguration +type Operation = original.Operation +type OperationDisplay = original.OperationDisplay +type OperationListResult = original.OperationListResult +type OperationListResultIterator = original.OperationListResultIterator +type OperationListResultPage = original.OperationListResultPage +type OperationsClient = original.OperationsClient +type PrivateEndpoint = original.PrivateEndpoint +type PrivateEndpointConnection = original.PrivateEndpointConnection +type PrivateEndpointConnectionProperties = original.PrivateEndpointConnectionProperties +type PrivateEndpointConnectionsClient = original.PrivateEndpointConnectionsClient +type PrivateEndpointConnectionsCreateFuture = original.PrivateEndpointConnectionsCreateFuture +type PrivateEndpointConnectionsDeleteFuture = original.PrivateEndpointConnectionsDeleteFuture +type PrivateEndpointConnectionsList = original.PrivateEndpointConnectionsList +type PrivateEndpointConnectionsListIterator = original.PrivateEndpointConnectionsListIterator +type PrivateEndpointConnectionsListPage = original.PrivateEndpointConnectionsListPage +type PrivateLinkResourcesClient = original.PrivateLinkResourcesClient +type PrivateLinkResourcesList = original.PrivateLinkResourcesList +type PrivateLinkResourcesListIterator = original.PrivateLinkResourcesListIterator +type PrivateLinkResourcesListPage = original.PrivateLinkResourcesListPage +type PrivateLinkServiceConnectionState = original.PrivateLinkServiceConnectionState +type Resource = original.Resource +type Sku = original.Sku +type SystemData = original.SystemData +type TrackedResource = original.TrackedResource +type VNetPeeringClient = original.VNetPeeringClient +type VNetPeeringCreateOrUpdateFuture = original.VNetPeeringCreateOrUpdateFuture +type VNetPeeringDeleteFuture = original.VNetPeeringDeleteFuture +type VirtualNetworkPeering = original.VirtualNetworkPeering +type VirtualNetworkPeeringList = original.VirtualNetworkPeeringList +type VirtualNetworkPeeringListIterator = original.VirtualNetworkPeeringListIterator +type VirtualNetworkPeeringListPage = original.VirtualNetworkPeeringListPage +type VirtualNetworkPeeringPropertiesFormat = original.VirtualNetworkPeeringPropertiesFormat +type VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork = original.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork +type VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork = original.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork +type Workspace = original.Workspace +type WorkspaceCustomBooleanParameter = original.WorkspaceCustomBooleanParameter +type WorkspaceCustomObjectParameter = original.WorkspaceCustomObjectParameter +type WorkspaceCustomParameters = original.WorkspaceCustomParameters +type WorkspaceCustomStringParameter = original.WorkspaceCustomStringParameter +type WorkspaceEncryptionParameter = original.WorkspaceEncryptionParameter +type WorkspaceListResult = original.WorkspaceListResult +type WorkspaceListResultIterator = original.WorkspaceListResultIterator +type WorkspaceListResultPage = original.WorkspaceListResultPage +type WorkspaceProperties = original.WorkspaceProperties +type WorkspacePropertiesEncryption = original.WorkspacePropertiesEncryption +type WorkspaceProviderAuthorization = original.WorkspaceProviderAuthorization +type WorkspaceUpdate = original.WorkspaceUpdate +type WorkspacesClient = original.WorkspacesClient +type WorkspacesCreateOrUpdateFuture = original.WorkspacesCreateOrUpdateFuture +type WorkspacesDeleteFuture = original.WorkspacesDeleteFuture +type WorkspacesUpdateFuture = original.WorkspacesUpdateFuture + +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) +} +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return original.NewOperationListResultIterator(page) +} +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return original.NewOperationListResultPage(cur, getNextPage) +} +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) +} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return original.NewPrivateEndpointConnectionsClient(subscriptionID) +} +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return original.NewPrivateEndpointConnectionsClientWithBaseURI(baseURI, subscriptionID) +} +func NewPrivateEndpointConnectionsListIterator(page PrivateEndpointConnectionsListPage) PrivateEndpointConnectionsListIterator { + return original.NewPrivateEndpointConnectionsListIterator(page) +} +func NewPrivateEndpointConnectionsListPage(cur PrivateEndpointConnectionsList, getNextPage func(context.Context, PrivateEndpointConnectionsList) (PrivateEndpointConnectionsList, error)) PrivateEndpointConnectionsListPage { + return original.NewPrivateEndpointConnectionsListPage(cur, getNextPage) +} +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return original.NewPrivateLinkResourcesClient(subscriptionID) +} +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return original.NewPrivateLinkResourcesClientWithBaseURI(baseURI, subscriptionID) +} +func NewPrivateLinkResourcesListIterator(page PrivateLinkResourcesListPage) PrivateLinkResourcesListIterator { + return original.NewPrivateLinkResourcesListIterator(page) +} +func NewPrivateLinkResourcesListPage(cur PrivateLinkResourcesList, getNextPage func(context.Context, PrivateLinkResourcesList) (PrivateLinkResourcesList, error)) PrivateLinkResourcesListPage { + return original.NewPrivateLinkResourcesListPage(cur, getNextPage) +} +func NewVNetPeeringClient(subscriptionID string) VNetPeeringClient { + return original.NewVNetPeeringClient(subscriptionID) +} +func NewVNetPeeringClientWithBaseURI(baseURI string, subscriptionID string) VNetPeeringClient { + return original.NewVNetPeeringClientWithBaseURI(baseURI, subscriptionID) +} +func NewVirtualNetworkPeeringListIterator(page VirtualNetworkPeeringListPage) VirtualNetworkPeeringListIterator { + return original.NewVirtualNetworkPeeringListIterator(page) +} +func NewVirtualNetworkPeeringListPage(cur VirtualNetworkPeeringList, getNextPage func(context.Context, VirtualNetworkPeeringList) (VirtualNetworkPeeringList, error)) VirtualNetworkPeeringListPage { + return original.NewVirtualNetworkPeeringListPage(cur, getNextPage) +} +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) +} +func NewWorkspaceListResultIterator(page WorkspaceListResultPage) WorkspaceListResultIterator { + return original.NewWorkspaceListResultIterator(page) +} +func NewWorkspaceListResultPage(cur WorkspaceListResult, getNextPage func(context.Context, WorkspaceListResult) (WorkspaceListResult, error)) WorkspaceListResultPage { + return original.NewWorkspaceListResultPage(cur, getNextPage) +} +func NewWorkspacesClient(subscriptionID string) WorkspacesClient { + return original.NewWorkspacesClient(subscriptionID) +} +func NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { + return original.NewWorkspacesClientWithBaseURI(baseURI, subscriptionID) +} +func PossibleCreatedByTypeValues() []CreatedByType { + return original.PossibleCreatedByTypeValues() +} +func PossibleCustomParameterTypeValues() []CustomParameterType { + return original.PossibleCustomParameterTypeValues() +} +func PossibleKeySourceValues() []KeySource { + return original.PossibleKeySourceValues() +} +func PossiblePeeringProvisioningStateValues() []PeeringProvisioningState { + return original.PossiblePeeringProvisioningStateValues() +} +func PossiblePeeringStateValues() []PeeringState { + return original.PossiblePeeringStateValues() +} +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return original.PossiblePrivateEndpointConnectionProvisioningStateValues() +} +func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { + return original.PossiblePrivateLinkServiceConnectionStatusValues() +} +func PossibleProvisioningStateValues() []ProvisioningState { + return original.PossibleProvisioningStateValues() +} +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return original.PossiblePublicNetworkAccessValues() +} +func PossibleRequiredNsgRulesValues() []RequiredNsgRules { + return original.PossibleRequiredNsgRulesValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/profiles/preview/preview/eventgrid/mgmt/eventgrid/eventgridapi/models.go b/profiles/preview/preview/eventgrid/mgmt/eventgrid/eventgridapi/models.go index 1c5d3ce5ce2b..8b54aefb0bac 100644 --- a/profiles/preview/preview/eventgrid/mgmt/eventgrid/eventgridapi/models.go +++ b/profiles/preview/preview/eventgrid/mgmt/eventgrid/eventgridapi/models.go @@ -8,7 +8,7 @@ package eventgridapi -import original "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid/eventgridapi" +import original "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/eventgridapi" type DomainTopicsClientAPI = original.DomainTopicsClientAPI type DomainsClientAPI = original.DomainsClientAPI diff --git a/profiles/preview/preview/eventgrid/mgmt/eventgrid/models.go b/profiles/preview/preview/eventgrid/mgmt/eventgrid/models.go index bf9e148330f9..c47df8634abe 100644 --- a/profiles/preview/preview/eventgrid/mgmt/eventgrid/models.go +++ b/profiles/preview/preview/eventgrid/mgmt/eventgrid/models.go @@ -11,7 +11,7 @@ package eventgrid import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid" + original "github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid" ) const ( @@ -21,21 +21,21 @@ const ( type CreatedByType = original.CreatedByType const ( - Application CreatedByType = original.Application - Key CreatedByType = original.Key - ManagedIdentity CreatedByType = original.ManagedIdentity - User CreatedByType = original.User + CreatedByTypeApplication CreatedByType = original.CreatedByTypeApplication + CreatedByTypeKey CreatedByType = original.CreatedByTypeKey + CreatedByTypeManagedIdentity CreatedByType = original.CreatedByTypeManagedIdentity + CreatedByTypeUser CreatedByType = original.CreatedByTypeUser ) type DomainProvisioningState = original.DomainProvisioningState const ( - Canceled DomainProvisioningState = original.Canceled - Creating DomainProvisioningState = original.Creating - Deleting DomainProvisioningState = original.Deleting - Failed DomainProvisioningState = original.Failed - Succeeded DomainProvisioningState = original.Succeeded - Updating DomainProvisioningState = original.Updating + DomainProvisioningStateCanceled DomainProvisioningState = original.DomainProvisioningStateCanceled + DomainProvisioningStateCreating DomainProvisioningState = original.DomainProvisioningStateCreating + DomainProvisioningStateDeleting DomainProvisioningState = original.DomainProvisioningStateDeleting + DomainProvisioningStateFailed DomainProvisioningState = original.DomainProvisioningStateFailed + DomainProvisioningStateSucceeded DomainProvisioningState = original.DomainProvisioningStateSucceeded + DomainProvisioningStateUpdating DomainProvisioningState = original.DomainProvisioningStateUpdating ) type DomainTopicProvisioningState = original.DomainTopicProvisioningState @@ -65,8 +65,8 @@ const ( type EndpointTypeBasicDeadLetterDestination = original.EndpointTypeBasicDeadLetterDestination const ( - EndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = original.EndpointTypeDeadLetterDestination - EndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = original.EndpointTypeStorageBlob + EndpointTypeBasicDeadLetterDestinationEndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = original.EndpointTypeBasicDeadLetterDestinationEndpointTypeDeadLetterDestination + EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = original.EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob ) type EventChannelProvisioningState = original.EventChannelProvisioningState @@ -83,16 +83,16 @@ const ( type EventDeliverySchema = original.EventDeliverySchema const ( - CloudEventSchemaV10 EventDeliverySchema = original.CloudEventSchemaV10 - CustomInputSchema EventDeliverySchema = original.CustomInputSchema - EventGridSchema EventDeliverySchema = original.EventGridSchema + EventDeliverySchemaCloudEventSchemaV10 EventDeliverySchema = original.EventDeliverySchemaCloudEventSchemaV10 + EventDeliverySchemaCustomInputSchema EventDeliverySchema = original.EventDeliverySchemaCustomInputSchema + EventDeliverySchemaEventGridSchema EventDeliverySchema = original.EventDeliverySchemaEventGridSchema ) type EventSubscriptionIdentityType = original.EventSubscriptionIdentityType const ( - SystemAssigned EventSubscriptionIdentityType = original.SystemAssigned - UserAssigned EventSubscriptionIdentityType = original.UserAssigned + EventSubscriptionIdentityTypeSystemAssigned EventSubscriptionIdentityType = original.EventSubscriptionIdentityTypeSystemAssigned + EventSubscriptionIdentityTypeUserAssigned EventSubscriptionIdentityType = original.EventSubscriptionIdentityTypeUserAssigned ) type EventSubscriptionProvisioningState = original.EventSubscriptionProvisioningState @@ -110,7 +110,7 @@ const ( type IPActionType = original.IPActionType const ( - Allow IPActionType = original.Allow + IPActionTypeAllow IPActionType = original.IPActionTypeAllow ) type IdentityType = original.IdentityType @@ -187,17 +187,17 @@ const ( type PartnerRegistrationVisibilityState = original.PartnerRegistrationVisibilityState const ( - GenerallyAvailable PartnerRegistrationVisibilityState = original.GenerallyAvailable - Hidden PartnerRegistrationVisibilityState = original.Hidden - PublicPreview PartnerRegistrationVisibilityState = original.PublicPreview + PartnerRegistrationVisibilityStateGenerallyAvailable PartnerRegistrationVisibilityState = original.PartnerRegistrationVisibilityStateGenerallyAvailable + PartnerRegistrationVisibilityStateHidden PartnerRegistrationVisibilityState = original.PartnerRegistrationVisibilityStateHidden + PartnerRegistrationVisibilityStatePublicPreview PartnerRegistrationVisibilityState = original.PartnerRegistrationVisibilityStatePublicPreview ) type PartnerTopicActivationState = original.PartnerTopicActivationState const ( - Activated PartnerTopicActivationState = original.Activated - Deactivated PartnerTopicActivationState = original.Deactivated - NeverActivated PartnerTopicActivationState = original.NeverActivated + PartnerTopicActivationStateActivated PartnerTopicActivationState = original.PartnerTopicActivationStateActivated + PartnerTopicActivationStateDeactivated PartnerTopicActivationState = original.PartnerTopicActivationStateDeactivated + PartnerTopicActivationStateNeverActivated PartnerTopicActivationState = original.PartnerTopicActivationStateNeverActivated ) type PartnerTopicProvisioningState = original.PartnerTopicProvisioningState @@ -214,41 +214,33 @@ const ( type PartnerTopicReadinessState = original.PartnerTopicReadinessState const ( - ActivatedByUser PartnerTopicReadinessState = original.ActivatedByUser - DeactivatedByUser PartnerTopicReadinessState = original.DeactivatedByUser - DeletedByUser PartnerTopicReadinessState = original.DeletedByUser - NotActivatedByUserYet PartnerTopicReadinessState = original.NotActivatedByUserYet -) - -type PartnerTopicTypeAuthorizationState = original.PartnerTopicTypeAuthorizationState - -const ( - Authorized PartnerTopicTypeAuthorizationState = original.Authorized - NotApplicable PartnerTopicTypeAuthorizationState = original.NotApplicable - NotAuthorized PartnerTopicTypeAuthorizationState = original.NotAuthorized + PartnerTopicReadinessStateActivatedByUser PartnerTopicReadinessState = original.PartnerTopicReadinessStateActivatedByUser + PartnerTopicReadinessStateDeactivatedByUser PartnerTopicReadinessState = original.PartnerTopicReadinessStateDeactivatedByUser + PartnerTopicReadinessStateDeletedByUser PartnerTopicReadinessState = original.PartnerTopicReadinessStateDeletedByUser + PartnerTopicReadinessStateNotActivatedByUserYet PartnerTopicReadinessState = original.PartnerTopicReadinessStateNotActivatedByUserYet ) type PersistedConnectionStatus = original.PersistedConnectionStatus const ( - Approved PersistedConnectionStatus = original.Approved - Disconnected PersistedConnectionStatus = original.Disconnected - Pending PersistedConnectionStatus = original.Pending - Rejected PersistedConnectionStatus = original.Rejected + PersistedConnectionStatusApproved PersistedConnectionStatus = original.PersistedConnectionStatusApproved + PersistedConnectionStatusDisconnected PersistedConnectionStatus = original.PersistedConnectionStatusDisconnected + PersistedConnectionStatusPending PersistedConnectionStatus = original.PersistedConnectionStatusPending + PersistedConnectionStatusRejected PersistedConnectionStatus = original.PersistedConnectionStatusRejected ) type PublicNetworkAccess = original.PublicNetworkAccess const ( - Disabled PublicNetworkAccess = original.Disabled - Enabled PublicNetworkAccess = original.Enabled + PublicNetworkAccessDisabled PublicNetworkAccess = original.PublicNetworkAccessDisabled + PublicNetworkAccessEnabled PublicNetworkAccess = original.PublicNetworkAccessEnabled ) type ResourceKind = original.ResourceKind const ( - Azure ResourceKind = original.Azure - AzureArc ResourceKind = original.AzureArc + ResourceKindAzure ResourceKind = original.ResourceKindAzure + ResourceKindAzureArc ResourceKind = original.ResourceKindAzureArc ) type ResourceProvisioningState = original.ResourceProvisioningState @@ -265,15 +257,15 @@ const ( type ResourceRegionType = original.ResourceRegionType const ( - GlobalResource ResourceRegionType = original.GlobalResource - RegionalResource ResourceRegionType = original.RegionalResource + ResourceRegionTypeGlobalResource ResourceRegionType = original.ResourceRegionTypeGlobalResource + ResourceRegionTypeRegionalResource ResourceRegionType = original.ResourceRegionTypeRegionalResource ) type Sku = original.Sku const ( - Basic Sku = original.Basic - Premium Sku = original.Premium + SkuBasic Sku = original.SkuBasic + SkuPremium Sku = original.SkuPremium ) type TopicProvisioningState = original.TopicProvisioningState @@ -405,6 +397,7 @@ type PartnerNamespace = original.PartnerNamespace type PartnerNamespaceProperties = original.PartnerNamespaceProperties type PartnerNamespaceRegenerateKeyRequest = original.PartnerNamespaceRegenerateKeyRequest type PartnerNamespaceSharedAccessKeys = original.PartnerNamespaceSharedAccessKeys +type PartnerNamespaceUpdateParameterProperties = original.PartnerNamespaceUpdateParameterProperties type PartnerNamespaceUpdateParameters = original.PartnerNamespaceUpdateParameters type PartnerNamespacesClient = original.PartnerNamespacesClient type PartnerNamespacesCreateOrUpdateFuture = original.PartnerNamespacesCreateOrUpdateFuture @@ -414,7 +407,6 @@ type PartnerNamespacesListResultIterator = original.PartnerNamespacesListResultI type PartnerNamespacesListResultPage = original.PartnerNamespacesListResultPage type PartnerNamespacesUpdateFuture = original.PartnerNamespacesUpdateFuture type PartnerRegistration = original.PartnerRegistration -type PartnerRegistrationEventTypesListResult = original.PartnerRegistrationEventTypesListResult type PartnerRegistrationProperties = original.PartnerRegistrationProperties type PartnerRegistrationUpdateParameters = original.PartnerRegistrationUpdateParameters type PartnerRegistrationsClient = original.PartnerRegistrationsClient @@ -427,9 +419,6 @@ type PartnerTopicEventSubscriptionsCreateOrUpdateFuture = original.PartnerTopicE type PartnerTopicEventSubscriptionsDeleteFuture = original.PartnerTopicEventSubscriptionsDeleteFuture type PartnerTopicEventSubscriptionsUpdateFuture = original.PartnerTopicEventSubscriptionsUpdateFuture type PartnerTopicProperties = original.PartnerTopicProperties -type PartnerTopicType = original.PartnerTopicType -type PartnerTopicTypeProperties = original.PartnerTopicTypeProperties -type PartnerTopicTypesListResult = original.PartnerTopicTypesListResult type PartnerTopicUpdateParameters = original.PartnerTopicUpdateParameters type PartnerTopicsClient = original.PartnerTopicsClient type PartnerTopicsDeleteFuture = original.PartnerTopicsDeleteFuture @@ -738,9 +727,6 @@ func PossiblePartnerTopicProvisioningStateValues() []PartnerTopicProvisioningSta func PossiblePartnerTopicReadinessStateValues() []PartnerTopicReadinessState { return original.PossiblePartnerTopicReadinessStateValues() } -func PossiblePartnerTopicTypeAuthorizationStateValues() []PartnerTopicTypeAuthorizationState { - return original.PossiblePartnerTopicTypeAuthorizationStateValues() -} func PossiblePersistedConnectionStatusValues() []PersistedConnectionStatus { return original.PossiblePersistedConnectionStatusValues() } diff --git a/profiles/preview/preview/security/mgmt/security/models.go b/profiles/preview/preview/security/mgmt/security/models.go index bbddd28cebc5..f81db71ec01e 100644 --- a/profiles/preview/preview/security/mgmt/security/models.go +++ b/profiles/preview/preview/security/mgmt/security/models.go @@ -43,6 +43,19 @@ const ( ActionTypeWorkspace ActionType = original.ActionTypeWorkspace ) +type AdditionalWorkspaceDataType = original.AdditionalWorkspaceDataType + +const ( + Alerts AdditionalWorkspaceDataType = original.Alerts + RawEvents AdditionalWorkspaceDataType = original.RawEvents +) + +type AdditionalWorkspaceType = original.AdditionalWorkspaceType + +const ( + Sentinel AdditionalWorkspaceType = original.Sentinel +) + type AlertIntent = original.AlertIntent const ( @@ -153,14 +166,27 @@ const ( AutoProvisionOn AutoProvision = original.AutoProvisionOn ) -type Category = original.Category +type BundleType = original.BundleType + +const ( + AppServices BundleType = original.AppServices + DNS BundleType = original.DNS + KeyVaults BundleType = original.KeyVaults + KubernetesService BundleType = original.KubernetesService + ResourceManager BundleType = original.ResourceManager + SQLServers BundleType = original.SQLServers + StorageAccounts BundleType = original.StorageAccounts + VirtualMachines BundleType = original.VirtualMachines +) + +type Categories = original.Categories const ( - Compute Category = original.Compute - Data Category = original.Data - IdentityAndAccess Category = original.IdentityAndAccess - IoT Category = original.IoT - Networking Category = original.Networking + Compute Categories = original.Compute + Data Categories = original.Data + IdentityAndAccess Categories = original.IdentityAndAccess + IoT Categories = original.IoT + Networking Categories = original.Networking ) type ConfigurationStatus = original.ConfigurationStatus @@ -207,6 +233,15 @@ const ( ControlTypeCustom ControlType = original.ControlTypeCustom ) +type CreatedByType = original.CreatedByType + +const ( + Application CreatedByType = original.Application + Key CreatedByType = original.Key + ManagedIdentity CreatedByType = original.ManagedIdentity + User CreatedByType = original.User +) + type DataSource = original.DataSource const ( @@ -234,12 +269,22 @@ const ( Outbound Direction = original.Outbound ) +type EndOfSupportStatus = original.EndOfSupportStatus + +const ( + NoLongerSupported EndOfSupportStatus = original.NoLongerSupported + None EndOfSupportStatus = original.None + UpcomingNoLongerSupported EndOfSupportStatus = original.UpcomingNoLongerSupported + UpcomingVersionNoLongerSupported EndOfSupportStatus = original.UpcomingVersionNoLongerSupported + VersionNoLongerSupported EndOfSupportStatus = original.VersionNoLongerSupported +) + type EnforcementMode = original.EnforcementMode const ( - Audit EnforcementMode = original.Audit - Enforce EnforcementMode = original.Enforce - None EnforcementMode = original.None + EnforcementModeAudit EnforcementMode = original.EnforcementModeAudit + EnforcementModeEnforce EnforcementMode = original.EnforcementModeEnforce + EnforcementModeNone EnforcementMode = original.EnforcementModeNone ) type EnforcementSupport = original.EnforcementSupport @@ -253,11 +298,15 @@ const ( type EventSource = original.EventSource const ( - Alerts EventSource = original.Alerts - Assessments EventSource = original.Assessments - SecureScoreControls EventSource = original.SecureScoreControls - SecureScores EventSource = original.SecureScores - SubAssessments EventSource = original.SubAssessments + EventSourceAlerts EventSource = original.EventSourceAlerts + EventSourceAssessments EventSource = original.EventSourceAssessments + EventSourceRegulatoryComplianceAssessment EventSource = original.EventSourceRegulatoryComplianceAssessment + EventSourceRegulatoryComplianceAssessmentSnapshot EventSource = original.EventSourceRegulatoryComplianceAssessmentSnapshot + EventSourceSecureScoreControls EventSource = original.EventSourceSecureScoreControls + EventSourceSecureScoreControlsSnapshot EventSource = original.EventSourceSecureScoreControlsSnapshot + EventSourceSecureScores EventSource = original.EventSourceSecureScores + EventSourceSecureScoresSnapshot EventSource = original.EventSourceSecureScoresSnapshot + EventSourceSubAssessments EventSource = original.EventSourceSubAssessments ) type Exe = original.Exe @@ -292,7 +341,7 @@ const ( type ExportData = original.ExportData const ( - RawEvents ExportData = original.RawEvents + ExportDataRawEvents ExportData = original.ExportDataRawEvents ) type ExternalSecuritySolutionKind = original.ExternalSecuritySolutionKind @@ -387,6 +436,13 @@ const ( KindExternalSecuritySolution KindEnum1 = original.KindExternalSecuritySolution ) +type KindEnum2 = original.KindEnum2 + +const ( + KindAlertSimulatorRequestProperties KindEnum2 = original.KindAlertSimulatorRequestProperties + KindBundles KindEnum2 = original.KindBundles +) + type MacSignificance = original.MacSignificance const ( @@ -409,6 +465,13 @@ const ( MsiNone Msi = original.MsiNone ) +type OnboardingKind = original.OnboardingKind + +const ( + Default OnboardingKind = original.Default + MigratedToAzure OnboardingKind = original.MigratedToAzure +) + type Operator = original.Operator const ( @@ -632,6 +695,7 @@ const ( RuleTypeAmqpC2DMessagesNotInAllowedRange RuleTypeBasicCustomAlertRule = original.RuleTypeAmqpC2DMessagesNotInAllowedRange RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange RuleTypeBasicCustomAlertRule = original.RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange RuleTypeAmqpD2CMessagesNotInAllowedRange RuleTypeBasicCustomAlertRule = original.RuleTypeAmqpD2CMessagesNotInAllowedRange + RuleTypeConnectionFromIPNotAllowed RuleTypeBasicCustomAlertRule = original.RuleTypeConnectionFromIPNotAllowed RuleTypeConnectionToIPNotAllowed RuleTypeBasicCustomAlertRule = original.RuleTypeConnectionToIPNotAllowed RuleTypeCustomAlertRule RuleTypeBasicCustomAlertRule = original.RuleTypeCustomAlertRule RuleTypeDenylistCustomAlertRule RuleTypeBasicCustomAlertRule = original.RuleTypeDenylistCustomAlertRule @@ -693,6 +757,13 @@ const ( Unavailable SensorStatus = original.Unavailable ) +type SensorType = original.SensorType + +const ( + SensorTypeEnterprise SensorType = original.SensorTypeEnterprise + SensorTypeOt SensorType = original.SensorTypeOt +) + type Severity = original.Severity const ( @@ -855,6 +926,7 @@ type AdaptiveNetworkHardeningsList = original.AdaptiveNetworkHardeningsList type AdaptiveNetworkHardeningsListIterator = original.AdaptiveNetworkHardeningsListIterator type AdaptiveNetworkHardeningsListPage = original.AdaptiveNetworkHardeningsListPage type AdditionalData = original.AdditionalData +type AdditionalWorkspacesProperties = original.AdditionalWorkspacesProperties type AdvancedThreatProtectionClient = original.AdvancedThreatProtectionClient type AdvancedThreatProtectionProperties = original.AdvancedThreatProtectionProperties type AdvancedThreatProtectionSetting = original.AdvancedThreatProtectionSetting @@ -864,7 +936,11 @@ type AlertList = original.AlertList type AlertListIterator = original.AlertListIterator type AlertListPage = original.AlertListPage type AlertProperties = original.AlertProperties +type AlertSimulatorBundlesRequestProperties = original.AlertSimulatorBundlesRequestProperties +type AlertSimulatorRequestBody = original.AlertSimulatorRequestBody +type AlertSimulatorRequestProperties = original.AlertSimulatorRequestProperties type AlertsClient = original.AlertsClient +type AlertsSimulateFuture = original.AlertsSimulateFuture type AlertsSuppressionRule = original.AlertsSuppressionRule type AlertsSuppressionRuleProperties = original.AlertsSuppressionRuleProperties type AlertsSuppressionRulesClient = original.AlertsSuppressionRulesClient @@ -935,6 +1011,7 @@ type BaseClient = original.BaseClient type Baseline = original.Baseline type BaselineAdjustedResult = original.BaselineAdjustedResult type BasicAdditionalData = original.BasicAdditionalData +type BasicAlertSimulatorRequestProperties = original.BasicAlertSimulatorRequestProperties type BasicAllowlistCustomAlertRule = original.BasicAllowlistCustomAlertRule type BasicAuthenticationDetailsProperties = original.BasicAuthenticationDetailsProperties type BasicAutomationAction = original.BasicAutomationAction @@ -970,6 +1047,8 @@ type CompliancesClient = original.CompliancesClient type ConnectableResource = original.ConnectableResource type ConnectedResource = original.ConnectedResource type ConnectedWorkspace = original.ConnectedWorkspace +type ConnectionFromIPNotAllowed = original.ConnectionFromIPNotAllowed +type ConnectionStrings = original.ConnectionStrings type ConnectionToIPNotAllowed = original.ConnectionToIPNotAllowed type ConnectorSetting = original.ConnectorSetting type ConnectorSettingList = original.ConnectorSettingList @@ -1011,6 +1090,7 @@ type DiscoveredSecuritySolutionProperties = original.DiscoveredSecuritySolutionP type DiscoveredSecuritySolutionsClient = original.DiscoveredSecuritySolutionsClient type ETag = original.ETag type EffectiveNetworkSecurityGroups = original.EffectiveNetworkSecurityGroups +type ErrorAdditionalInfo = original.ErrorAdditionalInfo type ExternalSecuritySolution = original.ExternalSecuritySolution type ExternalSecuritySolutionKind1 = original.ExternalSecuritySolutionKind1 type ExternalSecuritySolutionList = original.ExternalSecuritySolutionList @@ -1036,6 +1116,13 @@ type InformationProtectionPolicyListIterator = original.InformationProtectionPol type InformationProtectionPolicyListPage = original.InformationProtectionPolicyListPage type InformationProtectionPolicyProperties = original.InformationProtectionPolicyProperties type InformationType = original.InformationType +type IngestionConnectionString = original.IngestionConnectionString +type IngestionSetting = original.IngestionSetting +type IngestionSettingList = original.IngestionSettingList +type IngestionSettingListIterator = original.IngestionSettingListIterator +type IngestionSettingListPage = original.IngestionSettingListPage +type IngestionSettingToken = original.IngestionSettingToken +type IngestionSettingsClient = original.IngestionSettingsClient type IoTSecurityAggregatedAlert = original.IoTSecurityAggregatedAlert type IoTSecurityAggregatedAlertList = original.IoTSecurityAggregatedAlertList type IoTSecurityAggregatedAlertListIterator = original.IoTSecurityAggregatedAlertListIterator @@ -1060,15 +1147,10 @@ type IoTSecuritySolutionsList = original.IoTSecuritySolutionsList type IoTSecuritySolutionsListIterator = original.IoTSecuritySolutionsListIterator type IoTSecuritySolutionsListPage = original.IoTSecuritySolutionsListPage type IoTSeverityMetrics = original.IoTSeverityMetrics -type IotAlert = original.IotAlert -type IotAlertList = original.IotAlertList -type IotAlertListIterator = original.IotAlertListIterator type IotAlertListModel = original.IotAlertListModel type IotAlertListModelIterator = original.IotAlertListModelIterator type IotAlertListModelPage = original.IotAlertListModelPage -type IotAlertListPage = original.IotAlertListPage type IotAlertModel = original.IotAlertModel -type IotAlertProperties = original.IotAlertProperties type IotAlertPropertiesModel = original.IotAlertPropertiesModel type IotAlertType = original.IotAlertType type IotAlertTypeList = original.IotAlertTypeList @@ -1079,15 +1161,10 @@ type IotDefenderSettingsClient = original.IotDefenderSettingsClient type IotDefenderSettingsList = original.IotDefenderSettingsList type IotDefenderSettingsModel = original.IotDefenderSettingsModel type IotDefenderSettingsProperties = original.IotDefenderSettingsProperties -type IotRecommendation = original.IotRecommendation -type IotRecommendationList = original.IotRecommendationList -type IotRecommendationListIterator = original.IotRecommendationListIterator type IotRecommendationListModel = original.IotRecommendationListModel type IotRecommendationListModelIterator = original.IotRecommendationListModelIterator type IotRecommendationListModelPage = original.IotRecommendationListModelPage -type IotRecommendationListPage = original.IotRecommendationListPage type IotRecommendationModel = original.IotRecommendationModel -type IotRecommendationProperties = original.IotRecommendationProperties type IotRecommendationPropertiesModel = original.IotRecommendationPropertiesModel type IotRecommendationType = original.IotRecommendationType type IotRecommendationTypeList = original.IotRecommendationTypeList @@ -1229,6 +1306,7 @@ type SensitivityLabel = original.SensitivityLabel type Sensor = original.Sensor type ServerVulnerabilityAssessment = original.ServerVulnerabilityAssessment type ServerVulnerabilityAssessmentClient = original.ServerVulnerabilityAssessmentClient +type ServerVulnerabilityAssessmentDeleteFuture = original.ServerVulnerabilityAssessmentDeleteFuture type ServerVulnerabilityAssessmentProperties = original.ServerVulnerabilityAssessmentProperties type ServerVulnerabilityAssessmentsList = original.ServerVulnerabilityAssessmentsList type ServerVulnerabilityProperties = original.ServerVulnerabilityProperties @@ -1240,6 +1318,12 @@ type SettingsList = original.SettingsList type SettingsListIterator = original.SettingsListIterator type SettingsListPage = original.SettingsListPage type Site = original.Site +type Software = original.Software +type SoftwareInventoriesClient = original.SoftwareInventoriesClient +type SoftwareProperties = original.SoftwareProperties +type SoftwaresList = original.SoftwaresList +type SoftwaresListIterator = original.SoftwaresListIterator +type SoftwaresListPage = original.SoftwaresListPage type Solution = original.Solution type SolutionList = original.SolutionList type SolutionListIterator = original.SolutionListIterator @@ -1258,6 +1342,7 @@ type SubAssessmentProperties = original.SubAssessmentProperties type SubAssessmentStatus = original.SubAssessmentStatus type SubAssessmentsClient = original.SubAssessmentsClient type SuppressionAlertsScope = original.SuppressionAlertsScope +type SystemData = original.SystemData type Tags = original.Tags type TagsResource = original.TagsResource type Task = original.Task @@ -1533,6 +1618,18 @@ func NewInformationProtectionPolicyListIterator(page InformationProtectionPolicy func NewInformationProtectionPolicyListPage(cur InformationProtectionPolicyList, getNextPage func(context.Context, InformationProtectionPolicyList) (InformationProtectionPolicyList, error)) InformationProtectionPolicyListPage { return original.NewInformationProtectionPolicyListPage(cur, getNextPage) } +func NewIngestionSettingListIterator(page IngestionSettingListPage) IngestionSettingListIterator { + return original.NewIngestionSettingListIterator(page) +} +func NewIngestionSettingListPage(cur IngestionSettingList, getNextPage func(context.Context, IngestionSettingList) (IngestionSettingList, error)) IngestionSettingListPage { + return original.NewIngestionSettingListPage(cur, getNextPage) +} +func NewIngestionSettingsClient(subscriptionID string, ascLocation string) IngestionSettingsClient { + return original.NewIngestionSettingsClient(subscriptionID, ascLocation) +} +func NewIngestionSettingsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IngestionSettingsClient { + return original.NewIngestionSettingsClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} func NewIoTSecurityAggregatedAlertListIterator(page IoTSecurityAggregatedAlertListPage) IoTSecurityAggregatedAlertListIterator { return original.NewIoTSecurityAggregatedAlertListIterator(page) } @@ -1551,18 +1648,12 @@ func NewIoTSecuritySolutionsListIterator(page IoTSecuritySolutionsListPage) IoTS func NewIoTSecuritySolutionsListPage(cur IoTSecuritySolutionsList, getNextPage func(context.Context, IoTSecuritySolutionsList) (IoTSecuritySolutionsList, error)) IoTSecuritySolutionsListPage { return original.NewIoTSecuritySolutionsListPage(cur, getNextPage) } -func NewIotAlertListIterator(page IotAlertListPage) IotAlertListIterator { - return original.NewIotAlertListIterator(page) -} func NewIotAlertListModelIterator(page IotAlertListModelPage) IotAlertListModelIterator { return original.NewIotAlertListModelIterator(page) } func NewIotAlertListModelPage(cur IotAlertListModel, getNextPage func(context.Context, IotAlertListModel) (IotAlertListModel, error)) IotAlertListModelPage { return original.NewIotAlertListModelPage(cur, getNextPage) } -func NewIotAlertListPage(cur IotAlertList, getNextPage func(context.Context, IotAlertList) (IotAlertList, error)) IotAlertListPage { - return original.NewIotAlertListPage(cur, getNextPage) -} func NewIotAlertTypesClient(subscriptionID string, ascLocation string) IotAlertTypesClient { return original.NewIotAlertTypesClient(subscriptionID, ascLocation) } @@ -1581,18 +1672,12 @@ func NewIotDefenderSettingsClient(subscriptionID string, ascLocation string) Iot func NewIotDefenderSettingsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IotDefenderSettingsClient { return original.NewIotDefenderSettingsClientWithBaseURI(baseURI, subscriptionID, ascLocation) } -func NewIotRecommendationListIterator(page IotRecommendationListPage) IotRecommendationListIterator { - return original.NewIotRecommendationListIterator(page) -} func NewIotRecommendationListModelIterator(page IotRecommendationListModelPage) IotRecommendationListModelIterator { return original.NewIotRecommendationListModelIterator(page) } func NewIotRecommendationListModelPage(cur IotRecommendationListModel, getNextPage func(context.Context, IotRecommendationListModel) (IotRecommendationListModel, error)) IotRecommendationListModelPage { return original.NewIotRecommendationListModelPage(cur, getNextPage) } -func NewIotRecommendationListPage(cur IotRecommendationList, getNextPage func(context.Context, IotRecommendationList) (IotRecommendationList, error)) IotRecommendationListPage { - return original.NewIotRecommendationListPage(cur, getNextPage) -} func NewIotRecommendationTypesClient(subscriptionID string, ascLocation string) IotRecommendationTypesClient { return original.NewIotRecommendationTypesClient(subscriptionID, ascLocation) } @@ -1791,6 +1876,18 @@ func NewSettingsListIterator(page SettingsListPage) SettingsListIterator { func NewSettingsListPage(cur SettingsList, getNextPage func(context.Context, SettingsList) (SettingsList, error)) SettingsListPage { return original.NewSettingsListPage(cur, getNextPage) } +func NewSoftwareInventoriesClient(subscriptionID string, ascLocation string) SoftwareInventoriesClient { + return original.NewSoftwareInventoriesClient(subscriptionID, ascLocation) +} +func NewSoftwareInventoriesClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) SoftwareInventoriesClient { + return original.NewSoftwareInventoriesClientWithBaseURI(baseURI, subscriptionID, ascLocation) +} +func NewSoftwaresListIterator(page SoftwaresListPage) SoftwaresListIterator { + return original.NewSoftwaresListIterator(page) +} +func NewSoftwaresListPage(cur SoftwaresList, getNextPage func(context.Context, SoftwaresList) (SoftwaresList, error)) SoftwaresListPage { + return original.NewSoftwaresListPage(cur, getNextPage) +} func NewSolutionListIterator(page SolutionListPage) SolutionListIterator { return original.NewSolutionListIterator(page) } @@ -1869,6 +1966,12 @@ func PossibleActionTypeValues() []ActionType { func PossibleActionValues() []Action { return original.PossibleActionValues() } +func PossibleAdditionalWorkspaceDataTypeValues() []AdditionalWorkspaceDataType { + return original.PossibleAdditionalWorkspaceDataTypeValues() +} +func PossibleAdditionalWorkspaceTypeValues() []AdditionalWorkspaceType { + return original.PossibleAdditionalWorkspaceTypeValues() +} func PossibleAlertIntentValues() []AlertIntent { return original.PossibleAlertIntentValues() } @@ -1905,8 +2008,11 @@ func PossibleAuthorizationStateValues() []AuthorizationState { func PossibleAutoProvisionValues() []AutoProvision { return original.PossibleAutoProvisionValues() } -func PossibleCategoryValues() []Category { - return original.PossibleCategoryValues() +func PossibleBundleTypeValues() []BundleType { + return original.PossibleBundleTypeValues() +} +func PossibleCategoriesValues() []Categories { + return original.PossibleCategoriesValues() } func PossibleConfigurationStatus1Values() []ConfigurationStatus1 { return original.PossibleConfigurationStatus1Values() @@ -1923,6 +2029,9 @@ func PossibleConnectionTypeValues() []ConnectionType { func PossibleControlTypeValues() []ControlType { return original.PossibleControlTypeValues() } +func PossibleCreatedByTypeValues() []CreatedByType { + return original.PossibleCreatedByTypeValues() +} func PossibleDataSourceValues() []DataSource { return original.PossibleDataSourceValues() } @@ -1935,6 +2044,9 @@ func PossibleDeviceStatusValues() []DeviceStatus { func PossibleDirectionValues() []Direction { return original.PossibleDirectionValues() } +func PossibleEndOfSupportStatusValues() []EndOfSupportStatus { + return original.PossibleEndOfSupportStatusValues() +} func PossibleEnforcementModeValues() []EnforcementMode { return original.PossibleEnforcementModeValues() } @@ -1983,6 +2095,9 @@ func PossibleIssueValues() []Issue { func PossibleKindEnum1Values() []KindEnum1 { return original.PossibleKindEnum1Values() } +func PossibleKindEnum2Values() []KindEnum2 { + return original.PossibleKindEnum2Values() +} func PossibleKindEnumValues() []KindEnum { return original.PossibleKindEnumValues() } @@ -1995,6 +2110,9 @@ func PossibleManagementStateValues() []ManagementState { func PossibleMsiValues() []Msi { return original.PossibleMsiValues() } +func PossibleOnboardingKindValues() []OnboardingKind { + return original.PossibleOnboardingKindValues() +} func PossibleOperatorValues() []Operator { return original.PossibleOperatorValues() } @@ -2082,6 +2200,9 @@ func PossibleScriptValues() []Script { func PossibleSensorStatusValues() []SensorStatus { return original.PossibleSensorStatusValues() } +func PossibleSensorTypeValues() []SensorType { + return original.PossibleSensorTypeValues() +} func PossibleSeverityValues() []Severity { return original.PossibleSeverityValues() } diff --git a/profiles/preview/preview/security/mgmt/security/securityapi/models.go b/profiles/preview/preview/security/mgmt/security/securityapi/models.go index 7d81c614db98..e3e4e77d34d7 100644 --- a/profiles/preview/preview/security/mgmt/security/securityapi/models.go +++ b/profiles/preview/preview/security/mgmt/security/securityapi/models.go @@ -31,6 +31,7 @@ type DevicesForSubscriptionClientAPI = original.DevicesForSubscriptionClientAPI type DiscoveredSecuritySolutionsClientAPI = original.DiscoveredSecuritySolutionsClientAPI type ExternalSecuritySolutionsClientAPI = original.ExternalSecuritySolutionsClientAPI type InformationProtectionPoliciesClientAPI = original.InformationProtectionPoliciesClientAPI +type IngestionSettingsClientAPI = original.IngestionSettingsClientAPI type IotAlertTypesClientAPI = original.IotAlertTypesClientAPI type IotAlertsClientAPI = original.IotAlertsClientAPI type IotDefenderSettingsClientAPI = original.IotDefenderSettingsClientAPI @@ -58,6 +59,7 @@ type SecureScoreControlsClientAPI = original.SecureScoreControlsClientAPI type SecureScoresClientAPI = original.SecureScoresClientAPI type ServerVulnerabilityAssessmentClientAPI = original.ServerVulnerabilityAssessmentClientAPI type SettingsClientAPI = original.SettingsClientAPI +type SoftwareInventoriesClientAPI = original.SoftwareInventoriesClientAPI type SolutionsClientAPI = original.SolutionsClientAPI type SolutionsReferenceDataClientAPI = original.SolutionsReferenceDataClientAPI type SubAssessmentsClientAPI = original.SubAssessmentsClientAPI diff --git a/profiles/preview/trafficmanager/mgmt/trafficmanager/models.go b/profiles/preview/trafficmanager/mgmt/trafficmanager/models.go index ef9ba373d8e3..8e7e2f7e5eb3 100644 --- a/profiles/preview/trafficmanager/mgmt/trafficmanager/models.go +++ b/profiles/preview/trafficmanager/mgmt/trafficmanager/models.go @@ -8,21 +8,30 @@ package trafficmanager -import original "github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-04-01/trafficmanager" +import original "github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-08-01/trafficmanager" const ( DefaultBaseURI = original.DefaultBaseURI ) +type AllowedEndpointRecordType = original.AllowedEndpointRecordType + +const ( + AllowedEndpointRecordTypeAny AllowedEndpointRecordType = original.AllowedEndpointRecordTypeAny + AllowedEndpointRecordTypeDomainName AllowedEndpointRecordType = original.AllowedEndpointRecordTypeDomainName + AllowedEndpointRecordTypeIPv4Address AllowedEndpointRecordType = original.AllowedEndpointRecordTypeIPv4Address + AllowedEndpointRecordTypeIPv6Address AllowedEndpointRecordType = original.AllowedEndpointRecordTypeIPv6Address +) + type EndpointMonitorStatus = original.EndpointMonitorStatus const ( - CheckingEndpoint EndpointMonitorStatus = original.CheckingEndpoint - Degraded EndpointMonitorStatus = original.Degraded - Disabled EndpointMonitorStatus = original.Disabled - Inactive EndpointMonitorStatus = original.Inactive - Online EndpointMonitorStatus = original.Online - Stopped EndpointMonitorStatus = original.Stopped + EndpointMonitorStatusCheckingEndpoint EndpointMonitorStatus = original.EndpointMonitorStatusCheckingEndpoint + EndpointMonitorStatusDegraded EndpointMonitorStatus = original.EndpointMonitorStatusDegraded + EndpointMonitorStatusDisabled EndpointMonitorStatus = original.EndpointMonitorStatusDisabled + EndpointMonitorStatusInactive EndpointMonitorStatus = original.EndpointMonitorStatusInactive + EndpointMonitorStatusOnline EndpointMonitorStatus = original.EndpointMonitorStatusOnline + EndpointMonitorStatusStopped EndpointMonitorStatus = original.EndpointMonitorStatusStopped ) type EndpointStatus = original.EndpointStatus @@ -35,9 +44,9 @@ const ( type MonitorProtocol = original.MonitorProtocol const ( - HTTP MonitorProtocol = original.HTTP - HTTPS MonitorProtocol = original.HTTPS - TCP MonitorProtocol = original.TCP + MonitorProtocolHTTP MonitorProtocol = original.MonitorProtocolHTTP + MonitorProtocolHTTPS MonitorProtocol = original.MonitorProtocolHTTPS + MonitorProtocolTCP MonitorProtocol = original.MonitorProtocolTCP ) type ProfileMonitorStatus = original.ProfileMonitorStatus @@ -60,12 +69,12 @@ const ( type TrafficRoutingMethod = original.TrafficRoutingMethod const ( - Geographic TrafficRoutingMethod = original.Geographic - MultiValue TrafficRoutingMethod = original.MultiValue - Performance TrafficRoutingMethod = original.Performance - Priority TrafficRoutingMethod = original.Priority - Subnet TrafficRoutingMethod = original.Subnet - Weighted TrafficRoutingMethod = original.Weighted + TrafficRoutingMethodGeographic TrafficRoutingMethod = original.TrafficRoutingMethodGeographic + TrafficRoutingMethodMultiValue TrafficRoutingMethod = original.TrafficRoutingMethodMultiValue + TrafficRoutingMethodPerformance TrafficRoutingMethod = original.TrafficRoutingMethodPerformance + TrafficRoutingMethodPriority TrafficRoutingMethod = original.TrafficRoutingMethodPriority + TrafficRoutingMethodSubnet TrafficRoutingMethod = original.TrafficRoutingMethodSubnet + TrafficRoutingMethodWeighted TrafficRoutingMethod = original.TrafficRoutingMethodWeighted ) type TrafficViewEnrollmentStatus = original.TrafficViewEnrollmentStatus @@ -147,6 +156,9 @@ func NewUserMetricsKeysClientWithBaseURI(baseURI string, subscriptionID string) func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } +func PossibleAllowedEndpointRecordTypeValues() []AllowedEndpointRecordType { + return original.PossibleAllowedEndpointRecordTypeValues() +} func PossibleEndpointMonitorStatusValues() []EndpointMonitorStatus { return original.PossibleEndpointMonitorStatusValues() } diff --git a/profiles/preview/trafficmanager/mgmt/trafficmanager/trafficmanagerapi/models.go b/profiles/preview/trafficmanager/mgmt/trafficmanager/trafficmanagerapi/models.go index 9fed180a135b..ec89458a2c78 100644 --- a/profiles/preview/trafficmanager/mgmt/trafficmanager/trafficmanagerapi/models.go +++ b/profiles/preview/trafficmanager/mgmt/trafficmanager/trafficmanagerapi/models.go @@ -8,7 +8,7 @@ package trafficmanagerapi -import original "github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-04-01/trafficmanager/trafficmanagerapi" +import original "github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-08-01/trafficmanager/trafficmanagerapi" type EndpointsClientAPI = original.EndpointsClientAPI type GeographicHierarchiesClientAPI = original.GeographicHierarchiesClientAPI diff --git a/services/preview/databricks/mgmt/2021-04-01-preview/databricks/CHANGELOG.md b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/preview/databricks/mgmt/2021-04-01-preview/databricks/_meta.json b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/_meta.json new file mode 100644 index 000000000000..86c066542123 --- /dev/null +++ b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "2b0b50e3e5bd467aa039a51cafa2a071593eca28", + "readme": "/_/azure-rest-api-specs/specification/databricks/resource-manager/readme.md", + "tag": "package-2021-04-01-preview", + "use": "@microsoft.azure/autorest.go@2.1.183", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2021-04-01-preview --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/databricks/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/databricks/mgmt/2021-04-01-preview/databricks/client.go b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/client.go new file mode 100644 index 000000000000..6c57631b61e0 --- /dev/null +++ b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/client.go @@ -0,0 +1,41 @@ +// Package databricks implements the Azure ARM Databricks service API version . +// +// The Microsoft Azure management APIs allow end users to operate on Azure Databricks Workspace resources. +package databricks + +// 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 Databricks + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Databricks. +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/databricks/mgmt/2021-04-01-preview/databricks/databricksapi/interfaces.go b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/databricksapi/interfaces.go new file mode 100644 index 000000000000..3399dfafa457 --- /dev/null +++ b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/databricksapi/interfaces.go @@ -0,0 +1,65 @@ +package databricksapi + +// 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/databricks/mgmt/2021-04-01-preview/databricks" +) + +// WorkspacesClientAPI contains the set of methods on the WorkspacesClient type. +type WorkspacesClientAPI interface { + CreateOrUpdate(ctx context.Context, parameters databricks.Workspace, resourceGroupName string, workspaceName string) (result databricks.WorkspacesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result databricks.WorkspacesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string) (result databricks.Workspace, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result databricks.WorkspaceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result databricks.WorkspaceListResultIterator, err error) + ListBySubscription(ctx context.Context) (result databricks.WorkspaceListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result databricks.WorkspaceListResultIterator, err error) + Update(ctx context.Context, parameters databricks.WorkspaceUpdate, resourceGroupName string, workspaceName string) (result databricks.WorkspacesUpdateFuture, err error) +} + +var _ WorkspacesClientAPI = (*databricks.WorkspacesClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result databricks.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result databricks.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*databricks.OperationsClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, workspaceName string, groupID string) (result databricks.GroupIDInformation, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result databricks.PrivateLinkResourcesListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result databricks.PrivateLinkResourcesListIterator, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*databricks.PrivateLinkResourcesClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, privateEndpointConnection databricks.PrivateEndpointConnection) (result databricks.PrivateEndpointConnectionsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result databricks.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result databricks.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result databricks.PrivateEndpointConnectionsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result databricks.PrivateEndpointConnectionsListIterator, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*databricks.PrivateEndpointConnectionsClient)(nil) + +// VNetPeeringClientAPI contains the set of methods on the VNetPeeringClient type. +type VNetPeeringClientAPI interface { + CreateOrUpdate(ctx context.Context, virtualNetworkPeeringParameters databricks.VirtualNetworkPeering, resourceGroupName string, workspaceName string, peeringName string) (result databricks.VNetPeeringCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, workspaceName string, peeringName string) (result databricks.VNetPeeringDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, workspaceName string, peeringName string) (result databricks.VirtualNetworkPeering, err error) + ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result databricks.VirtualNetworkPeeringListPage, err error) + ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result databricks.VirtualNetworkPeeringListIterator, err error) +} + +var _ VNetPeeringClientAPI = (*databricks.VNetPeeringClient)(nil) diff --git a/services/preview/databricks/mgmt/2021-04-01-preview/databricks/enums.go b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/enums.go new file mode 100644 index 000000000000..7d78e4a819f1 --- /dev/null +++ b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/enums.go @@ -0,0 +1,200 @@ +package databricks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // 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} +} + +// CustomParameterType enumerates the values for custom parameter type. +type CustomParameterType string + +const ( + // CustomParameterTypeBool ... + CustomParameterTypeBool CustomParameterType = "Bool" + // CustomParameterTypeObject ... + CustomParameterTypeObject CustomParameterType = "Object" + // CustomParameterTypeString ... + CustomParameterTypeString CustomParameterType = "String" +) + +// PossibleCustomParameterTypeValues returns an array of possible values for the CustomParameterType const type. +func PossibleCustomParameterTypeValues() []CustomParameterType { + return []CustomParameterType{CustomParameterTypeBool, CustomParameterTypeObject, CustomParameterTypeString} +} + +// KeySource enumerates the values for key source. +type KeySource string + +const ( + // KeySourceDefault ... + KeySourceDefault KeySource = "Default" + // KeySourceMicrosoftKeyvault ... + KeySourceMicrosoftKeyvault KeySource = "Microsoft.Keyvault" +) + +// PossibleKeySourceValues returns an array of possible values for the KeySource const type. +func PossibleKeySourceValues() []KeySource { + return []KeySource{KeySourceDefault, KeySourceMicrosoftKeyvault} +} + +// PeeringProvisioningState enumerates the values for peering provisioning state. +type PeeringProvisioningState string + +const ( + // PeeringProvisioningStateDeleting ... + PeeringProvisioningStateDeleting PeeringProvisioningState = "Deleting" + // PeeringProvisioningStateFailed ... + PeeringProvisioningStateFailed PeeringProvisioningState = "Failed" + // PeeringProvisioningStateSucceeded ... + PeeringProvisioningStateSucceeded PeeringProvisioningState = "Succeeded" + // PeeringProvisioningStateUpdating ... + PeeringProvisioningStateUpdating PeeringProvisioningState = "Updating" +) + +// PossiblePeeringProvisioningStateValues returns an array of possible values for the PeeringProvisioningState const type. +func PossiblePeeringProvisioningStateValues() []PeeringProvisioningState { + return []PeeringProvisioningState{PeeringProvisioningStateDeleting, PeeringProvisioningStateFailed, PeeringProvisioningStateSucceeded, PeeringProvisioningStateUpdating} +} + +// PeeringState enumerates the values for peering state. +type PeeringState string + +const ( + // PeeringStateConnected ... + PeeringStateConnected PeeringState = "Connected" + // PeeringStateDisconnected ... + PeeringStateDisconnected PeeringState = "Disconnected" + // PeeringStateInitiated ... + PeeringStateInitiated PeeringState = "Initiated" +) + +// PossiblePeeringStateValues returns an array of possible values for the PeeringState const type. +func PossiblePeeringStateValues() []PeeringState { + return []PeeringState{PeeringStateConnected, PeeringStateDisconnected, PeeringStateInitiated} +} + +// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection +// provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // PrivateEndpointConnectionProvisioningStateCreating ... + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + // PrivateEndpointConnectionProvisioningStateDeleting ... + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + // PrivateEndpointConnectionProvisioningStateFailed ... + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded ... + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + // PrivateEndpointConnectionProvisioningStateUpdating ... + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded, PrivateEndpointConnectionProvisioningStateUpdating} +} + +// PrivateLinkServiceConnectionStatus enumerates the values for private link service connection status. +type PrivateLinkServiceConnectionStatus string + +const ( + // PrivateLinkServiceConnectionStatusApproved ... + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + // PrivateLinkServiceConnectionStatusDisconnected ... + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + // PrivateLinkServiceConnectionStatusPending ... + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + // PrivateLinkServiceConnectionStatusRejected ... + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateLinkServiceConnectionStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStatus const type. +func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { + return []PrivateLinkServiceConnectionStatus{PrivateLinkServiceConnectionStatusApproved, PrivateLinkServiceConnectionStatusDisconnected, PrivateLinkServiceConnectionStatusPending, PrivateLinkServiceConnectionStatusRejected} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted ... + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreated ... + ProvisioningStateCreated ProvisioningState = "Created" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted ... + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateReady ... + ProvisioningStateReady ProvisioningState = "Ready" + // ProvisioningStateRunning ... + ProvisioningStateRunning ProvisioningState = "Running" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateAccepted, ProvisioningStateCanceled, ProvisioningStateCreated, ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateReady, ProvisioningStateRunning, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// RequiredNsgRules enumerates the values for required nsg rules. +type RequiredNsgRules string + +const ( + // RequiredNsgRulesAllRules ... + RequiredNsgRulesAllRules RequiredNsgRules = "AllRules" + // RequiredNsgRulesNoAzureDatabricksRules ... + RequiredNsgRulesNoAzureDatabricksRules RequiredNsgRules = "NoAzureDatabricksRules" + // RequiredNsgRulesNoAzureServiceRules ... + RequiredNsgRulesNoAzureServiceRules RequiredNsgRules = "NoAzureServiceRules" +) + +// PossibleRequiredNsgRulesValues returns an array of possible values for the RequiredNsgRules const type. +func PossibleRequiredNsgRulesValues() []RequiredNsgRules { + return []RequiredNsgRules{RequiredNsgRulesAllRules, RequiredNsgRulesNoAzureDatabricksRules, RequiredNsgRulesNoAzureServiceRules} +} diff --git a/services/preview/databricks/mgmt/2021-04-01-preview/databricks/models.go b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/models.go new file mode 100644 index 000000000000..589bc4b44784 --- /dev/null +++ b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/models.go @@ -0,0 +1,1865 @@ +package databricks + +// 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" + "github.com/gofrs/uuid" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks" + +// AddressSpace addressSpace contains an array of IP address ranges that can be used by subnets of the +// virtual network. +type AddressSpace struct { + // AddressPrefixes - A list of address blocks reserved for this virtual network in CIDR notation. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` +} + +// CreatedBy provides details of the entity that created/updated the workspace. +type CreatedBy struct { + // Oid - READ-ONLY; The Object ID that created the workspace. + Oid *uuid.UUID `json:"oid,omitempty"` + // Puid - READ-ONLY; The Personal Object ID corresponding to the object ID above + Puid *string `json:"puid,omitempty"` + // ApplicationID - READ-ONLY; The application ID of the application that initiated the creation of the workspace. For example, Azure Portal. + ApplicationID *uuid.UUID `json:"applicationId,omitempty"` +} + +// MarshalJSON is the custom marshaler for CreatedBy. +func (cb CreatedBy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Encryption the object that contains details of encryption used on the workspace. +type Encryption struct { + // KeySource - The encryption keySource (provider). Possible values (case-insensitive): Default, Microsoft.Keyvault. Possible values include: 'KeySourceDefault', 'KeySourceMicrosoftKeyvault' + KeySource KeySource `json:"keySource,omitempty"` + // KeyName - The name of KeyVault key. + KeyName *string `json:"KeyName,omitempty"` + // KeyVersion - The version of KeyVault key. + KeyVersion *string `json:"keyversion,omitempty"` + // KeyVaultURI - The Uri of KeyVault. + KeyVaultURI *string `json:"keyvaulturi,omitempty"` +} + +// EncryptionEntitiesDefinition encryption entities for databricks workspace resource. +type EncryptionEntitiesDefinition struct { + // ManagedServices - Encryption properties for the databricks managed services. + ManagedServices *EncryptionV2 `json:"managedServices,omitempty"` +} + +// EncryptionV2 the object that contains details of encryption used on the workspace. +type EncryptionV2 struct { + // KeySource - The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Keyvault + KeySource *string `json:"keySource,omitempty"` + // KeyVaultProperties - Key Vault input properties for encryption. + KeyVaultProperties *EncryptionV2KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} + +// EncryptionV2KeyVaultProperties key Vault input properties for encryption. +type EncryptionV2KeyVaultProperties struct { + // KeyVaultURI - The Uri of KeyVault. + KeyVaultURI *string `json:"keyVaultUri,omitempty"` + // KeyName - The name of KeyVault key. + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - The version of KeyVault key. + KeyVersion *string `json:"keyVersion,omitempty"` +} + +// ErrorDetail ... +type ErrorDetail struct { + // Code - The error's code. + Code *string `json:"code,omitempty"` + // Message - A human readable error message. + Message *string `json:"message,omitempty"` + // Target - Indicates which property in the request is responsible for the error. + Target *string `json:"target,omitempty"` +} + +// ErrorInfo ... +type ErrorInfo struct { + // Code - A machine readable error code. + Code *string `json:"code,omitempty"` + // Message - A human readable error message. + Message *string `json:"message,omitempty"` + // Details - error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // Innererror - Inner error details if they exist. + Innererror *string `json:"innererror,omitempty"` +} + +// ErrorResponse contains details when the response code indicates an error. +type ErrorResponse struct { + // Error - The error details. + Error *ErrorInfo `json:"error,omitempty"` +} + +// GroupIDInformation the group information for creating a private endpoint on a workspace +type GroupIDInformation struct { + autorest.Response `json:"-"` + // Properties - The group id properties. + Properties *GroupIDInformationProperties `json:"properties,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 GroupIDInformation. +func (gii GroupIDInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gii.Properties != nil { + objectMap["properties"] = gii.Properties + } + return json.Marshal(objectMap) +} + +// GroupIDInformationProperties the properties for a group information object +type GroupIDInformationProperties struct { + // GroupID - The group id + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - The required members for a specific group id + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - The required DNS zones for a specific group id + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// ManagedIdentityConfiguration the Managed Identity details for storage account. +type ManagedIdentityConfiguration struct { + // PrincipalID - READ-ONLY; The objectId of the Managed Identity that is linked to the Managed Storage account. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant Id where the Managed Identity is created. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Type - READ-ONLY; The type of Identity created. It can be either SystemAssigned or UserAssigned. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedIdentityConfiguration. +func (mic ManagedIdentityConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Operation REST API operation +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft.ResourceProvider + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult result of the request to list Resource Provider 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 Resource Provider operations supported by the Resource Provider resource 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"` +} + +// 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, + } +} + +// PrivateEndpoint the private endpoint property of a private endpoint connection +type PrivateEndpoint struct { + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection the private endpoint connection of a workspace +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Properties - The private endpoint connection properties. + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.Properties != nil { + objectMap["properties"] = pec.Properties + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionProperties the properties of a private endpoint connection +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - Private endpoint + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - Private endpoint connection state + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - Provisioning state of the private endpoint connection. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateUpdating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} + +// PrivateEndpointConnectionsCreateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsCreateFuture 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 *PrivateEndpointConnectionsCreateFuture) 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 PrivateEndpointConnectionsCreateFuture.Result. +func (future *PrivateEndpointConnectionsCreateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.PrivateEndpointConnectionsCreateFuture") + 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.CreateResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsCreateFuture", "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, "databricks.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateEndpointConnectionsList list of private link connections. +type PrivateEndpointConnectionsList struct { + autorest.Response `json:"-"` + // Value - The list of returned private endpoint connection. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - The URL to get the next set of endpoint connections. + NextLink *string `json:"nextLink,omitempty"` +} + +// PrivateEndpointConnectionsListIterator provides access to a complete listing of +// PrivateEndpointConnection values. +type PrivateEndpointConnectionsListIterator struct { + i int + page PrivateEndpointConnectionsListPage +} + +// 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 *PrivateEndpointConnectionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsListIterator.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 *PrivateEndpointConnectionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointConnectionsListIterator) 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 PrivateEndpointConnectionsListIterator) Response() PrivateEndpointConnectionsList { + 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 PrivateEndpointConnectionsListIterator) Value() PrivateEndpointConnection { + if !iter.page.NotDone() { + return PrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointConnectionsListIterator type. +func NewPrivateEndpointConnectionsListIterator(page PrivateEndpointConnectionsListPage) PrivateEndpointConnectionsListIterator { + return PrivateEndpointConnectionsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pecl PrivateEndpointConnectionsList) IsEmpty() bool { + return pecl.Value == nil || len(*pecl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pecl PrivateEndpointConnectionsList) hasNextLink() bool { + return pecl.NextLink != nil && len(*pecl.NextLink) != 0 +} + +// privateEndpointConnectionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pecl PrivateEndpointConnectionsList) privateEndpointConnectionsListPreparer(ctx context.Context) (*http.Request, error) { + if !pecl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pecl.NextLink))) +} + +// PrivateEndpointConnectionsListPage contains a page of PrivateEndpointConnection values. +type PrivateEndpointConnectionsListPage struct { + fn func(context.Context, PrivateEndpointConnectionsList) (PrivateEndpointConnectionsList, error) + pecl PrivateEndpointConnectionsList +} + +// 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 *PrivateEndpointConnectionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsListPage.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.pecl) + if err != nil { + return err + } + page.pecl = 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 *PrivateEndpointConnectionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointConnectionsListPage) NotDone() bool { + return !page.pecl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointConnectionsListPage) Response() PrivateEndpointConnectionsList { + return page.pecl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointConnectionsListPage) Values() []PrivateEndpointConnection { + if page.pecl.IsEmpty() { + return nil + } + return *page.pecl.Value +} + +// Creates a new instance of the PrivateEndpointConnectionsListPage type. +func NewPrivateEndpointConnectionsListPage(cur PrivateEndpointConnectionsList, getNextPage func(context.Context, PrivateEndpointConnectionsList) (PrivateEndpointConnectionsList, error)) PrivateEndpointConnectionsListPage { + return PrivateEndpointConnectionsListPage{ + fn: getNextPage, + pecl: cur, + } +} + +// PrivateLinkResourcesList the available private link resources for a workspace +type PrivateLinkResourcesList struct { + autorest.Response `json:"-"` + // Value - The list of available private link resources for a workspace + Value *[]GroupIDInformation `json:"value,omitempty"` + // NextLink - The URL to get the next set of private link resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// PrivateLinkResourcesListIterator provides access to a complete listing of GroupIDInformation values. +type PrivateLinkResourcesListIterator struct { + i int + page PrivateLinkResourcesListPage +} + +// 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 *PrivateLinkResourcesListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesListIterator.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 *PrivateLinkResourcesListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateLinkResourcesListIterator) 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 PrivateLinkResourcesListIterator) Response() PrivateLinkResourcesList { + 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 PrivateLinkResourcesListIterator) Value() GroupIDInformation { + if !iter.page.NotDone() { + return GroupIDInformation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateLinkResourcesListIterator type. +func NewPrivateLinkResourcesListIterator(page PrivateLinkResourcesListPage) PrivateLinkResourcesListIterator { + return PrivateLinkResourcesListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plrl PrivateLinkResourcesList) IsEmpty() bool { + return plrl.Value == nil || len(*plrl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plrl PrivateLinkResourcesList) hasNextLink() bool { + return plrl.NextLink != nil && len(*plrl.NextLink) != 0 +} + +// privateLinkResourcesListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plrl PrivateLinkResourcesList) privateLinkResourcesListPreparer(ctx context.Context) (*http.Request, error) { + if !plrl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plrl.NextLink))) +} + +// PrivateLinkResourcesListPage contains a page of GroupIDInformation values. +type PrivateLinkResourcesListPage struct { + fn func(context.Context, PrivateLinkResourcesList) (PrivateLinkResourcesList, error) + plrl PrivateLinkResourcesList +} + +// 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 *PrivateLinkResourcesListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesListPage.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.plrl) + if err != nil { + return err + } + page.plrl = 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 *PrivateLinkResourcesListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateLinkResourcesListPage) NotDone() bool { + return !page.plrl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateLinkResourcesListPage) Response() PrivateLinkResourcesList { + return page.plrl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateLinkResourcesListPage) Values() []GroupIDInformation { + if page.plrl.IsEmpty() { + return nil + } + return *page.plrl.Value +} + +// Creates a new instance of the PrivateLinkResourcesListPage type. +func NewPrivateLinkResourcesListPage(cur PrivateLinkResourcesList, getNextPage func(context.Context, PrivateLinkResourcesList) (PrivateLinkResourcesList, error)) PrivateLinkResourcesListPage { + return PrivateLinkResourcesListPage{ + fn: getNextPage, + plrl: cur, + } +} + +// PrivateLinkServiceConnectionState the current state of a private endpoint connection +type PrivateLinkServiceConnectionState struct { + // Status - The status of a private endpoint connection. Possible values include: 'PrivateLinkServiceConnectionStatusPending', 'PrivateLinkServiceConnectionStatusApproved', 'PrivateLinkServiceConnectionStatusRejected', 'PrivateLinkServiceConnectionStatusDisconnected' + Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` + // Description - The description for the current state of a private endpoint connection + Description *string `json:"description,omitempty"` + // ActionRequired - Actions required for a private endpoint connection + ActionRequired *string `json:"actionRequired,omitempty"` +} + +// Resource the core properties of ARM resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. 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) +} + +// Sku SKU for the resource. +type Sku struct { + // Name - The SKU name. + Name *string `json:"name,omitempty"` + // Tier - The SKU tier. + Tier *string `json:"tier,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"` +} + +// 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) +} + +// VirtualNetworkPeering peerings in a VirtualNetwork resource +type VirtualNetworkPeering struct { + autorest.Response `json:"-"` + // VirtualNetworkPeeringPropertiesFormat - List of properties for vNet Peering + *VirtualNetworkPeeringPropertiesFormat `json:"properties,omitempty"` + // Name - READ-ONLY; Name of the virtual network peering resource + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; type of the virtual network peering resource + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkPeering. +func (vnp VirtualNetworkPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnp.VirtualNetworkPeeringPropertiesFormat != nil { + objectMap["properties"] = vnp.VirtualNetworkPeeringPropertiesFormat + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkPeering struct. +func (vnp *VirtualNetworkPeering) 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 virtualNetworkPeeringPropertiesFormat VirtualNetworkPeeringPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkPeeringPropertiesFormat) + if err != nil { + return err + } + vnp.VirtualNetworkPeeringPropertiesFormat = &virtualNetworkPeeringPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vnp.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vnp.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vnp.Type = &typeVar + } + } + } + + return nil +} + +// VirtualNetworkPeeringList gets all virtual network peerings under a workspace. +type VirtualNetworkPeeringList struct { + autorest.Response `json:"-"` + // Value - List of virtual network peerings on workspace. + Value *[]VirtualNetworkPeering `json:"value,omitempty"` + // NextLink - URL to get the next set of virtual network peering list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkPeeringListIterator provides access to a complete listing of VirtualNetworkPeering values. +type VirtualNetworkPeeringListIterator struct { + i int + page VirtualNetworkPeeringListPage +} + +// 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 *VirtualNetworkPeeringListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringListIterator.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 *VirtualNetworkPeeringListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkPeeringListIterator) 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 VirtualNetworkPeeringListIterator) Response() VirtualNetworkPeeringList { + 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 VirtualNetworkPeeringListIterator) Value() VirtualNetworkPeering { + if !iter.page.NotDone() { + return VirtualNetworkPeering{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkPeeringListIterator type. +func NewVirtualNetworkPeeringListIterator(page VirtualNetworkPeeringListPage) VirtualNetworkPeeringListIterator { + return VirtualNetworkPeeringListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnpl VirtualNetworkPeeringList) IsEmpty() bool { + return vnpl.Value == nil || len(*vnpl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vnpl VirtualNetworkPeeringList) hasNextLink() bool { + return vnpl.NextLink != nil && len(*vnpl.NextLink) != 0 +} + +// virtualNetworkPeeringListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnpl VirtualNetworkPeeringList) virtualNetworkPeeringListPreparer(ctx context.Context) (*http.Request, error) { + if !vnpl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnpl.NextLink))) +} + +// VirtualNetworkPeeringListPage contains a page of VirtualNetworkPeering values. +type VirtualNetworkPeeringListPage struct { + fn func(context.Context, VirtualNetworkPeeringList) (VirtualNetworkPeeringList, error) + vnpl VirtualNetworkPeeringList +} + +// 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 *VirtualNetworkPeeringListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringListPage.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.vnpl) + if err != nil { + return err + } + page.vnpl = 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 *VirtualNetworkPeeringListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkPeeringListPage) NotDone() bool { + return !page.vnpl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkPeeringListPage) Response() VirtualNetworkPeeringList { + return page.vnpl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkPeeringListPage) Values() []VirtualNetworkPeering { + if page.vnpl.IsEmpty() { + return nil + } + return *page.vnpl.Value +} + +// Creates a new instance of the VirtualNetworkPeeringListPage type. +func NewVirtualNetworkPeeringListPage(cur VirtualNetworkPeeringList, getNextPage func(context.Context, VirtualNetworkPeeringList) (VirtualNetworkPeeringList, error)) VirtualNetworkPeeringListPage { + return VirtualNetworkPeeringListPage{ + fn: getNextPage, + vnpl: cur, + } +} + +// VirtualNetworkPeeringPropertiesFormat properties of the virtual network peering. +type VirtualNetworkPeeringPropertiesFormat struct { + // AllowVirtualNetworkAccess - Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space. + AllowVirtualNetworkAccess *bool `json:"allowVirtualNetworkAccess,omitempty"` + // AllowForwardedTraffic - Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network. + AllowForwardedTraffic *bool `json:"allowForwardedTraffic,omitempty"` + // AllowGatewayTransit - If gateway links can be used in remote virtual networking to link to this virtual network. + AllowGatewayTransit *bool `json:"allowGatewayTransit,omitempty"` + // UseRemoteGateways - If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. + UseRemoteGateways *bool `json:"useRemoteGateways,omitempty"` + // DatabricksVirtualNetwork - The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). + DatabricksVirtualNetwork *VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork `json:"databricksVirtualNetwork,omitempty"` + // DatabricksAddressSpace - The reference to the databricks virtual network address space. + DatabricksAddressSpace *AddressSpace `json:"databricksAddressSpace,omitempty"` + // RemoteVirtualNetwork - The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). + RemoteVirtualNetwork *VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork `json:"remoteVirtualNetwork,omitempty"` + // RemoteAddressSpace - The reference to the remote virtual network address space. + RemoteAddressSpace *AddressSpace `json:"remoteAddressSpace,omitempty"` + // PeeringState - READ-ONLY; The status of the virtual network peering. Possible values include: 'PeeringStateInitiated', 'PeeringStateConnected', 'PeeringStateDisconnected' + PeeringState PeeringState `json:"peeringState,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network peering resource. Possible values include: 'PeeringProvisioningStateSucceeded', 'PeeringProvisioningStateUpdating', 'PeeringProvisioningStateDeleting', 'PeeringProvisioningStateFailed' + ProvisioningState PeeringProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkPeeringPropertiesFormat. +func (vnppf VirtualNetworkPeeringPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnppf.AllowVirtualNetworkAccess != nil { + objectMap["allowVirtualNetworkAccess"] = vnppf.AllowVirtualNetworkAccess + } + if vnppf.AllowForwardedTraffic != nil { + objectMap["allowForwardedTraffic"] = vnppf.AllowForwardedTraffic + } + if vnppf.AllowGatewayTransit != nil { + objectMap["allowGatewayTransit"] = vnppf.AllowGatewayTransit + } + if vnppf.UseRemoteGateways != nil { + objectMap["useRemoteGateways"] = vnppf.UseRemoteGateways + } + if vnppf.DatabricksVirtualNetwork != nil { + objectMap["databricksVirtualNetwork"] = vnppf.DatabricksVirtualNetwork + } + if vnppf.DatabricksAddressSpace != nil { + objectMap["databricksAddressSpace"] = vnppf.DatabricksAddressSpace + } + if vnppf.RemoteVirtualNetwork != nil { + objectMap["remoteVirtualNetwork"] = vnppf.RemoteVirtualNetwork + } + if vnppf.RemoteAddressSpace != nil { + objectMap["remoteAddressSpace"] = vnppf.RemoteAddressSpace + } + return json.Marshal(objectMap) +} + +// VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork the remote virtual network should be in +// the same region. See here to learn more +// (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). +type VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork struct { + // ID - The Id of the databricks virtual network. + ID *string `json:"id,omitempty"` +} + +// VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork the remote virtual network should be in the +// same region. See here to learn more +// (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). +type VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork struct { + // ID - The Id of the remote virtual network. + ID *string `json:"id,omitempty"` +} + +// VNetPeeringCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VNetPeeringCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VNetPeeringClient) (VirtualNetworkPeering, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VNetPeeringCreateOrUpdateFuture) 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 VNetPeeringCreateOrUpdateFuture.Result. +func (future *VNetPeeringCreateOrUpdateFuture) result(client VNetPeeringClient) (vnp VirtualNetworkPeering, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vnp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.VNetPeeringCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vnp.Response.Response, err = future.GetResult(sender); err == nil && vnp.Response.Response.StatusCode != http.StatusNoContent { + vnp, err = client.CreateOrUpdateResponder(vnp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringCreateOrUpdateFuture", "Result", vnp.Response.Response, "Failure responding to request") + } + } + return +} + +// VNetPeeringDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VNetPeeringDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VNetPeeringClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VNetPeeringDeleteFuture) 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 VNetPeeringDeleteFuture.Result. +func (future *VNetPeeringDeleteFuture) result(client VNetPeeringClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.VNetPeeringDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// Workspace information about workspace. +type Workspace struct { + autorest.Response `json:"-"` + // WorkspaceProperties - The workspace properties. + *WorkspaceProperties `json:"properties,omitempty"` + // Sku - The SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to this resource + SystemData *SystemData `json:"systemData,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 Workspace. +func (w Workspace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if w.WorkspaceProperties != nil { + objectMap["properties"] = w.WorkspaceProperties + } + if w.Sku != nil { + objectMap["sku"] = w.Sku + } + if w.Tags != nil { + objectMap["tags"] = w.Tags + } + if w.Location != nil { + objectMap["location"] = w.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Workspace struct. +func (w *Workspace) 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 workspaceProperties WorkspaceProperties + err = json.Unmarshal(*v, &workspaceProperties) + if err != nil { + return err + } + w.WorkspaceProperties = &workspaceProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + w.Sku = &sku + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + w.SystemData = &systemData + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + w.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + w.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + w.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + w.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + w.Type = &typeVar + } + } + } + + return nil +} + +// WorkspaceCustomBooleanParameter the value which should be used for this field. +type WorkspaceCustomBooleanParameter struct { + // Type - The type of variable that this is. Possible values include: 'CustomParameterTypeBool', 'CustomParameterTypeObject', 'CustomParameterTypeString' + Type CustomParameterType `json:"type,omitempty"` + // Value - The value which should be used for this field. + Value *bool `json:"value,omitempty"` +} + +// WorkspaceCustomObjectParameter the value which should be used for this field. +type WorkspaceCustomObjectParameter struct { + // Type - The type of variable that this is. Possible values include: 'CustomParameterTypeBool', 'CustomParameterTypeObject', 'CustomParameterTypeString' + Type CustomParameterType `json:"type,omitempty"` + // Value - The value which should be used for this field. + Value interface{} `json:"value,omitempty"` +} + +// WorkspaceCustomParameters custom Parameters used for Cluster Creation. +type WorkspaceCustomParameters struct { + // AmlWorkspaceID - The ID of a Azure Machine Learning workspace to link with Databricks workspace + AmlWorkspaceID *WorkspaceCustomStringParameter `json:"amlWorkspaceId,omitempty"` + // CustomVirtualNetworkID - The ID of a Virtual Network where this Databricks Cluster should be created + CustomVirtualNetworkID *WorkspaceCustomStringParameter `json:"customVirtualNetworkId,omitempty"` + // CustomPublicSubnetName - The name of a Public Subnet within the Virtual Network + CustomPublicSubnetName *WorkspaceCustomStringParameter `json:"customPublicSubnetName,omitempty"` + // CustomPrivateSubnetName - The name of the Private Subnet within the Virtual Network + CustomPrivateSubnetName *WorkspaceCustomStringParameter `json:"customPrivateSubnetName,omitempty"` + // EnableNoPublicIP - Should the Public IP be Disabled? + EnableNoPublicIP *WorkspaceCustomBooleanParameter `json:"enableNoPublicIp,omitempty"` + // LoadBalancerBackendPoolName - Name of the outbound Load Balancer Backend Pool for Secure Cluster Connectivity (No Public IP). + LoadBalancerBackendPoolName *WorkspaceCustomStringParameter `json:"loadBalancerBackendPoolName,omitempty"` + // LoadBalancerID - Resource URI of Outbound Load balancer for Secure Cluster Connectivity (No Public IP) workspace. + LoadBalancerID *WorkspaceCustomStringParameter `json:"loadBalancerId,omitempty"` + // NatGatewayName - Name of the NAT gateway for Secure Cluster Connectivity (No Public IP) workspace subnets. + NatGatewayName *WorkspaceCustomStringParameter `json:"natGatewayName,omitempty"` + // PublicIPName - Name of the Public IP for No Public IP workspace with managed vNet. + PublicIPName *WorkspaceCustomStringParameter `json:"publicIpName,omitempty"` + // PrepareEncryption - Prepare the workspace for encryption. Enables the Managed Identity for managed storage account. + PrepareEncryption *WorkspaceCustomBooleanParameter `json:"prepareEncryption,omitempty"` + // Encryption - Contains the encryption details for Customer-Managed Key (CMK) enabled workspace. + Encryption *WorkspaceEncryptionParameter `json:"encryption,omitempty"` + // RequireInfrastructureEncryption - A boolean indicating whether or not the DBFS root file system will be enabled with secondary layer of encryption with platform managed keys for data at rest. + RequireInfrastructureEncryption *WorkspaceCustomBooleanParameter `json:"requireInfrastructureEncryption,omitempty"` + // StorageAccountName - Default DBFS storage account name. + StorageAccountName *WorkspaceCustomStringParameter `json:"storageAccountName,omitempty"` + // StorageAccountSkuName - Storage account SKU name, ex: Standard_GRS, Standard_LRS. Refer https://aka.ms/storageskus for valid inputs. + StorageAccountSkuName *WorkspaceCustomStringParameter `json:"storageAccountSkuName,omitempty"` + // VnetAddressPrefix - Address prefix for Managed virtual network. Default value for this input is 10.139. + VnetAddressPrefix *WorkspaceCustomStringParameter `json:"vnetAddressPrefix,omitempty"` + // ResourceTags - READ-ONLY; Tags applied to resources under Managed resource group. These can be updated by updating tags at workspace level. + ResourceTags *WorkspaceCustomObjectParameter `json:"resourceTags,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkspaceCustomParameters. +func (wcp WorkspaceCustomParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wcp.AmlWorkspaceID != nil { + objectMap["amlWorkspaceId"] = wcp.AmlWorkspaceID + } + if wcp.CustomVirtualNetworkID != nil { + objectMap["customVirtualNetworkId"] = wcp.CustomVirtualNetworkID + } + if wcp.CustomPublicSubnetName != nil { + objectMap["customPublicSubnetName"] = wcp.CustomPublicSubnetName + } + if wcp.CustomPrivateSubnetName != nil { + objectMap["customPrivateSubnetName"] = wcp.CustomPrivateSubnetName + } + if wcp.EnableNoPublicIP != nil { + objectMap["enableNoPublicIp"] = wcp.EnableNoPublicIP + } + if wcp.LoadBalancerBackendPoolName != nil { + objectMap["loadBalancerBackendPoolName"] = wcp.LoadBalancerBackendPoolName + } + if wcp.LoadBalancerID != nil { + objectMap["loadBalancerId"] = wcp.LoadBalancerID + } + if wcp.NatGatewayName != nil { + objectMap["natGatewayName"] = wcp.NatGatewayName + } + if wcp.PublicIPName != nil { + objectMap["publicIpName"] = wcp.PublicIPName + } + if wcp.PrepareEncryption != nil { + objectMap["prepareEncryption"] = wcp.PrepareEncryption + } + if wcp.Encryption != nil { + objectMap["encryption"] = wcp.Encryption + } + if wcp.RequireInfrastructureEncryption != nil { + objectMap["requireInfrastructureEncryption"] = wcp.RequireInfrastructureEncryption + } + if wcp.StorageAccountName != nil { + objectMap["storageAccountName"] = wcp.StorageAccountName + } + if wcp.StorageAccountSkuName != nil { + objectMap["storageAccountSkuName"] = wcp.StorageAccountSkuName + } + if wcp.VnetAddressPrefix != nil { + objectMap["vnetAddressPrefix"] = wcp.VnetAddressPrefix + } + return json.Marshal(objectMap) +} + +// WorkspaceCustomStringParameter the Value. +type WorkspaceCustomStringParameter struct { + // Type - The type of variable that this is. Possible values include: 'CustomParameterTypeBool', 'CustomParameterTypeObject', 'CustomParameterTypeString' + Type CustomParameterType `json:"type,omitempty"` + // Value - The value which should be used for this field. + Value *string `json:"value,omitempty"` +} + +// WorkspaceEncryptionParameter the object that contains details of encryption used on the workspace. +type WorkspaceEncryptionParameter struct { + // Type - The type of variable that this is. Possible values include: 'CustomParameterTypeBool', 'CustomParameterTypeObject', 'CustomParameterTypeString' + Type CustomParameterType `json:"type,omitempty"` + // Value - The value which should be used for this field. + Value *Encryption `json:"value,omitempty"` +} + +// WorkspaceListResult list of workspaces. +type WorkspaceListResult struct { + autorest.Response `json:"-"` + // Value - The array of workspaces. + Value *[]Workspace `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// WorkspaceListResultIterator provides access to a complete listing of Workspace values. +type WorkspaceListResultIterator struct { + i int + page WorkspaceListResultPage +} + +// 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 *WorkspaceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultIterator.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 *WorkspaceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WorkspaceListResultIterator) 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 WorkspaceListResultIterator) Response() WorkspaceListResult { + 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 WorkspaceListResultIterator) Value() Workspace { + if !iter.page.NotDone() { + return Workspace{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WorkspaceListResultIterator type. +func NewWorkspaceListResultIterator(page WorkspaceListResultPage) WorkspaceListResultIterator { + return WorkspaceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wlr WorkspaceListResult) IsEmpty() bool { + return wlr.Value == nil || len(*wlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wlr WorkspaceListResult) hasNextLink() bool { + return wlr.NextLink != nil && len(*wlr.NextLink) != 0 +} + +// workspaceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wlr WorkspaceListResult) workspaceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !wlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wlr.NextLink))) +} + +// WorkspaceListResultPage contains a page of Workspace values. +type WorkspaceListResultPage struct { + fn func(context.Context, WorkspaceListResult) (WorkspaceListResult, error) + wlr WorkspaceListResult +} + +// 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 *WorkspaceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultPage.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.wlr) + if err != nil { + return err + } + page.wlr = 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 *WorkspaceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WorkspaceListResultPage) NotDone() bool { + return !page.wlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WorkspaceListResultPage) Response() WorkspaceListResult { + return page.wlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WorkspaceListResultPage) Values() []Workspace { + if page.wlr.IsEmpty() { + return nil + } + return *page.wlr.Value +} + +// Creates a new instance of the WorkspaceListResultPage type. +func NewWorkspaceListResultPage(cur WorkspaceListResult, getNextPage func(context.Context, WorkspaceListResult) (WorkspaceListResult, error)) WorkspaceListResultPage { + return WorkspaceListResultPage{ + fn: getNextPage, + wlr: cur, + } +} + +// WorkspaceProperties the workspace properties. +type WorkspaceProperties struct { + // ManagedResourceGroupID - The managed resource group Id. + ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"` + // Parameters - The workspace's custom parameters. + Parameters *WorkspaceCustomParameters `json:"parameters,omitempty"` + // ProvisioningState - READ-ONLY; The workspace provisioning state. Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // UIDefinitionURI - The blob URI where the UI definition file is located. + UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"` + // Authorizations - The workspace provider authorizations. + Authorizations *[]WorkspaceProviderAuthorization `json:"authorizations,omitempty"` + // CreatedBy - Indicates the Object ID, PUID and Application ID of entity that created the workspace. + CreatedBy *CreatedBy `json:"createdBy,omitempty"` + // UpdatedBy - Indicates the Object ID, PUID and Application ID of entity that last updated the workspace. + UpdatedBy *CreatedBy `json:"updatedBy,omitempty"` + // CreatedDateTime - Specifies the date and time when the workspace is created. + CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` + // WorkspaceID - READ-ONLY; The unique identifier of the databricks workspace in databricks control plane. + WorkspaceID *string `json:"workspaceId,omitempty"` + // WorkspaceURL - READ-ONLY; The workspace URL which is of the format 'adb-{workspaceId}.{random}.azuredatabricks.net' + WorkspaceURL *string `json:"workspaceUrl,omitempty"` + // StorageAccountIdentity - The details of Managed Identity of Storage Account + StorageAccountIdentity *ManagedIdentityConfiguration `json:"storageAccountIdentity,omitempty"` + // Encryption - Encryption properties for databricks workspace + Encryption *WorkspacePropertiesEncryption `json:"encryption,omitempty"` + // PrivateEndpointConnections - READ-ONLY; Private endpoint connections created on the workspace + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // PublicNetworkAccess - The network access type for accessing workspace. Set value to disabled to access workspace only via private link. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // RequiredNsgRules - Gets or sets a value indicating whether data plane (clusters) to control plane communication happen over private endpoint. Supported values are 'AllRules' and 'NoAzureDatabricksRules'. 'NoAzureServiceRules' value is for internal use only. Possible values include: 'RequiredNsgRulesAllRules', 'RequiredNsgRulesNoAzureDatabricksRules', 'RequiredNsgRulesNoAzureServiceRules' + RequiredNsgRules RequiredNsgRules `json:"requiredNsgRules,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkspaceProperties. +func (wp WorkspaceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wp.ManagedResourceGroupID != nil { + objectMap["managedResourceGroupId"] = wp.ManagedResourceGroupID + } + if wp.Parameters != nil { + objectMap["parameters"] = wp.Parameters + } + if wp.UIDefinitionURI != nil { + objectMap["uiDefinitionUri"] = wp.UIDefinitionURI + } + if wp.Authorizations != nil { + objectMap["authorizations"] = wp.Authorizations + } + if wp.CreatedBy != nil { + objectMap["createdBy"] = wp.CreatedBy + } + if wp.UpdatedBy != nil { + objectMap["updatedBy"] = wp.UpdatedBy + } + if wp.CreatedDateTime != nil { + objectMap["createdDateTime"] = wp.CreatedDateTime + } + if wp.StorageAccountIdentity != nil { + objectMap["storageAccountIdentity"] = wp.StorageAccountIdentity + } + if wp.Encryption != nil { + objectMap["encryption"] = wp.Encryption + } + if wp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = wp.PublicNetworkAccess + } + if wp.RequiredNsgRules != "" { + objectMap["requiredNsgRules"] = wp.RequiredNsgRules + } + return json.Marshal(objectMap) +} + +// WorkspacePropertiesEncryption encryption properties for databricks workspace +type WorkspacePropertiesEncryption struct { + // Entities - Encryption entities definition for the workspace. + Entities *EncryptionEntitiesDefinition `json:"entities,omitempty"` +} + +// WorkspaceProviderAuthorization the workspace provider authorization. +type WorkspaceProviderAuthorization struct { + // PrincipalID - The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the workspace resources. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // RoleDefinitionID - The provider's role definition identifier. This role will define all the permissions that the provider must have on the workspace's container resource group. This role definition cannot have permission to delete the resource group. + RoleDefinitionID *uuid.UUID `json:"roleDefinitionId,omitempty"` +} + +// WorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WorkspacesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WorkspacesClient) (Workspace, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesCreateOrUpdateFuture) 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 WorkspacesCreateOrUpdateFuture.Result. +func (future *WorkspacesCreateOrUpdateFuture) result(client WorkspacesClient) (w Workspace, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + w.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.WorkspacesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { + w, err = client.CreateOrUpdateResponder(w.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesCreateOrUpdateFuture", "Result", w.Response.Response, "Failure responding to request") + } + } + return +} + +// WorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WorkspacesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WorkspacesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesDeleteFuture) 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 WorkspacesDeleteFuture.Result. +func (future *WorkspacesDeleteFuture) result(client WorkspacesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.WorkspacesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// WorkspacesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WorkspacesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WorkspacesClient) (Workspace, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesUpdateFuture) 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 WorkspacesUpdateFuture.Result. +func (future *WorkspacesUpdateFuture) result(client WorkspacesClient) (w Workspace, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + w.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.WorkspacesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { + w, err = client.UpdateResponder(w.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesUpdateFuture", "Result", w.Response.Response, "Failure responding to request") + } + } + return +} + +// WorkspaceUpdate an update to a workspace. +type WorkspaceUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for WorkspaceUpdate. +func (wu WorkspaceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wu.Tags != nil { + objectMap["tags"] = wu.Tags + } + return json.Marshal(objectMap) +} diff --git a/services/preview/databricks/mgmt/2021-04-01-preview/databricks/operations.go b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/operations.go new file mode 100644 index 000000000000..d0c19472acf7 --- /dev/null +++ b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/operations.go @@ -0,0 +1,141 @@ +package databricks + +// 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 the Microsoft Azure management APIs allow end users to operate on Azure Databricks Workspace +// resources. +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 RP 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, "databricks.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, "databricks.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Databricks/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, "databricks.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, "databricks.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/databricks/mgmt/2021-04-01-preview/databricks/privateendpointconnections.go b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/privateendpointconnections.go new file mode 100644 index 000000000000..3efa62d9f0fc --- /dev/null +++ b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/privateendpointconnections.go @@ -0,0 +1,442 @@ +package databricks + +// 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 the Microsoft Azure management APIs allow end users to operate on Azure +// Databricks Workspace resources. +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)} +} + +// Create update the status of a private endpoint connection with the specified name +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// privateEndpointConnectionName - the name of the private endpoint connection +// privateEndpointConnection - the private endpoint connection with updated properties +func (client PrivateEndpointConnectionsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: 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}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: privateEndpointConnection, + Constraints: []validation.Constraint{{Target: "privateEndpointConnection.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "privateEndpointConnection.Properties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("databricks.PrivateEndpointConnectionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName, privateEndpointConnection) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "Create", nil, "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client PrivateEndpointConnectionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + privateEndpointConnection.ID = nil + privateEndpointConnection.Name = nil + privateEndpointConnection.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(privateEndpointConnection), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) CreateSender(req *http.Request) (future PrivateEndpointConnectionsCreateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) CreateResponder(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 remove private endpoint connection with the specified name +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// privateEndpointConnectionName - the name of the private endpoint connection +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName 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: 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}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/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 + 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 get a private endpoint connection properties for a workspace +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// privateEndpointConnectionName - the name of the private endpoint connection +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName 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: 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}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.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, "databricks.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/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 +} + +// List list private endpoint connections of the workspace +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.pecl.Response.Response != nil { + sc = result.pecl.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pecl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.pecl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.pecl.hasNextLink() && result.pecl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections", 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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionsList, 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 PrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionsList) (result PrivateEndpointConnectionsList, err error) { + req, err := lastResults.privateEndpointConnectionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "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, "databricks.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} diff --git a/services/preview/databricks/mgmt/2021-04-01-preview/databricks/privatelinkresources.go b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/privatelinkresources.go new file mode 100644 index 000000000000..9296d50ea8e9 --- /dev/null +++ b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/privatelinkresources.go @@ -0,0 +1,252 @@ +package databricks + +// 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 the Microsoft Azure management APIs allow end users to operate on Azure Databricks +// Workspace resources. +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 get the specified private link resource for the given group id (sub-resource) +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// groupID - the name of the private link resource +func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, groupID string) (result GroupIDInformation, 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: 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}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.PrivateLinkResourcesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, groupID) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.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, "databricks.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, groupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateLinkResources/{groupId}", 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 GroupIDInformation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list private link resources for a given workspace +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourcesListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.plrl.Response.Response != nil { + sc = result.plrl.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.PrivateLinkResourcesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.plrl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result.plrl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + if result.plrl.hasNextLink() && result.plrl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateLinkResources", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourcesList, 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 PrivateLinkResourcesClient) listNextResults(ctx context.Context, lastResults PrivateLinkResourcesList) (result PrivateLinkResourcesList, err error) { + req, err := lastResults.privateLinkResourcesListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "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, "databricks.PrivateLinkResourcesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourcesListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} diff --git a/services/preview/databricks/mgmt/2021-04-01-preview/databricks/version.go b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/version.go new file mode 100644 index 000000000000..db235e40ea70 --- /dev/null +++ b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/version.go @@ -0,0 +1,19 @@ +package databricks + +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() + " databricks/2021-04-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/databricks/mgmt/2021-04-01-preview/databricks/vnetpeering.go b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/vnetpeering.go new file mode 100644 index 000000000000..c44a70ccfc69 --- /dev/null +++ b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/vnetpeering.go @@ -0,0 +1,441 @@ +package databricks + +// 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" +) + +// VNetPeeringClient is the the Microsoft Azure management APIs allow end users to operate on Azure Databricks +// Workspace resources. +type VNetPeeringClient struct { + BaseClient +} + +// NewVNetPeeringClient creates an instance of the VNetPeeringClient client. +func NewVNetPeeringClient(subscriptionID string) VNetPeeringClient { + return NewVNetPeeringClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVNetPeeringClientWithBaseURI creates an instance of the VNetPeeringClient 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 NewVNetPeeringClientWithBaseURI(baseURI string, subscriptionID string) VNetPeeringClient { + return VNetPeeringClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates vNet Peering for workspace. +// Parameters: +// virtualNetworkPeeringParameters - parameters supplied to the create workspace vNet Peering. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// peeringName - the name of the workspace vNet peering. +func (client VNetPeeringClient) CreateOrUpdate(ctx context.Context, virtualNetworkPeeringParameters VirtualNetworkPeering, resourceGroupName string, workspaceName string, peeringName string) (result VNetPeeringCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VNetPeeringClient.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: virtualNetworkPeeringParameters, + Constraints: []validation.Constraint{{Target: "virtualNetworkPeeringParameters.VirtualNetworkPeeringPropertiesFormat", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "virtualNetworkPeeringParameters.VirtualNetworkPeeringPropertiesFormat.RemoteVirtualNetwork", Name: validation.Null, Rule: true, 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}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.VNetPeeringClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, virtualNetworkPeeringParameters, resourceGroupName, workspaceName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VNetPeeringClient) CreateOrUpdatePreparer(ctx context.Context, virtualNetworkPeeringParameters VirtualNetworkPeering, resourceGroupName string, workspaceName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2018-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + virtualNetworkPeeringParameters.Name = nil + virtualNetworkPeeringParameters.ID = nil + virtualNetworkPeeringParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}", pathParameters), + autorest.WithJSON(virtualNetworkPeeringParameters), + 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 VNetPeeringClient) CreateOrUpdateSender(req *http.Request) (future VNetPeeringCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VNetPeeringClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkPeering, 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 workspace vNetPeering. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// peeringName - the name of the workspace vNet peering. +func (client VNetPeeringClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, peeringName string) (result VNetPeeringDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VNetPeeringClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.VNetPeeringClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VNetPeeringClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2018-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.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}", 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 VNetPeeringClient) DeleteSender(req *http.Request) (future VNetPeeringDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VNetPeeringClient) 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 the workspace vNet Peering. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// peeringName - the name of the workspace vNet peering. +func (client VNetPeeringClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, peeringName string) (result VirtualNetworkPeering, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VNetPeeringClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.VNetPeeringClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VNetPeeringClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2018-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.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}", 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 VNetPeeringClient) 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 VNetPeeringClient) GetResponder(resp *http.Response) (result VirtualNetworkPeering, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByWorkspace lists the workspace vNet Peerings. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client VNetPeeringClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result VirtualNetworkPeeringListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VNetPeeringClient.ListByWorkspace") + defer func() { + sc := -1 + if result.vnpl.Response.Response != nil { + sc = result.vnpl.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.VNetPeeringClient", "ListByWorkspace", err.Error()) + } + + result.fn = client.listByWorkspaceNextResults + req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "ListByWorkspace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.vnpl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "ListByWorkspace", resp, "Failure sending request") + return + } + + result.vnpl, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "ListByWorkspace", resp, "Failure responding to request") + return + } + if result.vnpl.hasNextLink() && result.vnpl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByWorkspacePreparer prepares the ListByWorkspace request. +func (client VNetPeeringClient) ListByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2018-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.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the +// http.Response Body if it receives an error. +func (client VNetPeeringClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always +// closes the http.Response Body. +func (client VNetPeeringClient) ListByWorkspaceResponder(resp *http.Response) (result VirtualNetworkPeeringList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByWorkspaceNextResults retrieves the next set of results, if any. +func (client VNetPeeringClient) listByWorkspaceNextResults(ctx context.Context, lastResults VirtualNetworkPeeringList) (result VirtualNetworkPeeringList, err error) { + req, err := lastResults.virtualNetworkPeeringListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. +func (client VNetPeeringClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result VirtualNetworkPeeringListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VNetPeeringClient.ListByWorkspace") + 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.ListByWorkspace(ctx, resourceGroupName, workspaceName) + return +} diff --git a/services/preview/databricks/mgmt/2021-04-01-preview/databricks/workspaces.go b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/workspaces.go new file mode 100644 index 000000000000..24dd8ed422d3 --- /dev/null +++ b/services/preview/databricks/mgmt/2021-04-01-preview/databricks/workspaces.go @@ -0,0 +1,680 @@ +package databricks + +// 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" +) + +// WorkspacesClient is the the Microsoft Azure management APIs allow end users to operate on Azure Databricks Workspace +// resources. +type WorkspacesClient struct { + BaseClient +} + +// NewWorkspacesClient creates an instance of the WorkspacesClient client. +func NewWorkspacesClient(subscriptionID string) WorkspacesClient { + return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient 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 NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { + return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new workspace. +// Parameters: +// parameters - parameters supplied to the create or update a workspace. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client WorkspacesClient) CreateOrUpdate(ctx context.Context, parameters Workspace, resourceGroupName string, workspaceName string) (result WorkspacesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.WorkspaceProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.ManagedResourceGroupID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.WorkspaceProperties.Parameters", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.AmlWorkspaceID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.AmlWorkspaceID.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.CustomVirtualNetworkID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.CustomVirtualNetworkID.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.CustomPublicSubnetName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.CustomPublicSubnetName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.CustomPrivateSubnetName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.CustomPrivateSubnetName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.EnableNoPublicIP", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.EnableNoPublicIP.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.LoadBalancerBackendPoolName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.LoadBalancerBackendPoolName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.LoadBalancerID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.LoadBalancerID.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.NatGatewayName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.NatGatewayName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.PublicIPName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.PublicIPName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.PrepareEncryption", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.PrepareEncryption.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.RequireInfrastructureEncryption", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.RequireInfrastructureEncryption.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.StorageAccountName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.StorageAccountName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.StorageAccountSkuName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.StorageAccountSkuName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.VnetAddressPrefix", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.VnetAddressPrefix.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.ResourceTags", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.ResourceTags.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "parameters.WorkspaceProperties.Encryption", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Encryption.Entities", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Encryption.Entities.ManagedServices", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Encryption.Entities.ManagedServices.KeySource", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.WorkspaceProperties.Encryption.Entities.ManagedServices.KeyVaultProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Encryption.Entities.ManagedServices.KeyVaultProperties.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.WorkspaceProperties.Encryption.Entities.ManagedServices.KeyVaultProperties.KeyName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.WorkspaceProperties.Encryption.Entities.ManagedServices.KeyVaultProperties.KeyVersion", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + }}, + }}, + {Target: "parameters.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, 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}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.WorkspacesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, parameters, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, parameters Workspace, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.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.Databricks/workspaces/{workspaceName}", 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 WorkspacesClient) CreateOrUpdateSender(req *http.Request) (future WorkspacesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result Workspace, 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 workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client WorkspacesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspacesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.WorkspacesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}", 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 WorkspacesClient) DeleteSender(req *http.Request) (future WorkspacesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) 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 the workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client WorkspacesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result Workspace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.WorkspacesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}", 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 WorkspacesClient) 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 WorkspacesClient) GetResponder(resp *http.Response) (result Workspace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets all the workspaces within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client WorkspacesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result WorkspaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.wlr.Response.Response != nil { + sc = result.wlr.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}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.WorkspacesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.wlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.wlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.wlr.hasNextLink() && result.wlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WorkspacesClient) 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-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.Databricks/workspaces", 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 WorkspacesClient) 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 WorkspacesClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceListResult, 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 WorkspacesClient) listByResourceGroupNextResults(ctx context.Context, lastResults WorkspaceListResult) (result WorkspaceListResult, err error) { + req, err := lastResults.workspaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "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, "databricks.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkspacesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result WorkspaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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 gets all the workspaces within a subscription. +func (client WorkspacesClient) ListBySubscription(ctx context.Context) (result WorkspaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListBySubscription") + defer func() { + sc := -1 + if result.wlr.Response.Response != nil { + sc = result.wlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.wlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.wlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.wlr.hasNextLink() && result.wlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client WorkspacesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Databricks/workspaces", 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 WorkspacesClient) 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 WorkspacesClient) ListBySubscriptionResponder(resp *http.Response) (result WorkspaceListResult, 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 WorkspacesClient) listBySubscriptionNextResults(ctx context.Context, lastResults WorkspaceListResult) (result WorkspaceListResult, err error) { + req, err := lastResults.workspaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "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, "databricks.WorkspacesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkspacesClient) ListBySubscriptionComplete(ctx context.Context) (result WorkspaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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 a workspace. +// Parameters: +// parameters - the update to the workspace. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client WorkspacesClient) Update(ctx context.Context, parameters WorkspaceUpdate, resourceGroupName string, workspaceName string) (result WorkspacesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.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: 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}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.WorkspacesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, parameters, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WorkspacesClient) UpdatePreparer(ctx context.Context, parameters WorkspaceUpdate, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}", 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 WorkspacesClient) UpdateSender(req *http.Request) (future WorkspacesUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) UpdateResponder(resp *http.Response) (result Workspace, 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/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/CHANGELOG.md b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/_meta.json b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/_meta.json new file mode 100644 index 000000000000..2c5a1240d136 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "2b0b50e3e5bd467aa039a51cafa2a071593eca28", + "readme": "/_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", + "tag": "package-2021-06-preview", + "use": "@microsoft.azure/autorest.go@2.1.183", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2021-06-preview --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/eventgrid/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/eventgrid/mgmt/2021-06-01-preview/eventgrid/client.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/client.go new file mode 100644 index 000000000000..edf8dd066c38 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/client.go @@ -0,0 +1,41 @@ +// Package eventgrid implements the Azure ARM Eventgrid service API version 2021-06-01-preview. +// +// Azure EventGrid Management Client +package eventgrid + +// 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 Eventgrid + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Eventgrid. +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/eventgrid/mgmt/2021-06-01-preview/eventgrid/domains.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/domains.go new file mode 100644 index 000000000000..cc2de2160eae --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/domains.go @@ -0,0 +1,767 @@ +package eventgrid + +// 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" +) + +// DomainsClient is the azure EventGrid Management Client +type DomainsClient struct { + BaseClient +} + +// NewDomainsClient creates an instance of the DomainsClient client. +func NewDomainsClient(subscriptionID string) DomainsClient { + return NewDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDomainsClientWithBaseURI creates an instance of the DomainsClient 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 NewDomainsClientWithBaseURI(baseURI string, subscriptionID string) DomainsClient { + return DomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate asynchronously creates or updates a new domain with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain. +// domainInfo - domain information. +func (client DomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (result DomainsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domainInfo) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainInfo Domain) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + domainInfo.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.EventGrid/domains/{domainName}", pathParameters), + autorest.WithJSON(domainInfo), + 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 DomainsClient) CreateOrUpdateSender(req *http.Request) (future DomainsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DomainsClient) CreateOrUpdateResponder(resp *http.Response) (result Domain, 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 existing domain. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain. +func (client DomainsClient) Delete(ctx context.Context, resourceGroupName string, domainName string) (result DomainsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}", 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 DomainsClient) DeleteSender(req *http.Request) (future DomainsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DomainsClient) 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 get properties of a domain. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain. +func (client DomainsClient) Get(ctx context.Context, resourceGroupName string, domainName string) (result Domain, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}", 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 DomainsClient) 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 DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list all the domains under a resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client DomainsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DomainsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DomainsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains", 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 DomainsClient) 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 DomainsClient) ListByResourceGroupResponder(resp *http.Response) (result DomainsListResult, 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 DomainsClient) listByResourceGroupNextResults(ctx context.Context, lastResults DomainsListResult) (result DomainsListResult, err error) { + req, err := lastResults.domainsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "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, "eventgrid.DomainsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DomainsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result DomainsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, filter, top) + return +} + +// ListBySubscription list all the domains under an Azure subscription. +// Parameters: +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client DomainsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result DomainsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListBySubscription") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client DomainsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/domains", 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 DomainsClient) 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 DomainsClient) ListBySubscriptionResponder(resp *http.Response) (result DomainsListResult, 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 DomainsClient) listBySubscriptionNextResults(ctx context.Context, lastResults DomainsListResult) (result DomainsListResult, err error) { + req, err := lastResults.domainsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "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, "eventgrid.DomainsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client DomainsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result DomainsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.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, filter, top) + return +} + +// ListSharedAccessKeys list the two keys used to publish to a domain. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain. +func (client DomainsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result DomainSharedAccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.ListSharedAccessKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListSharedAccessKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure sending request") + return + } + + result, err = client.ListSharedAccessKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "ListSharedAccessKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. +func (client DomainsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always +// closes the http.Response Body. +func (client DomainsClient) ListSharedAccessKeysResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerate a shared access key for a domain. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain. +// regenerateKeyRequest - request body to regenerate key. +func (client DomainsClient) RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (result DomainSharedAccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.RegenerateKey") + 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: regenerateKeyRequest, + Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("eventgrid.DomainsClient", "RegenerateKey", err.Error()) + } + + req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, domainName, regenerateKeyRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "RegenerateKey", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client DomainsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest DomainRegenerateKeyRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/regenerateKey", pathParameters), + autorest.WithJSON(regenerateKeyRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client DomainsClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client DomainsClient) RegenerateKeyResponder(resp *http.Response) (result DomainSharedAccessKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update asynchronously updates a domain with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain. +// domainUpdateParameters - domain update information. +func (client DomainsClient) Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (result DomainsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, domainName, domainUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DomainsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters DomainUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}", pathParameters), + autorest.WithJSON(domainUpdateParameters), + 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 DomainsClient) UpdateSender(req *http.Request) (future DomainsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DomainsClient) UpdateResponder(resp *http.Response) (result Domain, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/domaintopics.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/domaintopics.go new file mode 100644 index 000000000000..1961c1f56ce8 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/domaintopics.go @@ -0,0 +1,400 @@ +package eventgrid + +// 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" +) + +// DomainTopicsClient is the azure EventGrid Management Client +type DomainTopicsClient struct { + BaseClient +} + +// NewDomainTopicsClient creates an instance of the DomainTopicsClient client. +func NewDomainTopicsClient(subscriptionID string) DomainTopicsClient { + return NewDomainTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDomainTopicsClientWithBaseURI creates an instance of the DomainTopicsClient 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 NewDomainTopicsClientWithBaseURI(baseURI string, subscriptionID string) DomainTopicsClient { + return DomainTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate asynchronously creates or updates a new domain topic with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain. +// domainTopicName - name of the domain topic. +func (client DomainTopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopicsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainName, domainTopicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DomainTopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "domainTopicName": autorest.Encode("path", domainTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}", pathParameters), + 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 DomainTopicsClient) CreateOrUpdateSender(req *http.Request) (future DomainTopicsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DomainTopicsClient) CreateOrUpdateResponder(resp *http.Response) (result DomainTopic, 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 existing domain topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain. +// domainTopicName - name of the domain topic. +func (client DomainTopicsClient) Delete(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopicsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, domainName, domainTopicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DomainTopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "domainTopicName": autorest.Encode("path", domainTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}", 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 DomainTopicsClient) DeleteSender(req *http.Request) (future DomainTopicsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DomainTopicsClient) 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 get properties of a domain topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the domain. +// domainTopicName - name of the topic. +func (client DomainTopicsClient) Get(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result DomainTopic, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, domainName, domainTopicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DomainTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "domainTopicName": autorest.Encode("path", domainTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{domainTopicName}", 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 DomainTopicsClient) 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 DomainTopicsClient) GetResponder(resp *http.Response) (result DomainTopic, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDomain list all the topics in a domain. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - domain name. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client DomainTopicsClient) ListByDomain(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result DomainTopicsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.ListByDomain") + defer func() { + sc := -1 + if result.dtlr.Response.Response != nil { + sc = result.dtlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDomainNextResults + req, err := client.ListByDomainPreparer(ctx, resourceGroupName, domainName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDomainSender(req) + if err != nil { + result.dtlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure sending request") + return + } + + result.dtlr, err = client.ListByDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "ListByDomain", resp, "Failure responding to request") + return + } + if result.dtlr.hasNextLink() && result.dtlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDomainPreparer prepares the ListByDomain request. +func (client DomainTopicsClient) ListByDomainPreparer(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDomainSender sends the ListByDomain request. The method will close the +// http.Response Body if it receives an error. +func (client DomainTopicsClient) ListByDomainSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDomainResponder handles the response to the ListByDomain request. The method always +// closes the http.Response Body. +func (client DomainTopicsClient) ListByDomainResponder(resp *http.Response) (result DomainTopicsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDomainNextResults retrieves the next set of results, if any. +func (client DomainTopicsClient) listByDomainNextResults(ctx context.Context, lastResults DomainTopicsListResult) (result DomainTopicsListResult, err error) { + req, err := lastResults.domainTopicsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsClient", "listByDomainNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDomainComplete enumerates all values, automatically crossing page boundaries as required. +func (client DomainTopicsClient) ListByDomainComplete(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result DomainTopicsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsClient.ListByDomain") + 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.ListByDomain(ctx, resourceGroupName, domainName, filter, top) + return +} diff --git a/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/enums.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/enums.go new file mode 100644 index 000000000000..1b6488e95938 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/enums.go @@ -0,0 +1,597 @@ +package eventgrid + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // 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} +} + +// DomainProvisioningState enumerates the values for domain provisioning state. +type DomainProvisioningState string + +const ( + // DomainProvisioningStateCanceled ... + DomainProvisioningStateCanceled DomainProvisioningState = "Canceled" + // DomainProvisioningStateCreating ... + DomainProvisioningStateCreating DomainProvisioningState = "Creating" + // DomainProvisioningStateDeleting ... + DomainProvisioningStateDeleting DomainProvisioningState = "Deleting" + // DomainProvisioningStateFailed ... + DomainProvisioningStateFailed DomainProvisioningState = "Failed" + // DomainProvisioningStateSucceeded ... + DomainProvisioningStateSucceeded DomainProvisioningState = "Succeeded" + // DomainProvisioningStateUpdating ... + DomainProvisioningStateUpdating DomainProvisioningState = "Updating" +) + +// PossibleDomainProvisioningStateValues returns an array of possible values for the DomainProvisioningState const type. +func PossibleDomainProvisioningStateValues() []DomainProvisioningState { + return []DomainProvisioningState{DomainProvisioningStateCanceled, DomainProvisioningStateCreating, DomainProvisioningStateDeleting, DomainProvisioningStateFailed, DomainProvisioningStateSucceeded, DomainProvisioningStateUpdating} +} + +// DomainTopicProvisioningState enumerates the values for domain topic provisioning state. +type DomainTopicProvisioningState string + +const ( + // DomainTopicProvisioningStateCanceled ... + DomainTopicProvisioningStateCanceled DomainTopicProvisioningState = "Canceled" + // DomainTopicProvisioningStateCreating ... + DomainTopicProvisioningStateCreating DomainTopicProvisioningState = "Creating" + // DomainTopicProvisioningStateDeleting ... + DomainTopicProvisioningStateDeleting DomainTopicProvisioningState = "Deleting" + // DomainTopicProvisioningStateFailed ... + DomainTopicProvisioningStateFailed DomainTopicProvisioningState = "Failed" + // DomainTopicProvisioningStateSucceeded ... + DomainTopicProvisioningStateSucceeded DomainTopicProvisioningState = "Succeeded" + // DomainTopicProvisioningStateUpdating ... + DomainTopicProvisioningStateUpdating DomainTopicProvisioningState = "Updating" +) + +// PossibleDomainTopicProvisioningStateValues returns an array of possible values for the DomainTopicProvisioningState const type. +func PossibleDomainTopicProvisioningStateValues() []DomainTopicProvisioningState { + return []DomainTopicProvisioningState{DomainTopicProvisioningStateCanceled, DomainTopicProvisioningStateCreating, DomainTopicProvisioningStateDeleting, DomainTopicProvisioningStateFailed, DomainTopicProvisioningStateSucceeded, DomainTopicProvisioningStateUpdating} +} + +// EndpointType enumerates the values for endpoint type. +type EndpointType string + +const ( + // EndpointTypeAzureFunction ... + EndpointTypeAzureFunction EndpointType = "AzureFunction" + // EndpointTypeEventHub ... + EndpointTypeEventHub EndpointType = "EventHub" + // EndpointTypeEventSubscriptionDestination ... + EndpointTypeEventSubscriptionDestination EndpointType = "EventSubscriptionDestination" + // EndpointTypeHybridConnection ... + EndpointTypeHybridConnection EndpointType = "HybridConnection" + // EndpointTypeServiceBusQueue ... + EndpointTypeServiceBusQueue EndpointType = "ServiceBusQueue" + // EndpointTypeServiceBusTopic ... + EndpointTypeServiceBusTopic EndpointType = "ServiceBusTopic" + // EndpointTypeStorageQueue ... + EndpointTypeStorageQueue EndpointType = "StorageQueue" + // EndpointTypeWebHook ... + EndpointTypeWebHook EndpointType = "WebHook" +) + +// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. +func PossibleEndpointTypeValues() []EndpointType { + return []EndpointType{EndpointTypeAzureFunction, EndpointTypeEventHub, EndpointTypeEventSubscriptionDestination, EndpointTypeHybridConnection, EndpointTypeServiceBusQueue, EndpointTypeServiceBusTopic, EndpointTypeStorageQueue, EndpointTypeWebHook} +} + +// EndpointTypeBasicDeadLetterDestination enumerates the values for endpoint type basic dead letter +// destination. +type EndpointTypeBasicDeadLetterDestination string + +const ( + // EndpointTypeBasicDeadLetterDestinationEndpointTypeDeadLetterDestination ... + EndpointTypeBasicDeadLetterDestinationEndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = "DeadLetterDestination" + // EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob ... + EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = "StorageBlob" +) + +// PossibleEndpointTypeBasicDeadLetterDestinationValues returns an array of possible values for the EndpointTypeBasicDeadLetterDestination const type. +func PossibleEndpointTypeBasicDeadLetterDestinationValues() []EndpointTypeBasicDeadLetterDestination { + return []EndpointTypeBasicDeadLetterDestination{EndpointTypeBasicDeadLetterDestinationEndpointTypeDeadLetterDestination, EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob} +} + +// EventChannelProvisioningState enumerates the values for event channel provisioning state. +type EventChannelProvisioningState string + +const ( + // EventChannelProvisioningStateCanceled ... + EventChannelProvisioningStateCanceled EventChannelProvisioningState = "Canceled" + // EventChannelProvisioningStateCreating ... + EventChannelProvisioningStateCreating EventChannelProvisioningState = "Creating" + // EventChannelProvisioningStateDeleting ... + EventChannelProvisioningStateDeleting EventChannelProvisioningState = "Deleting" + // EventChannelProvisioningStateFailed ... + EventChannelProvisioningStateFailed EventChannelProvisioningState = "Failed" + // EventChannelProvisioningStateSucceeded ... + EventChannelProvisioningStateSucceeded EventChannelProvisioningState = "Succeeded" + // EventChannelProvisioningStateUpdating ... + EventChannelProvisioningStateUpdating EventChannelProvisioningState = "Updating" +) + +// PossibleEventChannelProvisioningStateValues returns an array of possible values for the EventChannelProvisioningState const type. +func PossibleEventChannelProvisioningStateValues() []EventChannelProvisioningState { + return []EventChannelProvisioningState{EventChannelProvisioningStateCanceled, EventChannelProvisioningStateCreating, EventChannelProvisioningStateDeleting, EventChannelProvisioningStateFailed, EventChannelProvisioningStateSucceeded, EventChannelProvisioningStateUpdating} +} + +// EventDeliverySchema enumerates the values for event delivery schema. +type EventDeliverySchema string + +const ( + // EventDeliverySchemaCloudEventSchemaV10 ... + EventDeliverySchemaCloudEventSchemaV10 EventDeliverySchema = "CloudEventSchemaV1_0" + // EventDeliverySchemaCustomInputSchema ... + EventDeliverySchemaCustomInputSchema EventDeliverySchema = "CustomInputSchema" + // EventDeliverySchemaEventGridSchema ... + EventDeliverySchemaEventGridSchema EventDeliverySchema = "EventGridSchema" +) + +// PossibleEventDeliverySchemaValues returns an array of possible values for the EventDeliverySchema const type. +func PossibleEventDeliverySchemaValues() []EventDeliverySchema { + return []EventDeliverySchema{EventDeliverySchemaCloudEventSchemaV10, EventDeliverySchemaCustomInputSchema, EventDeliverySchemaEventGridSchema} +} + +// EventSubscriptionIdentityType enumerates the values for event subscription identity type. +type EventSubscriptionIdentityType string + +const ( + // EventSubscriptionIdentityTypeSystemAssigned ... + EventSubscriptionIdentityTypeSystemAssigned EventSubscriptionIdentityType = "SystemAssigned" + // EventSubscriptionIdentityTypeUserAssigned ... + EventSubscriptionIdentityTypeUserAssigned EventSubscriptionIdentityType = "UserAssigned" +) + +// PossibleEventSubscriptionIdentityTypeValues returns an array of possible values for the EventSubscriptionIdentityType const type. +func PossibleEventSubscriptionIdentityTypeValues() []EventSubscriptionIdentityType { + return []EventSubscriptionIdentityType{EventSubscriptionIdentityTypeSystemAssigned, EventSubscriptionIdentityTypeUserAssigned} +} + +// EventSubscriptionProvisioningState enumerates the values for event subscription provisioning state. +type EventSubscriptionProvisioningState string + +const ( + // EventSubscriptionProvisioningStateAwaitingManualAction ... + EventSubscriptionProvisioningStateAwaitingManualAction EventSubscriptionProvisioningState = "AwaitingManualAction" + // EventSubscriptionProvisioningStateCanceled ... + EventSubscriptionProvisioningStateCanceled EventSubscriptionProvisioningState = "Canceled" + // EventSubscriptionProvisioningStateCreating ... + EventSubscriptionProvisioningStateCreating EventSubscriptionProvisioningState = "Creating" + // EventSubscriptionProvisioningStateDeleting ... + EventSubscriptionProvisioningStateDeleting EventSubscriptionProvisioningState = "Deleting" + // EventSubscriptionProvisioningStateFailed ... + EventSubscriptionProvisioningStateFailed EventSubscriptionProvisioningState = "Failed" + // EventSubscriptionProvisioningStateSucceeded ... + EventSubscriptionProvisioningStateSucceeded EventSubscriptionProvisioningState = "Succeeded" + // EventSubscriptionProvisioningStateUpdating ... + EventSubscriptionProvisioningStateUpdating EventSubscriptionProvisioningState = "Updating" +) + +// PossibleEventSubscriptionProvisioningStateValues returns an array of possible values for the EventSubscriptionProvisioningState const type. +func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { + return []EventSubscriptionProvisioningState{EventSubscriptionProvisioningStateAwaitingManualAction, EventSubscriptionProvisioningStateCanceled, EventSubscriptionProvisioningStateCreating, EventSubscriptionProvisioningStateDeleting, EventSubscriptionProvisioningStateFailed, EventSubscriptionProvisioningStateSucceeded, EventSubscriptionProvisioningStateUpdating} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // IdentityTypeNone ... + IdentityTypeNone IdentityType = "None" + // IdentityTypeSystemAssigned ... + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + // IdentityTypeSystemAssignedUserAssigned ... + IdentityTypeSystemAssignedUserAssigned IdentityType = "SystemAssigned, UserAssigned" + // IdentityTypeUserAssigned ... + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{IdentityTypeNone, IdentityTypeSystemAssigned, IdentityTypeSystemAssignedUserAssigned, IdentityTypeUserAssigned} +} + +// InputSchema enumerates the values for input schema. +type InputSchema string + +const ( + // InputSchemaCloudEventSchemaV10 ... + InputSchemaCloudEventSchemaV10 InputSchema = "CloudEventSchemaV1_0" + // InputSchemaCustomEventSchema ... + InputSchemaCustomEventSchema InputSchema = "CustomEventSchema" + // InputSchemaEventGridSchema ... + InputSchemaEventGridSchema InputSchema = "EventGridSchema" +) + +// PossibleInputSchemaValues returns an array of possible values for the InputSchema const type. +func PossibleInputSchemaValues() []InputSchema { + return []InputSchema{InputSchemaCloudEventSchemaV10, InputSchemaCustomEventSchema, InputSchemaEventGridSchema} +} + +// InputSchemaMappingType enumerates the values for input schema mapping type. +type InputSchemaMappingType string + +const ( + // InputSchemaMappingTypeInputSchemaMapping ... + InputSchemaMappingTypeInputSchemaMapping InputSchemaMappingType = "InputSchemaMapping" + // InputSchemaMappingTypeJSON ... + InputSchemaMappingTypeJSON InputSchemaMappingType = "Json" +) + +// PossibleInputSchemaMappingTypeValues returns an array of possible values for the InputSchemaMappingType const type. +func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { + return []InputSchemaMappingType{InputSchemaMappingTypeInputSchemaMapping, InputSchemaMappingTypeJSON} +} + +// IPActionType enumerates the values for ip action type. +type IPActionType string + +const ( + // IPActionTypeAllow ... + IPActionTypeAllow IPActionType = "Allow" +) + +// PossibleIPActionTypeValues returns an array of possible values for the IPActionType const type. +func PossibleIPActionTypeValues() []IPActionType { + return []IPActionType{IPActionTypeAllow} +} + +// OperatorType enumerates the values for operator type. +type OperatorType string + +const ( + // OperatorTypeAdvancedFilter ... + OperatorTypeAdvancedFilter OperatorType = "AdvancedFilter" + // OperatorTypeBoolEquals ... + OperatorTypeBoolEquals OperatorType = "BoolEquals" + // OperatorTypeIsNotNull ... + OperatorTypeIsNotNull OperatorType = "IsNotNull" + // OperatorTypeIsNullOrUndefined ... + OperatorTypeIsNullOrUndefined OperatorType = "IsNullOrUndefined" + // OperatorTypeNumberGreaterThan ... + OperatorTypeNumberGreaterThan OperatorType = "NumberGreaterThan" + // OperatorTypeNumberGreaterThanOrEquals ... + OperatorTypeNumberGreaterThanOrEquals OperatorType = "NumberGreaterThanOrEquals" + // OperatorTypeNumberIn ... + OperatorTypeNumberIn OperatorType = "NumberIn" + // OperatorTypeNumberInRange ... + OperatorTypeNumberInRange OperatorType = "NumberInRange" + // OperatorTypeNumberLessThan ... + OperatorTypeNumberLessThan OperatorType = "NumberLessThan" + // OperatorTypeNumberLessThanOrEquals ... + OperatorTypeNumberLessThanOrEquals OperatorType = "NumberLessThanOrEquals" + // OperatorTypeNumberNotIn ... + OperatorTypeNumberNotIn OperatorType = "NumberNotIn" + // OperatorTypeNumberNotInRange ... + OperatorTypeNumberNotInRange OperatorType = "NumberNotInRange" + // OperatorTypeStringBeginsWith ... + OperatorTypeStringBeginsWith OperatorType = "StringBeginsWith" + // OperatorTypeStringContains ... + OperatorTypeStringContains OperatorType = "StringContains" + // OperatorTypeStringEndsWith ... + OperatorTypeStringEndsWith OperatorType = "StringEndsWith" + // OperatorTypeStringIn ... + OperatorTypeStringIn OperatorType = "StringIn" + // OperatorTypeStringNotBeginsWith ... + OperatorTypeStringNotBeginsWith OperatorType = "StringNotBeginsWith" + // OperatorTypeStringNotContains ... + OperatorTypeStringNotContains OperatorType = "StringNotContains" + // OperatorTypeStringNotEndsWith ... + OperatorTypeStringNotEndsWith OperatorType = "StringNotEndsWith" + // OperatorTypeStringNotIn ... + OperatorTypeStringNotIn OperatorType = "StringNotIn" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{OperatorTypeAdvancedFilter, OperatorTypeBoolEquals, OperatorTypeIsNotNull, OperatorTypeIsNullOrUndefined, OperatorTypeNumberGreaterThan, OperatorTypeNumberGreaterThanOrEquals, OperatorTypeNumberIn, OperatorTypeNumberInRange, OperatorTypeNumberLessThan, OperatorTypeNumberLessThanOrEquals, OperatorTypeNumberNotIn, OperatorTypeNumberNotInRange, OperatorTypeStringBeginsWith, OperatorTypeStringContains, OperatorTypeStringEndsWith, OperatorTypeStringIn, OperatorTypeStringNotBeginsWith, OperatorTypeStringNotContains, OperatorTypeStringNotEndsWith, OperatorTypeStringNotIn} +} + +// PartnerNamespaceProvisioningState enumerates the values for partner namespace provisioning state. +type PartnerNamespaceProvisioningState string + +const ( + // PartnerNamespaceProvisioningStateCanceled ... + PartnerNamespaceProvisioningStateCanceled PartnerNamespaceProvisioningState = "Canceled" + // PartnerNamespaceProvisioningStateCreating ... + PartnerNamespaceProvisioningStateCreating PartnerNamespaceProvisioningState = "Creating" + // PartnerNamespaceProvisioningStateDeleting ... + PartnerNamespaceProvisioningStateDeleting PartnerNamespaceProvisioningState = "Deleting" + // PartnerNamespaceProvisioningStateFailed ... + PartnerNamespaceProvisioningStateFailed PartnerNamespaceProvisioningState = "Failed" + // PartnerNamespaceProvisioningStateSucceeded ... + PartnerNamespaceProvisioningStateSucceeded PartnerNamespaceProvisioningState = "Succeeded" + // PartnerNamespaceProvisioningStateUpdating ... + PartnerNamespaceProvisioningStateUpdating PartnerNamespaceProvisioningState = "Updating" +) + +// PossiblePartnerNamespaceProvisioningStateValues returns an array of possible values for the PartnerNamespaceProvisioningState const type. +func PossiblePartnerNamespaceProvisioningStateValues() []PartnerNamespaceProvisioningState { + return []PartnerNamespaceProvisioningState{PartnerNamespaceProvisioningStateCanceled, PartnerNamespaceProvisioningStateCreating, PartnerNamespaceProvisioningStateDeleting, PartnerNamespaceProvisioningStateFailed, PartnerNamespaceProvisioningStateSucceeded, PartnerNamespaceProvisioningStateUpdating} +} + +// PartnerRegistrationProvisioningState enumerates the values for partner registration provisioning state. +type PartnerRegistrationProvisioningState string + +const ( + // PartnerRegistrationProvisioningStateCanceled ... + PartnerRegistrationProvisioningStateCanceled PartnerRegistrationProvisioningState = "Canceled" + // PartnerRegistrationProvisioningStateCreating ... + PartnerRegistrationProvisioningStateCreating PartnerRegistrationProvisioningState = "Creating" + // PartnerRegistrationProvisioningStateDeleting ... + PartnerRegistrationProvisioningStateDeleting PartnerRegistrationProvisioningState = "Deleting" + // PartnerRegistrationProvisioningStateFailed ... + PartnerRegistrationProvisioningStateFailed PartnerRegistrationProvisioningState = "Failed" + // PartnerRegistrationProvisioningStateSucceeded ... + PartnerRegistrationProvisioningStateSucceeded PartnerRegistrationProvisioningState = "Succeeded" + // PartnerRegistrationProvisioningStateUpdating ... + PartnerRegistrationProvisioningStateUpdating PartnerRegistrationProvisioningState = "Updating" +) + +// PossiblePartnerRegistrationProvisioningStateValues returns an array of possible values for the PartnerRegistrationProvisioningState const type. +func PossiblePartnerRegistrationProvisioningStateValues() []PartnerRegistrationProvisioningState { + return []PartnerRegistrationProvisioningState{PartnerRegistrationProvisioningStateCanceled, PartnerRegistrationProvisioningStateCreating, PartnerRegistrationProvisioningStateDeleting, PartnerRegistrationProvisioningStateFailed, PartnerRegistrationProvisioningStateSucceeded, PartnerRegistrationProvisioningStateUpdating} +} + +// PartnerRegistrationVisibilityState enumerates the values for partner registration visibility state. +type PartnerRegistrationVisibilityState string + +const ( + // PartnerRegistrationVisibilityStateGenerallyAvailable ... + PartnerRegistrationVisibilityStateGenerallyAvailable PartnerRegistrationVisibilityState = "GenerallyAvailable" + // PartnerRegistrationVisibilityStateHidden ... + PartnerRegistrationVisibilityStateHidden PartnerRegistrationVisibilityState = "Hidden" + // PartnerRegistrationVisibilityStatePublicPreview ... + PartnerRegistrationVisibilityStatePublicPreview PartnerRegistrationVisibilityState = "PublicPreview" +) + +// PossiblePartnerRegistrationVisibilityStateValues returns an array of possible values for the PartnerRegistrationVisibilityState const type. +func PossiblePartnerRegistrationVisibilityStateValues() []PartnerRegistrationVisibilityState { + return []PartnerRegistrationVisibilityState{PartnerRegistrationVisibilityStateGenerallyAvailable, PartnerRegistrationVisibilityStateHidden, PartnerRegistrationVisibilityStatePublicPreview} +} + +// PartnerTopicActivationState enumerates the values for partner topic activation state. +type PartnerTopicActivationState string + +const ( + // PartnerTopicActivationStateActivated ... + PartnerTopicActivationStateActivated PartnerTopicActivationState = "Activated" + // PartnerTopicActivationStateDeactivated ... + PartnerTopicActivationStateDeactivated PartnerTopicActivationState = "Deactivated" + // PartnerTopicActivationStateNeverActivated ... + PartnerTopicActivationStateNeverActivated PartnerTopicActivationState = "NeverActivated" +) + +// PossiblePartnerTopicActivationStateValues returns an array of possible values for the PartnerTopicActivationState const type. +func PossiblePartnerTopicActivationStateValues() []PartnerTopicActivationState { + return []PartnerTopicActivationState{PartnerTopicActivationStateActivated, PartnerTopicActivationStateDeactivated, PartnerTopicActivationStateNeverActivated} +} + +// PartnerTopicProvisioningState enumerates the values for partner topic provisioning state. +type PartnerTopicProvisioningState string + +const ( + // PartnerTopicProvisioningStateCanceled ... + PartnerTopicProvisioningStateCanceled PartnerTopicProvisioningState = "Canceled" + // PartnerTopicProvisioningStateCreating ... + PartnerTopicProvisioningStateCreating PartnerTopicProvisioningState = "Creating" + // PartnerTopicProvisioningStateDeleting ... + PartnerTopicProvisioningStateDeleting PartnerTopicProvisioningState = "Deleting" + // PartnerTopicProvisioningStateFailed ... + PartnerTopicProvisioningStateFailed PartnerTopicProvisioningState = "Failed" + // PartnerTopicProvisioningStateSucceeded ... + PartnerTopicProvisioningStateSucceeded PartnerTopicProvisioningState = "Succeeded" + // PartnerTopicProvisioningStateUpdating ... + PartnerTopicProvisioningStateUpdating PartnerTopicProvisioningState = "Updating" +) + +// PossiblePartnerTopicProvisioningStateValues returns an array of possible values for the PartnerTopicProvisioningState const type. +func PossiblePartnerTopicProvisioningStateValues() []PartnerTopicProvisioningState { + return []PartnerTopicProvisioningState{PartnerTopicProvisioningStateCanceled, PartnerTopicProvisioningStateCreating, PartnerTopicProvisioningStateDeleting, PartnerTopicProvisioningStateFailed, PartnerTopicProvisioningStateSucceeded, PartnerTopicProvisioningStateUpdating} +} + +// PartnerTopicReadinessState enumerates the values for partner topic readiness state. +type PartnerTopicReadinessState string + +const ( + // PartnerTopicReadinessStateActivatedByUser ... + PartnerTopicReadinessStateActivatedByUser PartnerTopicReadinessState = "ActivatedByUser" + // PartnerTopicReadinessStateDeactivatedByUser ... + PartnerTopicReadinessStateDeactivatedByUser PartnerTopicReadinessState = "DeactivatedByUser" + // PartnerTopicReadinessStateDeletedByUser ... + PartnerTopicReadinessStateDeletedByUser PartnerTopicReadinessState = "DeletedByUser" + // PartnerTopicReadinessStateNotActivatedByUserYet ... + PartnerTopicReadinessStateNotActivatedByUserYet PartnerTopicReadinessState = "NotActivatedByUserYet" +) + +// PossiblePartnerTopicReadinessStateValues returns an array of possible values for the PartnerTopicReadinessState const type. +func PossiblePartnerTopicReadinessStateValues() []PartnerTopicReadinessState { + return []PartnerTopicReadinessState{PartnerTopicReadinessStateActivatedByUser, PartnerTopicReadinessStateDeactivatedByUser, PartnerTopicReadinessStateDeletedByUser, PartnerTopicReadinessStateNotActivatedByUserYet} +} + +// PersistedConnectionStatus enumerates the values for persisted connection status. +type PersistedConnectionStatus string + +const ( + // PersistedConnectionStatusApproved ... + PersistedConnectionStatusApproved PersistedConnectionStatus = "Approved" + // PersistedConnectionStatusDisconnected ... + PersistedConnectionStatusDisconnected PersistedConnectionStatus = "Disconnected" + // PersistedConnectionStatusPending ... + PersistedConnectionStatusPending PersistedConnectionStatus = "Pending" + // PersistedConnectionStatusRejected ... + PersistedConnectionStatusRejected PersistedConnectionStatus = "Rejected" +) + +// PossiblePersistedConnectionStatusValues returns an array of possible values for the PersistedConnectionStatus const type. +func PossiblePersistedConnectionStatusValues() []PersistedConnectionStatus { + return []PersistedConnectionStatus{PersistedConnectionStatusApproved, PersistedConnectionStatusDisconnected, PersistedConnectionStatusPending, PersistedConnectionStatusRejected} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// ResourceKind enumerates the values for resource kind. +type ResourceKind string + +const ( + // ResourceKindAzure ... + ResourceKindAzure ResourceKind = "Azure" + // ResourceKindAzureArc ... + ResourceKindAzureArc ResourceKind = "AzureArc" +) + +// PossibleResourceKindValues returns an array of possible values for the ResourceKind const type. +func PossibleResourceKindValues() []ResourceKind { + return []ResourceKind{ResourceKindAzure, ResourceKindAzureArc} +} + +// ResourceProvisioningState enumerates the values for resource provisioning state. +type ResourceProvisioningState string + +const ( + // ResourceProvisioningStateCanceled ... + ResourceProvisioningStateCanceled ResourceProvisioningState = "Canceled" + // ResourceProvisioningStateCreating ... + ResourceProvisioningStateCreating ResourceProvisioningState = "Creating" + // ResourceProvisioningStateDeleting ... + ResourceProvisioningStateDeleting ResourceProvisioningState = "Deleting" + // ResourceProvisioningStateFailed ... + ResourceProvisioningStateFailed ResourceProvisioningState = "Failed" + // ResourceProvisioningStateSucceeded ... + ResourceProvisioningStateSucceeded ResourceProvisioningState = "Succeeded" + // ResourceProvisioningStateUpdating ... + ResourceProvisioningStateUpdating ResourceProvisioningState = "Updating" +) + +// PossibleResourceProvisioningStateValues returns an array of possible values for the ResourceProvisioningState const type. +func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { + return []ResourceProvisioningState{ResourceProvisioningStateCanceled, ResourceProvisioningStateCreating, ResourceProvisioningStateDeleting, ResourceProvisioningStateFailed, ResourceProvisioningStateSucceeded, ResourceProvisioningStateUpdating} +} + +// ResourceRegionType enumerates the values for resource region type. +type ResourceRegionType string + +const ( + // ResourceRegionTypeGlobalResource ... + ResourceRegionTypeGlobalResource ResourceRegionType = "GlobalResource" + // ResourceRegionTypeRegionalResource ... + ResourceRegionTypeRegionalResource ResourceRegionType = "RegionalResource" +) + +// PossibleResourceRegionTypeValues returns an array of possible values for the ResourceRegionType const type. +func PossibleResourceRegionTypeValues() []ResourceRegionType { + return []ResourceRegionType{ResourceRegionTypeGlobalResource, ResourceRegionTypeRegionalResource} +} + +// Sku enumerates the values for sku. +type Sku string + +const ( + // SkuBasic ... + SkuBasic Sku = "Basic" + // SkuPremium ... + SkuPremium Sku = "Premium" +) + +// PossibleSkuValues returns an array of possible values for the Sku const type. +func PossibleSkuValues() []Sku { + return []Sku{SkuBasic, SkuPremium} +} + +// TopicProvisioningState enumerates the values for topic provisioning state. +type TopicProvisioningState string + +const ( + // TopicProvisioningStateCanceled ... + TopicProvisioningStateCanceled TopicProvisioningState = "Canceled" + // TopicProvisioningStateCreating ... + TopicProvisioningStateCreating TopicProvisioningState = "Creating" + // TopicProvisioningStateDeleting ... + TopicProvisioningStateDeleting TopicProvisioningState = "Deleting" + // TopicProvisioningStateFailed ... + TopicProvisioningStateFailed TopicProvisioningState = "Failed" + // TopicProvisioningStateSucceeded ... + TopicProvisioningStateSucceeded TopicProvisioningState = "Succeeded" + // TopicProvisioningStateUpdating ... + TopicProvisioningStateUpdating TopicProvisioningState = "Updating" +) + +// PossibleTopicProvisioningStateValues returns an array of possible values for the TopicProvisioningState const type. +func PossibleTopicProvisioningStateValues() []TopicProvisioningState { + return []TopicProvisioningState{TopicProvisioningStateCanceled, TopicProvisioningStateCreating, TopicProvisioningStateDeleting, TopicProvisioningStateFailed, TopicProvisioningStateSucceeded, TopicProvisioningStateUpdating} +} + +// TopicTypeProvisioningState enumerates the values for topic type provisioning state. +type TopicTypeProvisioningState string + +const ( + // TopicTypeProvisioningStateCanceled ... + TopicTypeProvisioningStateCanceled TopicTypeProvisioningState = "Canceled" + // TopicTypeProvisioningStateCreating ... + TopicTypeProvisioningStateCreating TopicTypeProvisioningState = "Creating" + // TopicTypeProvisioningStateDeleting ... + TopicTypeProvisioningStateDeleting TopicTypeProvisioningState = "Deleting" + // TopicTypeProvisioningStateFailed ... + TopicTypeProvisioningStateFailed TopicTypeProvisioningState = "Failed" + // TopicTypeProvisioningStateSucceeded ... + TopicTypeProvisioningStateSucceeded TopicTypeProvisioningState = "Succeeded" + // TopicTypeProvisioningStateUpdating ... + TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = "Updating" +) + +// PossibleTopicTypeProvisioningStateValues returns an array of possible values for the TopicTypeProvisioningState const type. +func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { + return []TopicTypeProvisioningState{TopicTypeProvisioningStateCanceled, TopicTypeProvisioningStateCreating, TopicTypeProvisioningStateDeleting, TopicTypeProvisioningStateFailed, TopicTypeProvisioningStateSucceeded, TopicTypeProvisioningStateUpdating} +} + +// Type enumerates the values for type. +type Type string + +const ( + // TypeDeliveryAttributeMapping ... + TypeDeliveryAttributeMapping Type = "DeliveryAttributeMapping" + // TypeDynamic ... + TypeDynamic Type = "Dynamic" + // TypeStatic ... + TypeStatic Type = "Static" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{TypeDeliveryAttributeMapping, TypeDynamic, TypeStatic} +} diff --git a/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/eventchannels.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/eventchannels.go new file mode 100644 index 000000000000..06d22dfbf776 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/eventchannels.go @@ -0,0 +1,402 @@ +package eventgrid + +// 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" +) + +// EventChannelsClient is the azure EventGrid Management Client +type EventChannelsClient struct { + BaseClient +} + +// NewEventChannelsClient creates an instance of the EventChannelsClient client. +func NewEventChannelsClient(subscriptionID string) EventChannelsClient { + return NewEventChannelsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEventChannelsClientWithBaseURI creates an instance of the EventChannelsClient 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 NewEventChannelsClientWithBaseURI(baseURI string, subscriptionID string) EventChannelsClient { + return EventChannelsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate asynchronously creates a new event channel with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerNamespaceName - name of the partner namespace. +// eventChannelName - name of the event channel. +// eventChannelInfo - eventChannel information. +func (client EventChannelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, eventChannelInfo EventChannel) (result EventChannel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, partnerNamespaceName, eventChannelName, eventChannelInfo) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EventChannelsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, eventChannelInfo EventChannel) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventChannelName": autorest.Encode("path", eventChannelName), + "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + eventChannelInfo.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.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}", pathParameters), + autorest.WithJSON(eventChannelInfo), + 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 EventChannelsClient) 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 EventChannelsClient) CreateOrUpdateResponder(resp *http.Response) (result EventChannel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete existing event channel. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerNamespaceName - name of the partner namespace. +// eventChannelName - name of the event channel. +func (client EventChannelsClient) Delete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (result EventChannelsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, partnerNamespaceName, eventChannelName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EventChannelsClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventChannelName": autorest.Encode("path", eventChannelName), + "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}", 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 EventChannelsClient) DeleteSender(req *http.Request) (future EventChannelsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EventChannelsClient) 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 get properties of an event channel. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerNamespaceName - name of the partner namespace. +// eventChannelName - name of the event channel. +func (client EventChannelsClient) Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (result EventChannel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, partnerNamespaceName, eventChannelName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EventChannelsClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventChannelName": autorest.Encode("path", eventChannelName), + "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}", 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 EventChannelsClient) 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 EventChannelsClient) GetResponder(resp *http.Response) (result EventChannel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByPartnerNamespace list all the event channels in a partner namespace. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerNamespaceName - name of the partner namespace. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client EventChannelsClient) ListByPartnerNamespace(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (result EventChannelsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.ListByPartnerNamespace") + defer func() { + sc := -1 + if result.eclr.Response.Response != nil { + sc = result.eclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByPartnerNamespaceNextResults + req, err := client.ListByPartnerNamespacePreparer(ctx, resourceGroupName, partnerNamespaceName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "ListByPartnerNamespace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByPartnerNamespaceSender(req) + if err != nil { + result.eclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "ListByPartnerNamespace", resp, "Failure sending request") + return + } + + result.eclr, err = client.ListByPartnerNamespaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "ListByPartnerNamespace", resp, "Failure responding to request") + return + } + if result.eclr.hasNextLink() && result.eclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByPartnerNamespacePreparer prepares the ListByPartnerNamespace request. +func (client EventChannelsClient) ListByPartnerNamespacePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByPartnerNamespaceSender sends the ListByPartnerNamespace request. The method will close the +// http.Response Body if it receives an error. +func (client EventChannelsClient) ListByPartnerNamespaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByPartnerNamespaceResponder handles the response to the ListByPartnerNamespace request. The method always +// closes the http.Response Body. +func (client EventChannelsClient) ListByPartnerNamespaceResponder(resp *http.Response) (result EventChannelsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByPartnerNamespaceNextResults retrieves the next set of results, if any. +func (client EventChannelsClient) listByPartnerNamespaceNextResults(ctx context.Context, lastResults EventChannelsListResult) (result EventChannelsListResult, err error) { + req, err := lastResults.eventChannelsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "listByPartnerNamespaceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByPartnerNamespaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "listByPartnerNamespaceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByPartnerNamespaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsClient", "listByPartnerNamespaceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByPartnerNamespaceComplete enumerates all values, automatically crossing page boundaries as required. +func (client EventChannelsClient) ListByPartnerNamespaceComplete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (result EventChannelsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsClient.ListByPartnerNamespace") + 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.ListByPartnerNamespace(ctx, resourceGroupName, partnerNamespaceName, filter, top) + return +} diff --git a/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/eventgridapi/interfaces.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/eventgridapi/interfaces.go new file mode 100644 index 000000000000..74206b7061b3 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/eventgridapi/interfaces.go @@ -0,0 +1,230 @@ +package eventgridapi + +// 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/eventgrid/mgmt/2021-06-01-preview/eventgrid" + "github.com/Azure/go-autorest/autorest" +) + +// DomainsClientAPI contains the set of methods on the DomainsClient type. +type DomainsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainInfo eventgrid.Domain) (result eventgrid.DomainsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.Domain, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.DomainsListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.DomainsListResultIterator, err error) + ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.DomainsListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.DomainsListResultIterator, err error) + ListSharedAccessKeys(ctx context.Context, resourceGroupName string, domainName string) (result eventgrid.DomainSharedAccessKeys, err error) + RegenerateKey(ctx context.Context, resourceGroupName string, domainName string, regenerateKeyRequest eventgrid.DomainRegenerateKeyRequest) (result eventgrid.DomainSharedAccessKeys, err error) + Update(ctx context.Context, resourceGroupName string, domainName string, domainUpdateParameters eventgrid.DomainUpdateParameters) (result eventgrid.DomainsUpdateFuture, err error) +} + +var _ DomainsClientAPI = (*eventgrid.DomainsClient)(nil) + +// DomainTopicsClientAPI contains the set of methods on the DomainTopicsClient type. +type DomainTopicsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopicsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopicsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, domainName string, domainTopicName string) (result eventgrid.DomainTopic, err error) + ListByDomain(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result eventgrid.DomainTopicsListResultPage, err error) + ListByDomainComplete(ctx context.Context, resourceGroupName string, domainName string, filter string, top *int32) (result eventgrid.DomainTopicsListResultIterator, err error) +} + +var _ DomainTopicsClientAPI = (*eventgrid.DomainTopicsClient)(nil) + +// EventChannelsClientAPI contains the set of methods on the EventChannelsClient type. +type EventChannelsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, eventChannelInfo eventgrid.EventChannel) (result eventgrid.EventChannel, err error) + Delete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (result eventgrid.EventChannelsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string) (result eventgrid.EventChannel, err error) + ListByPartnerNamespace(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (result eventgrid.EventChannelsListResultPage, err error) + ListByPartnerNamespaceComplete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, filter string, top *int32) (result eventgrid.EventChannelsListResultIterator, err error) +} + +var _ EventChannelsClientAPI = (*eventgrid.EventChannelsClient)(nil) + +// EventSubscriptionsClientAPI contains the set of methods on the EventSubscriptionsClient type. +type EventSubscriptionsClientAPI interface { + CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.EventSubscriptionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionsDeleteFuture, err error) + Get(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) + GetDeliveryAttributes(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.DeliveryAttributeListResult, err error) + GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) + ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) + ListByDomainTopicComplete(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) + ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) + ListByResourceComplete(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) + ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) + ListGlobalByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) + ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) + ListGlobalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) + ListGlobalBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) + ListGlobalBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) + ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) + ListGlobalBySubscriptionForTopicTypeComplete(ctx context.Context, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) + ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) + ListRegionalByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) + ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) + ListRegionalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) + ListRegionalBySubscription(ctx context.Context, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) + ListRegionalBySubscriptionComplete(ctx context.Context, location string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) + ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) + ListRegionalBySubscriptionForTopicTypeComplete(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) + Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.EventSubscriptionsUpdateFuture, err error) +} + +var _ EventSubscriptionsClientAPI = (*eventgrid.EventSubscriptionsClient)(nil) + +// SystemTopicEventSubscriptionsClientAPI contains the set of methods on the SystemTopicEventSubscriptionsClient type. +type SystemTopicEventSubscriptionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.SystemTopicEventSubscriptionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result eventgrid.SystemTopicEventSubscriptionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) + GetDeliveryAttributes(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result eventgrid.DeliveryAttributeListResult, err error) + GetFullURL(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) + ListBySystemTopic(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) + ListBySystemTopicComplete(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.SystemTopicEventSubscriptionsUpdateFuture, err error) +} + +var _ SystemTopicEventSubscriptionsClientAPI = (*eventgrid.SystemTopicEventSubscriptionsClient)(nil) + +// PartnerTopicEventSubscriptionsClientAPI contains the set of methods on the PartnerTopicEventSubscriptionsClient type. +type PartnerTopicEventSubscriptionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo eventgrid.EventSubscription) (result eventgrid.PartnerTopicEventSubscriptionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result eventgrid.PartnerTopicEventSubscriptionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result eventgrid.EventSubscription, err error) + GetDeliveryAttributes(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result eventgrid.DeliveryAttributeListResult, err error) + GetFullURL(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result eventgrid.EventSubscriptionFullURL, err error) + ListByPartnerTopic(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultPage, err error) + ListByPartnerTopicComplete(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (result eventgrid.EventSubscriptionsListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters eventgrid.EventSubscriptionUpdateParameters) (result eventgrid.PartnerTopicEventSubscriptionsUpdateFuture, err error) +} + +var _ PartnerTopicEventSubscriptionsClientAPI = (*eventgrid.PartnerTopicEventSubscriptionsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result eventgrid.OperationsListResult, err error) +} + +var _ OperationsClientAPI = (*eventgrid.OperationsClient)(nil) + +// PartnerNamespacesClientAPI contains the set of methods on the PartnerNamespacesClient type. +type PartnerNamespacesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo eventgrid.PartnerNamespace) (result eventgrid.PartnerNamespacesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result eventgrid.PartnerNamespacesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result eventgrid.PartnerNamespace, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerNamespacesListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerNamespacesListResultIterator, err error) + ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerNamespacesListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerNamespacesListResultIterator, err error) + ListSharedAccessKeys(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result eventgrid.PartnerNamespaceSharedAccessKeys, err error) + RegenerateKey(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest eventgrid.PartnerNamespaceRegenerateKeyRequest) (result eventgrid.PartnerNamespaceSharedAccessKeys, err error) + Update(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters eventgrid.PartnerNamespaceUpdateParameters) (result eventgrid.PartnerNamespacesUpdateFuture, err error) +} + +var _ PartnerNamespacesClientAPI = (*eventgrid.PartnerNamespacesClient)(nil) + +// PartnerRegistrationsClientAPI contains the set of methods on the PartnerRegistrationsClient type. +type PartnerRegistrationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo eventgrid.PartnerRegistration) (result eventgrid.PartnerRegistration, err error) + Delete(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (result eventgrid.PartnerRegistration, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerRegistrationsListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerRegistrationsListResultIterator, err error) + ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerRegistrationsListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerRegistrationsListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters eventgrid.PartnerRegistrationUpdateParameters) (result eventgrid.PartnerRegistration, err error) +} + +var _ PartnerRegistrationsClientAPI = (*eventgrid.PartnerRegistrationsClient)(nil) + +// PartnerTopicsClientAPI contains the set of methods on the PartnerTopicsClient type. +type PartnerTopicsClientAPI interface { + Activate(ctx context.Context, resourceGroupName string, partnerTopicName string) (result eventgrid.PartnerTopic, err error) + Deactivate(ctx context.Context, resourceGroupName string, partnerTopicName string) (result eventgrid.PartnerTopic, err error) + Delete(ctx context.Context, resourceGroupName string, partnerTopicName string) (result eventgrid.PartnerTopicsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, partnerTopicName string) (result eventgrid.PartnerTopic, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerTopicsListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.PartnerTopicsListResultIterator, err error) + ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerTopicsListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.PartnerTopicsListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters eventgrid.PartnerTopicUpdateParameters) (result eventgrid.PartnerTopic, err error) +} + +var _ PartnerTopicsClientAPI = (*eventgrid.PartnerTopicsClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (result eventgrid.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (result eventgrid.PrivateEndpointConnection, err error) + ListByResource(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result eventgrid.PrivateEndpointConnectionListResultPage, err error) + ListByResourceComplete(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result eventgrid.PrivateEndpointConnectionListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string, privateEndpointConnection eventgrid.PrivateEndpointConnection) (result eventgrid.PrivateEndpointConnectionsUpdateFuture, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*eventgrid.PrivateEndpointConnectionsClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateLinkResourceName string) (result eventgrid.PrivateLinkResource, err error) + ListByResource(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result eventgrid.PrivateLinkResourcesListResultPage, err error) + ListByResourceComplete(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result eventgrid.PrivateLinkResourcesListResultIterator, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*eventgrid.PrivateLinkResourcesClient)(nil) + +// SystemTopicsClientAPI contains the set of methods on the SystemTopicsClient type. +type SystemTopicsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicInfo eventgrid.SystemTopic) (result eventgrid.SystemTopicsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, systemTopicName string) (result eventgrid.SystemTopicsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, systemTopicName string) (result eventgrid.SystemTopic, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.SystemTopicsListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.SystemTopicsListResultIterator, err error) + ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.SystemTopicsListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.SystemTopicsListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicUpdateParameters eventgrid.SystemTopicUpdateParameters) (result eventgrid.SystemTopicsUpdateFuture, err error) +} + +var _ SystemTopicsClientAPI = (*eventgrid.SystemTopicsClient)(nil) + +// TopicsClientAPI contains the set of methods on the TopicsClient type. +type TopicsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo eventgrid.Topic) (result eventgrid.TopicsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.Topic, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.TopicsListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result eventgrid.TopicsListResultIterator, err error) + ListBySubscription(ctx context.Context, filter string, top *int32) (result eventgrid.TopicsListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result eventgrid.TopicsListResultIterator, err error) + ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result eventgrid.EventTypesListResult, err error) + ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result eventgrid.TopicSharedAccessKeys, err error) + RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest eventgrid.TopicRegenerateKeyRequest) (result eventgrid.TopicsRegenerateKeyFuture, err error) + Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters eventgrid.TopicUpdateParameters) (result eventgrid.TopicsUpdateFuture, err error) +} + +var _ TopicsClientAPI = (*eventgrid.TopicsClient)(nil) + +// ExtensionTopicsClientAPI contains the set of methods on the ExtensionTopicsClient type. +type ExtensionTopicsClientAPI interface { + Get(ctx context.Context, scope string) (result eventgrid.ExtensionTopic, err error) +} + +var _ ExtensionTopicsClientAPI = (*eventgrid.ExtensionTopicsClient)(nil) + +// TopicTypesClientAPI contains the set of methods on the TopicTypesClient type. +type TopicTypesClientAPI interface { + Get(ctx context.Context, topicTypeName string) (result eventgrid.TopicTypeInfo, err error) + List(ctx context.Context) (result eventgrid.TopicTypesListResult, err error) + ListEventTypes(ctx context.Context, topicTypeName string) (result eventgrid.EventTypesListResult, err error) +} + +var _ TopicTypesClientAPI = (*eventgrid.TopicTypesClient)(nil) diff --git a/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/eventsubscriptions.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/eventsubscriptions.go new file mode 100644 index 000000000000..7f8bb3cb9406 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/eventsubscriptions.go @@ -0,0 +1,1862 @@ +package eventgrid + +// 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" +) + +// EventSubscriptionsClient is the azure EventGrid Management Client +type EventSubscriptionsClient struct { + BaseClient +} + +// NewEventSubscriptionsClient creates an instance of the EventSubscriptionsClient client. +func NewEventSubscriptionsClient(subscriptionID string) EventSubscriptionsClient { + return NewEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEventSubscriptionsClientWithBaseURI creates an instance of the EventSubscriptionsClient 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 NewEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) EventSubscriptionsClient { + return EventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate asynchronously creates a new event subscription or updates an existing event subscription based on +// the specified scope. +// Parameters: +// scope - the identifier of the resource to which the event subscription needs to be created or updated. The +// scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider +// namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' +// for a resource, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' +// for an EventGrid topic. +// eventSubscriptionName - name of the event subscription. Event subscription names must be between 3 and 64 +// characters in length and should use alphanumeric letters only. +// eventSubscriptionInfo - event subscription properties containing the destination and filter information. +func (client EventSubscriptionsClient) CreateOrUpdate(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result EventSubscriptionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionInfo) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "scope": scope, + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + eventSubscriptionInfo.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), + autorest.WithJSON(eventSubscriptionInfo), + 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 EventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future EventSubscriptionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + 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 EventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 existing event subscription. +// Parameters: +// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top +// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use +// '/subscriptions/{subscriptionId}/' for a subscription, +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' +// for a resource, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' +// for an EventGrid topic. +// eventSubscriptionName - name of the event subscription. +func (client EventSubscriptionsClient) Delete(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, scope, eventSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EventSubscriptionsClient) DeletePreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "scope": scope, + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) DeleteSender(req *http.Request) (future EventSubscriptionsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + 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 EventSubscriptionsClient) 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 get properties of an event subscription. +// Parameters: +// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top +// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use +// '/subscriptions/{subscriptionId}/' for a subscription, +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' +// for a resource, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' +// for an EventGrid topic. +// eventSubscriptionName - name of the event subscription. +func (client EventSubscriptionsClient) Get(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscription, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, eventSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EventSubscriptionsClient) GetPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "scope": scope, + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", 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 EventSubscriptionsClient) 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 EventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeliveryAttributes get all delivery attributes for an event subscription. +// Parameters: +// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top +// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use +// '/subscriptions/{subscriptionId}/' for a subscription, +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' +// for a resource, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' +// for an EventGrid topic. +// eventSubscriptionName - name of the event subscription. +func (client EventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, scope string, eventSubscriptionName string) (result DeliveryAttributeListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.GetDeliveryAttributes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetDeliveryAttributesPreparer(ctx, scope, eventSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetDeliveryAttributes", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeliveryAttributesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetDeliveryAttributes", resp, "Failure sending request") + return + } + + result, err = client.GetDeliveryAttributesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetDeliveryAttributes", resp, "Failure responding to request") + return + } + + return +} + +// GetDeliveryAttributesPreparer prepares the GetDeliveryAttributes request. +func (client EventSubscriptionsClient) GetDeliveryAttributesPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "scope": scope, + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeliveryAttributesSender sends the GetDeliveryAttributes request. The method will close the +// http.Response Body if it receives an error. +func (client EventSubscriptionsClient) GetDeliveryAttributesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDeliveryAttributesResponder handles the response to the GetDeliveryAttributes request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) GetDeliveryAttributesResponder(resp *http.Response) (result DeliveryAttributeListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFullURL get the full endpoint URL for an event subscription. +// Parameters: +// scope - the scope of the event subscription. The scope can be a subscription, or a resource group, or a top +// level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use +// '/subscriptions/{subscriptionId}/' for a subscription, +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' +// for a resource, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' +// for an EventGrid topic. +// eventSubscriptionName - name of the event subscription. +func (client EventSubscriptionsClient) GetFullURL(ctx context.Context, scope string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.GetFullURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetFullURLPreparer(ctx, scope, eventSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetFullURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") + return + } + + result, err = client.GetFullURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") + return + } + + return +} + +// GetFullURLPreparer prepares the GetFullURL request. +func (client EventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, scope string, eventSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "scope": scope, + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFullURLSender sends the GetFullURL request. The method will close the +// http.Response Body if it receives an error. +func (client EventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetFullURLResponder handles the response to the GetFullURL request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDomainTopic list all event subscriptions that have been created for a specific domain topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// domainName - name of the top level domain. +// topicName - name of the domain topic. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client EventSubscriptionsClient) ListByDomainTopic(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByDomainTopic") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDomainTopicNextResults + req, err := client.ListByDomainTopicPreparer(ctx, resourceGroupName, domainName, topicName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDomainTopicSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListByDomainTopicResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByDomainTopic", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDomainTopicPreparer prepares the ListByDomainTopic request. +func (client EventSubscriptionsClient) ListByDomainTopicPreparer(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/domains/{domainName}/topics/{topicName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDomainTopicSender sends the ListByDomainTopic request. The method will close the +// http.Response Body if it receives an error. +func (client EventSubscriptionsClient) ListByDomainTopicSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDomainTopicResponder handles the response to the ListByDomainTopic request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) ListByDomainTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDomainTopicNextResults retrieves the next set of results, if any. +func (client EventSubscriptionsClient) listByDomainTopicNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { + req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDomainTopicSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDomainTopicResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByDomainTopicNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDomainTopicComplete enumerates all values, automatically crossing page boundaries as required. +func (client EventSubscriptionsClient) ListByDomainTopicComplete(ctx context.Context, resourceGroupName string, domainName string, topicName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByDomainTopic") + 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.ListByDomainTopic(ctx, resourceGroupName, domainName, topicName, filter, top) + return +} + +// ListByResource list all event subscriptions that have been created for a specific topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// providerNamespace - namespace of the provider of the topic. +// resourceTypeName - name of the resource type. +// resourceName - name of the resource. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client EventSubscriptionsClient) ListByResource(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListByResource") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceNextResults + req, err := client.ListByResourcePreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListByResource", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourcePreparer prepares the ListByResource request. +func (client EventSubscriptionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "providerNamespace": autorest.Encode("path", providerNamespace), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceTypeName": autorest.Encode("path", resourceTypeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventSubscriptions", 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 EventSubscriptionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceResponder handles the response to the ListByResource request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) ListByResourceResponder(resp *http.Response) (result EventSubscriptionsListResult, 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 EventSubscriptionsClient) listByResourceNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { + req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "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, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listByResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client EventSubscriptionsClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.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, resourceGroupName, providerNamespace, resourceTypeName, resourceName, filter, top) + return +} + +// ListGlobalByResourceGroup list all global event subscriptions under a specific Azure subscription and resource +// group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client EventSubscriptionsClient) ListGlobalByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listGlobalByResourceGroupNextResults + req, err := client.ListGlobalByResourceGroupPreparer(ctx, resourceGroupName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListGlobalByResourceGroupSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListGlobalByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroup", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListGlobalByResourceGroupPreparer prepares the ListGlobalByResourceGroup request. +func (client EventSubscriptionsClient) ListGlobalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListGlobalByResourceGroupSender sends the ListGlobalByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client EventSubscriptionsClient) ListGlobalByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListGlobalByResourceGroupResponder handles the response to the ListGlobalByResourceGroup request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) ListGlobalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listGlobalByResourceGroupNextResults retrieves the next set of results, if any. +func (client EventSubscriptionsClient) listGlobalByResourceGroupNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { + req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListGlobalByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListGlobalByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListGlobalByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client EventSubscriptionsClient) ListGlobalByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroup") + 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.ListGlobalByResourceGroup(ctx, resourceGroupName, filter, top) + return +} + +// ListGlobalByResourceGroupForTopicType list all global event subscriptions under a resource group for a specific +// topic type. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicTypeName - name of the topic type. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listGlobalByResourceGroupForTopicTypeNextResults + req, err := client.ListGlobalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, topicTypeName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", nil, "Failure preparing request") + return + } + + resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalByResourceGroupForTopicType", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListGlobalByResourceGroupForTopicTypePreparer prepares the ListGlobalByResourceGroupForTopicType request. +func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicTypeName": autorest.Encode("path", topicTypeName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListGlobalByResourceGroupForTopicTypeSender sends the ListGlobalByResourceGroupForTopicType request. The method will close the +// http.Response Body if it receives an error. +func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListGlobalByResourceGroupForTopicTypeResponder handles the response to the ListGlobalByResourceGroupForTopicType request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listGlobalByResourceGroupForTopicTypeNextResults retrieves the next set of results, if any. +func (client EventSubscriptionsClient) listGlobalByResourceGroupForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { + req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListGlobalByResourceGroupForTopicTypeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListGlobalByResourceGroupForTopicTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalByResourceGroupForTopicTypeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListGlobalByResourceGroupForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. +func (client EventSubscriptionsClient) ListGlobalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalByResourceGroupForTopicType") + 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.ListGlobalByResourceGroupForTopicType(ctx, resourceGroupName, topicTypeName, filter, top) + return +} + +// ListGlobalBySubscription list all aggregated global event subscriptions under a specific Azure subscription. +// Parameters: +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client EventSubscriptionsClient) ListGlobalBySubscription(ctx context.Context, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listGlobalBySubscriptionNextResults + req, err := client.ListGlobalBySubscriptionPreparer(ctx, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListGlobalBySubscriptionSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListGlobalBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscription", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListGlobalBySubscriptionPreparer prepares the ListGlobalBySubscription request. +func (client EventSubscriptionsClient) ListGlobalBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/eventSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListGlobalBySubscriptionSender sends the ListGlobalBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client EventSubscriptionsClient) ListGlobalBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListGlobalBySubscriptionResponder handles the response to the ListGlobalBySubscription request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) ListGlobalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listGlobalBySubscriptionNextResults retrieves the next set of results, if any. +func (client EventSubscriptionsClient) listGlobalBySubscriptionNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { + req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListGlobalBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListGlobalBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListGlobalBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client EventSubscriptionsClient) ListGlobalBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscription") + 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.ListGlobalBySubscription(ctx, filter, top) + return +} + +// ListGlobalBySubscriptionForTopicType list all global event subscriptions under an Azure subscription for a topic +// type. +// Parameters: +// topicTypeName - name of the topic type. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicType(ctx context.Context, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listGlobalBySubscriptionForTopicTypeNextResults + req, err := client.ListGlobalBySubscriptionForTopicTypePreparer(ctx, topicTypeName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", nil, "Failure preparing request") + return + } + + resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListGlobalBySubscriptionForTopicType", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListGlobalBySubscriptionForTopicTypePreparer prepares the ListGlobalBySubscriptionForTopicType request. +func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypePreparer(ctx context.Context, topicTypeName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicTypeName": autorest.Encode("path", topicTypeName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListGlobalBySubscriptionForTopicTypeSender sends the ListGlobalBySubscriptionForTopicType request. The method will close the +// http.Response Body if it receives an error. +func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListGlobalBySubscriptionForTopicTypeResponder handles the response to the ListGlobalBySubscriptionForTopicType request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listGlobalBySubscriptionForTopicTypeNextResults retrieves the next set of results, if any. +func (client EventSubscriptionsClient) listGlobalBySubscriptionForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { + req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListGlobalBySubscriptionForTopicTypeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListGlobalBySubscriptionForTopicTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listGlobalBySubscriptionForTopicTypeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListGlobalBySubscriptionForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. +func (client EventSubscriptionsClient) ListGlobalBySubscriptionForTopicTypeComplete(ctx context.Context, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListGlobalBySubscriptionForTopicType") + 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.ListGlobalBySubscriptionForTopicType(ctx, topicTypeName, filter, top) + return +} + +// ListRegionalByResourceGroup list all event subscriptions from the given location under a specific Azure subscription +// and resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// location - name of the location. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client EventSubscriptionsClient) ListRegionalByResourceGroup(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listRegionalByResourceGroupNextResults + req, err := client.ListRegionalByResourceGroupPreparer(ctx, resourceGroupName, location, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListRegionalByResourceGroupSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListRegionalByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroup", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListRegionalByResourceGroupPreparer prepares the ListRegionalByResourceGroup request. +func (client EventSubscriptionsClient) ListRegionalByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRegionalByResourceGroupSender sends the ListRegionalByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client EventSubscriptionsClient) ListRegionalByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRegionalByResourceGroupResponder handles the response to the ListRegionalByResourceGroup request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) ListRegionalByResourceGroupResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listRegionalByResourceGroupNextResults retrieves the next set of results, if any. +func (client EventSubscriptionsClient) listRegionalByResourceGroupNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { + req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListRegionalByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListRegionalByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListRegionalByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client EventSubscriptionsClient) ListRegionalByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroup") + 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.ListRegionalByResourceGroup(ctx, resourceGroupName, location, filter, top) + return +} + +// ListRegionalByResourceGroupForTopicType list all event subscriptions from the given location under a specific Azure +// subscription and resource group and topic type. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// location - name of the location. +// topicTypeName - name of the topic type. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicType(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listRegionalByResourceGroupForTopicTypeNextResults + req, err := client.ListRegionalByResourceGroupForTopicTypePreparer(ctx, resourceGroupName, location, topicTypeName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", nil, "Failure preparing request") + return + } + + resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalByResourceGroupForTopicType", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListRegionalByResourceGroupForTopicTypePreparer prepares the ListRegionalByResourceGroupForTopicType request. +func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypePreparer(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicTypeName": autorest.Encode("path", topicTypeName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRegionalByResourceGroupForTopicTypeSender sends the ListRegionalByResourceGroupForTopicType request. The method will close the +// http.Response Body if it receives an error. +func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRegionalByResourceGroupForTopicTypeResponder handles the response to the ListRegionalByResourceGroupForTopicType request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listRegionalByResourceGroupForTopicTypeNextResults retrieves the next set of results, if any. +func (client EventSubscriptionsClient) listRegionalByResourceGroupForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { + req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListRegionalByResourceGroupForTopicTypeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListRegionalByResourceGroupForTopicTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalByResourceGroupForTopicTypeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListRegionalByResourceGroupForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. +func (client EventSubscriptionsClient) ListRegionalByResourceGroupForTopicTypeComplete(ctx context.Context, resourceGroupName string, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalByResourceGroupForTopicType") + 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.ListRegionalByResourceGroupForTopicType(ctx, resourceGroupName, location, topicTypeName, filter, top) + return +} + +// ListRegionalBySubscription list all event subscriptions from the given location under a specific Azure subscription. +// Parameters: +// location - name of the location. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client EventSubscriptionsClient) ListRegionalBySubscription(ctx context.Context, location string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listRegionalBySubscriptionNextResults + req, err := client.ListRegionalBySubscriptionPreparer(ctx, location, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListRegionalBySubscriptionSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListRegionalBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscription", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListRegionalBySubscriptionPreparer prepares the ListRegionalBySubscription request. +func (client EventSubscriptionsClient) ListRegionalBySubscriptionPreparer(ctx context.Context, location string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/eventSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRegionalBySubscriptionSender sends the ListRegionalBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client EventSubscriptionsClient) ListRegionalBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRegionalBySubscriptionResponder handles the response to the ListRegionalBySubscription request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) ListRegionalBySubscriptionResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listRegionalBySubscriptionNextResults retrieves the next set of results, if any. +func (client EventSubscriptionsClient) listRegionalBySubscriptionNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { + req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListRegionalBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListRegionalBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListRegionalBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client EventSubscriptionsClient) ListRegionalBySubscriptionComplete(ctx context.Context, location string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscription") + 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.ListRegionalBySubscription(ctx, location, filter, top) + return +} + +// ListRegionalBySubscriptionForTopicType list all event subscriptions from the given location under a specific Azure +// subscription and topic type. +// Parameters: +// location - name of the location. +// topicTypeName - name of the topic type. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicType(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listRegionalBySubscriptionForTopicTypeNextResults + req, err := client.ListRegionalBySubscriptionForTopicTypePreparer(ctx, location, topicTypeName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", nil, "Failure preparing request") + return + } + + resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "ListRegionalBySubscriptionForTopicType", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListRegionalBySubscriptionForTopicTypePreparer prepares the ListRegionalBySubscriptionForTopicType request. +func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypePreparer(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicTypeName": autorest.Encode("path", topicTypeName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/locations/{location}/topicTypes/{topicTypeName}/eventSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRegionalBySubscriptionForTopicTypeSender sends the ListRegionalBySubscriptionForTopicType request. The method will close the +// http.Response Body if it receives an error. +func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRegionalBySubscriptionForTopicTypeResponder handles the response to the ListRegionalBySubscriptionForTopicType request. The method always +// closes the http.Response Body. +func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listRegionalBySubscriptionForTopicTypeNextResults retrieves the next set of results, if any. +func (client EventSubscriptionsClient) listRegionalBySubscriptionForTopicTypeNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { + req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListRegionalBySubscriptionForTopicTypeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListRegionalBySubscriptionForTopicTypeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "listRegionalBySubscriptionForTopicTypeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListRegionalBySubscriptionForTopicTypeComplete enumerates all values, automatically crossing page boundaries as required. +func (client EventSubscriptionsClient) ListRegionalBySubscriptionForTopicTypeComplete(ctx context.Context, location string, topicTypeName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.ListRegionalBySubscriptionForTopicType") + 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.ListRegionalBySubscriptionForTopicType(ctx, location, topicTypeName, filter, top) + return +} + +// Update asynchronously updates an existing event subscription. +// Parameters: +// scope - the scope of existing event subscription. The scope can be a subscription, or a resource group, or a +// top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use +// '/subscriptions/{subscriptionId}/' for a subscription, +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' +// for a resource, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' +// for an EventGrid topic. +// eventSubscriptionName - name of the event subscription to be updated. +// eventSubscriptionUpdateParameters - updated event subscription information. +func (client EventSubscriptionsClient) Update(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result EventSubscriptionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, scope, eventSubscriptionName, eventSubscriptionUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client EventSubscriptionsClient) UpdatePreparer(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "scope": scope, + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}", pathParameters), + autorest.WithJSON(eventSubscriptionUpdateParameters), + 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 EventSubscriptionsClient) UpdateSender(req *http.Request) (future EventSubscriptionsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + 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 EventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/extensiontopics.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/extensiontopics.go new file mode 100644 index 000000000000..dc6731e26820 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/extensiontopics.go @@ -0,0 +1,109 @@ +package eventgrid + +// 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" +) + +// ExtensionTopicsClient is the azure EventGrid Management Client +type ExtensionTopicsClient struct { + BaseClient +} + +// NewExtensionTopicsClient creates an instance of the ExtensionTopicsClient client. +func NewExtensionTopicsClient(subscriptionID string) ExtensionTopicsClient { + return NewExtensionTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionTopicsClientWithBaseURI creates an instance of the ExtensionTopicsClient 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 NewExtensionTopicsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTopicsClient { + return ExtensionTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the properties of an extension topic. +// Parameters: +// scope - the identifier of the resource to which extension topic is queried. The scope can be a subscription, +// or a resource group, or a top level resource belonging to a resource provider namespace. For example, use +// '/subscriptions/{subscriptionId}/' for a subscription, +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' +// for Azure resource. +func (client ExtensionTopicsClient) Get(ctx context.Context, scope string) (result ExtensionTopic, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTopicsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.ExtensionTopicsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.ExtensionTopicsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.ExtensionTopicsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionTopicsClient) GetPreparer(ctx context.Context, scope string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": autorest.Encode("path", scope), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.EventGrid/extensionTopics/default", 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 ExtensionTopicsClient) 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 ExtensionTopicsClient) GetResponder(resp *http.Response) (result ExtensionTopic, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/models.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/models.go new file mode 100644 index 000000000000..21636668a025 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/models.go @@ -0,0 +1,10627 @@ +package eventgrid + +// 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/eventgrid/mgmt/2021-06-01-preview/eventgrid" + +// BasicAdvancedFilter this is the base type that represents an advanced filter. To configure an advanced filter, do +// not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as +// BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of the key +// based on which you want to filter. +type BasicAdvancedFilter interface { + AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) + AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) + AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) + AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) + AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) + AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) + AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) + AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) + AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) + AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) + AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) + AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) + AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) + AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) + AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) + AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) + AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) + AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) + AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) + AsAdvancedFilter() (*AdvancedFilter, bool) +} + +// AdvancedFilter this is the base type that represents an advanced filter. To configure an advanced filter, do +// not directly instantiate an object of this class. Instead, instantiate an object of a derived class such as +// BoolEqualsAdvancedFilter, NumberInAdvancedFilter, StringEqualsAdvancedFilter etc. depending on the type of +// the key based on which you want to filter. +type AdvancedFilter struct { + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +func unmarshalBasicAdvancedFilter(body []byte) (BasicAdvancedFilter, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["operatorType"] { + case string(OperatorTypeNumberIn): + var niaf NumberInAdvancedFilter + err := json.Unmarshal(body, &niaf) + return niaf, err + case string(OperatorTypeNumberNotIn): + var nniaf NumberNotInAdvancedFilter + err := json.Unmarshal(body, &nniaf) + return nniaf, err + case string(OperatorTypeNumberLessThan): + var nltaf NumberLessThanAdvancedFilter + err := json.Unmarshal(body, &nltaf) + return nltaf, err + case string(OperatorTypeNumberGreaterThan): + var ngtaf NumberGreaterThanAdvancedFilter + err := json.Unmarshal(body, &ngtaf) + return ngtaf, err + case string(OperatorTypeNumberLessThanOrEquals): + var nltoeaf NumberLessThanOrEqualsAdvancedFilter + err := json.Unmarshal(body, &nltoeaf) + return nltoeaf, err + case string(OperatorTypeNumberGreaterThanOrEquals): + var ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter + err := json.Unmarshal(body, &ngtoeaf) + return ngtoeaf, err + case string(OperatorTypeBoolEquals): + var beaf BoolEqualsAdvancedFilter + err := json.Unmarshal(body, &beaf) + return beaf, err + case string(OperatorTypeStringIn): + var siaf StringInAdvancedFilter + err := json.Unmarshal(body, &siaf) + return siaf, err + case string(OperatorTypeStringNotIn): + var sniaf StringNotInAdvancedFilter + err := json.Unmarshal(body, &sniaf) + return sniaf, err + case string(OperatorTypeStringBeginsWith): + var sbwaf StringBeginsWithAdvancedFilter + err := json.Unmarshal(body, &sbwaf) + return sbwaf, err + case string(OperatorTypeStringEndsWith): + var sewaf StringEndsWithAdvancedFilter + err := json.Unmarshal(body, &sewaf) + return sewaf, err + case string(OperatorTypeStringContains): + var scaf StringContainsAdvancedFilter + err := json.Unmarshal(body, &scaf) + return scaf, err + case string(OperatorTypeNumberInRange): + var niraf NumberInRangeAdvancedFilter + err := json.Unmarshal(body, &niraf) + return niraf, err + case string(OperatorTypeNumberNotInRange): + var nniraf NumberNotInRangeAdvancedFilter + err := json.Unmarshal(body, &nniraf) + return nniraf, err + case string(OperatorTypeStringNotBeginsWith): + var snbwaf StringNotBeginsWithAdvancedFilter + err := json.Unmarshal(body, &snbwaf) + return snbwaf, err + case string(OperatorTypeStringNotEndsWith): + var snewaf StringNotEndsWithAdvancedFilter + err := json.Unmarshal(body, &snewaf) + return snewaf, err + case string(OperatorTypeStringNotContains): + var sncaf StringNotContainsAdvancedFilter + err := json.Unmarshal(body, &sncaf) + return sncaf, err + case string(OperatorTypeIsNullOrUndefined): + var inouaf IsNullOrUndefinedAdvancedFilter + err := json.Unmarshal(body, &inouaf) + return inouaf, err + case string(OperatorTypeIsNotNull): + var innaf IsNotNullAdvancedFilter + err := json.Unmarshal(body, &innaf) + return innaf, err + default: + var af AdvancedFilter + err := json.Unmarshal(body, &af) + return af, err + } +} +func unmarshalBasicAdvancedFilterArray(body []byte) ([]BasicAdvancedFilter, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + afArray := make([]BasicAdvancedFilter, len(rawMessages)) + + for index, rawMessage := range rawMessages { + af, err := unmarshalBasicAdvancedFilter(*rawMessage) + if err != nil { + return nil, err + } + afArray[index] = af + } + return afArray, nil +} + +// MarshalJSON is the custom marshaler for AdvancedFilter. +func (af AdvancedFilter) MarshalJSON() ([]byte, error) { + af.OperatorType = OperatorTypeAdvancedFilter + objectMap := make(map[string]interface{}) + if af.Key != nil { + objectMap["key"] = af.Key + } + if af.OperatorType != "" { + objectMap["operatorType"] = af.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return &af, true +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for AdvancedFilter. +func (af AdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &af, true +} + +// AzureFunctionEventSubscriptionDestination information about the azure function destination for an event +// subscription. +type AzureFunctionEventSubscriptionDestination struct { + // AzureFunctionEventSubscriptionDestinationProperties - Azure Function Properties of the event subscription destination. + *AzureFunctionEventSubscriptionDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFunctionEventSubscriptionDestination. +func (afesd AzureFunctionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + afesd.EndpointType = EndpointTypeAzureFunction + objectMap := make(map[string]interface{}) + if afesd.AzureFunctionEventSubscriptionDestinationProperties != nil { + objectMap["properties"] = afesd.AzureFunctionEventSubscriptionDestinationProperties + } + if afesd.EndpointType != "" { + objectMap["endpointType"] = afesd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. +func (afesd AzureFunctionEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. +func (afesd AzureFunctionEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return nil, false +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. +func (afesd AzureFunctionEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. +func (afesd AzureFunctionEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. +func (afesd AzureFunctionEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. +func (afesd AzureFunctionEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { + return nil, false +} + +// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. +func (afesd AzureFunctionEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { + return &afesd, true +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. +func (afesd AzureFunctionEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return nil, false +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for AzureFunctionEventSubscriptionDestination. +func (afesd AzureFunctionEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &afesd, true +} + +// UnmarshalJSON is the custom unmarshaler for AzureFunctionEventSubscriptionDestination struct. +func (afesd *AzureFunctionEventSubscriptionDestination) 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 azureFunctionEventSubscriptionDestinationProperties AzureFunctionEventSubscriptionDestinationProperties + err = json.Unmarshal(*v, &azureFunctionEventSubscriptionDestinationProperties) + if err != nil { + return err + } + afesd.AzureFunctionEventSubscriptionDestinationProperties = &azureFunctionEventSubscriptionDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointType + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + afesd.EndpointType = endpointType + } + } + } + + return nil +} + +// AzureFunctionEventSubscriptionDestinationProperties the properties that represent the Azure Function +// destination of an event subscription. +type AzureFunctionEventSubscriptionDestinationProperties struct { + // ResourceID - The Azure Resource Id that represents the endpoint of the Azure Function destination of an event subscription. + ResourceID *string `json:"resourceId,omitempty"` + // MaxEventsPerBatch - Maximum number of events per batch. + MaxEventsPerBatch *int32 `json:"maxEventsPerBatch,omitempty"` + // PreferredBatchSizeInKilobytes - Preferred batch size in Kilobytes. + PreferredBatchSizeInKilobytes *int32 `json:"preferredBatchSizeInKilobytes,omitempty"` + // DeliveryAttributeMappings - Delivery attribute details. + DeliveryAttributeMappings *[]BasicDeliveryAttributeMapping `json:"deliveryAttributeMappings,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for AzureFunctionEventSubscriptionDestinationProperties struct. +func (afesdp *AzureFunctionEventSubscriptionDestinationProperties) 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 "resourceId": + if v != nil { + var resourceID string + err = json.Unmarshal(*v, &resourceID) + if err != nil { + return err + } + afesdp.ResourceID = &resourceID + } + case "maxEventsPerBatch": + if v != nil { + var maxEventsPerBatch int32 + err = json.Unmarshal(*v, &maxEventsPerBatch) + if err != nil { + return err + } + afesdp.MaxEventsPerBatch = &maxEventsPerBatch + } + case "preferredBatchSizeInKilobytes": + if v != nil { + var preferredBatchSizeInKilobytes int32 + err = json.Unmarshal(*v, &preferredBatchSizeInKilobytes) + if err != nil { + return err + } + afesdp.PreferredBatchSizeInKilobytes = &preferredBatchSizeInKilobytes + } + case "deliveryAttributeMappings": + if v != nil { + deliveryAttributeMappings, err := unmarshalBasicDeliveryAttributeMappingArray(*v) + if err != nil { + return err + } + afesdp.DeliveryAttributeMappings = &deliveryAttributeMappings + } + } + } + + return nil +} + +// BoolEqualsAdvancedFilter boolEquals Advanced Filter. +type BoolEqualsAdvancedFilter struct { + // Value - The boolean filter value. + Value *bool `json:"value,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { + beaf.OperatorType = OperatorTypeBoolEquals + objectMap := make(map[string]interface{}) + if beaf.Value != nil { + objectMap["value"] = beaf.Value + } + if beaf.Key != nil { + objectMap["key"] = beaf.Key + } + if beaf.OperatorType != "" { + objectMap["operatorType"] = beaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return &beaf, true +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for BoolEqualsAdvancedFilter. +func (beaf BoolEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &beaf, true +} + +// ConnectionState connectionState information. +type ConnectionState struct { + // Status - Status of the connection. Possible values include: 'PersistedConnectionStatusPending', 'PersistedConnectionStatusApproved', 'PersistedConnectionStatusRejected', 'PersistedConnectionStatusDisconnected' + Status PersistedConnectionStatus `json:"status,omitempty"` + // Description - Description of the connection state. + Description *string `json:"description,omitempty"` + // ActionsRequired - Actions required (if any). + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// BasicDeadLetterDestination information about the dead letter destination for an event subscription. To configure a +// deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an object of a +// derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from this class. +type BasicDeadLetterDestination interface { + AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) + AsDeadLetterDestination() (*DeadLetterDestination, bool) +} + +// DeadLetterDestination information about the dead letter destination for an event subscription. To configure +// a deadletter destination, do not directly instantiate an object of this class. Instead, instantiate an +// object of a derived class. Currently, StorageBlobDeadLetterDestination is the only class that derives from +// this class. +type DeadLetterDestination struct { + // EndpointType - Possible values include: 'EndpointTypeBasicDeadLetterDestinationEndpointTypeDeadLetterDestination', 'EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob' + EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` +} + +func unmarshalBasicDeadLetterDestination(body []byte) (BasicDeadLetterDestination, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["endpointType"] { + case string(EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob): + var sbdld StorageBlobDeadLetterDestination + err := json.Unmarshal(body, &sbdld) + return sbdld, err + default: + var dld DeadLetterDestination + err := json.Unmarshal(body, &dld) + return dld, err + } +} +func unmarshalBasicDeadLetterDestinationArray(body []byte) ([]BasicDeadLetterDestination, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dldArray := make([]BasicDeadLetterDestination, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dld, err := unmarshalBasicDeadLetterDestination(*rawMessage) + if err != nil { + return nil, err + } + dldArray[index] = dld + } + return dldArray, nil +} + +// MarshalJSON is the custom marshaler for DeadLetterDestination. +func (dld DeadLetterDestination) MarshalJSON() ([]byte, error) { + dld.EndpointType = EndpointTypeBasicDeadLetterDestinationEndpointTypeDeadLetterDestination + objectMap := make(map[string]interface{}) + if dld.EndpointType != "" { + objectMap["endpointType"] = dld.EndpointType + } + return json.Marshal(objectMap) +} + +// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. +func (dld DeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { + return nil, false +} + +// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. +func (dld DeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { + return &dld, true +} + +// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for DeadLetterDestination. +func (dld DeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { + return &dld, true +} + +// DeadLetterWithResourceIdentity information about the deadletter destination with resource identity. +type DeadLetterWithResourceIdentity struct { + // Identity - The identity to use when dead-lettering events. + Identity *EventSubscriptionIdentity `json:"identity,omitempty"` + // DeadLetterDestination - Information about the destination where events have to be delivered for the event subscription. + // Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. + DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DeadLetterWithResourceIdentity struct. +func (dlwri *DeadLetterWithResourceIdentity) 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 "identity": + if v != nil { + var identity EventSubscriptionIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + dlwri.Identity = &identity + } + case "deadLetterDestination": + if v != nil { + deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) + if err != nil { + return err + } + dlwri.DeadLetterDestination = deadLetterDestination + } + } + } + + return nil +} + +// DeliveryAttributeListResult result of the Get delivery attributes operation. +type DeliveryAttributeListResult struct { + autorest.Response `json:"-"` + // Value - A collection of DeliveryAttributeMapping + Value *[]BasicDeliveryAttributeMapping `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DeliveryAttributeListResult struct. +func (dalr *DeliveryAttributeListResult) 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 "value": + if v != nil { + value, err := unmarshalBasicDeliveryAttributeMappingArray(*v) + if err != nil { + return err + } + dalr.Value = &value + } + } + } + + return nil +} + +// BasicDeliveryAttributeMapping delivery attribute mapping details. +type BasicDeliveryAttributeMapping interface { + AsStaticDeliveryAttributeMapping() (*StaticDeliveryAttributeMapping, bool) + AsDynamicDeliveryAttributeMapping() (*DynamicDeliveryAttributeMapping, bool) + AsDeliveryAttributeMapping() (*DeliveryAttributeMapping, bool) +} + +// DeliveryAttributeMapping delivery attribute mapping details. +type DeliveryAttributeMapping struct { + // Name - Name of the delivery attribute or header. + Name *string `json:"name,omitempty"` + // Type - Possible values include: 'TypeDeliveryAttributeMapping', 'TypeStatic', 'TypeDynamic' + Type Type `json:"type,omitempty"` +} + +func unmarshalBasicDeliveryAttributeMapping(body []byte) (BasicDeliveryAttributeMapping, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeStatic): + var sdam StaticDeliveryAttributeMapping + err := json.Unmarshal(body, &sdam) + return sdam, err + case string(TypeDynamic): + var ddam DynamicDeliveryAttributeMapping + err := json.Unmarshal(body, &ddam) + return ddam, err + default: + var dam DeliveryAttributeMapping + err := json.Unmarshal(body, &dam) + return dam, err + } +} +func unmarshalBasicDeliveryAttributeMappingArray(body []byte) ([]BasicDeliveryAttributeMapping, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + damArray := make([]BasicDeliveryAttributeMapping, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dam, err := unmarshalBasicDeliveryAttributeMapping(*rawMessage) + if err != nil { + return nil, err + } + damArray[index] = dam + } + return damArray, nil +} + +// MarshalJSON is the custom marshaler for DeliveryAttributeMapping. +func (dam DeliveryAttributeMapping) MarshalJSON() ([]byte, error) { + dam.Type = TypeDeliveryAttributeMapping + objectMap := make(map[string]interface{}) + if dam.Name != nil { + objectMap["name"] = dam.Name + } + if dam.Type != "" { + objectMap["type"] = dam.Type + } + return json.Marshal(objectMap) +} + +// AsStaticDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DeliveryAttributeMapping. +func (dam DeliveryAttributeMapping) AsStaticDeliveryAttributeMapping() (*StaticDeliveryAttributeMapping, bool) { + return nil, false +} + +// AsDynamicDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DeliveryAttributeMapping. +func (dam DeliveryAttributeMapping) AsDynamicDeliveryAttributeMapping() (*DynamicDeliveryAttributeMapping, bool) { + return nil, false +} + +// AsDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DeliveryAttributeMapping. +func (dam DeliveryAttributeMapping) AsDeliveryAttributeMapping() (*DeliveryAttributeMapping, bool) { + return &dam, true +} + +// AsBasicDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DeliveryAttributeMapping. +func (dam DeliveryAttributeMapping) AsBasicDeliveryAttributeMapping() (BasicDeliveryAttributeMapping, bool) { + return &dam, true +} + +// DeliveryWithResourceIdentity information about the delivery for an event subscription with resource +// identity. +type DeliveryWithResourceIdentity struct { + // Identity - The identity to use when delivering events. + Identity *EventSubscriptionIdentity `json:"identity,omitempty"` + // Destination - Information about the destination where events have to be delivered for the event subscription. + // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. + Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DeliveryWithResourceIdentity struct. +func (dwri *DeliveryWithResourceIdentity) 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 "identity": + if v != nil { + var identity EventSubscriptionIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + dwri.Identity = &identity + } + case "destination": + if v != nil { + destination, err := unmarshalBasicEventSubscriptionDestination(*v) + if err != nil { + return err + } + dwri.Destination = destination + } + } + } + + return nil +} + +// Domain eventGrid Domain. +type Domain struct { + autorest.Response `json:"-"` + // DomainProperties - Properties of the Event Grid Domain resource. + *DomainProperties `json:"properties,omitempty"` + // Sku - The Sku pricing tier for the Event Grid Domain resource. + Sku *ResourceSku `json:"sku,omitempty"` + // Identity - Identity information for the Event Grid Domain resource. + Identity *IdentityInfo `json:"identity,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to the Event Grid Domain resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Location - Location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Domain. +func (d Domain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.DomainProperties != nil { + objectMap["properties"] = d.DomainProperties + } + if d.Sku != nil { + objectMap["sku"] = d.Sku + } + if d.Identity != nil { + objectMap["identity"] = d.Identity + } + if d.Location != nil { + objectMap["location"] = d.Location + } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Domain struct. +func (d *Domain) 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 domainProperties DomainProperties + err = json.Unmarshal(*v, &domainProperties) + if err != nil { + return err + } + d.DomainProperties = &domainProperties + } + case "sku": + if v != nil { + var sku ResourceSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + d.Sku = &sku + } + case "identity": + if v != nil { + var identity IdentityInfo + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + d.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + d.SystemData = &systemData + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + d.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + d.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + } + } + + return nil +} + +// DomainProperties properties of the Event Grid Domain Resource. +type DomainProperties struct { + // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections. + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Event Grid Domain Resource. Possible values include: 'DomainProvisioningStateCreating', 'DomainProvisioningStateUpdating', 'DomainProvisioningStateDeleting', 'DomainProvisioningStateSucceeded', 'DomainProvisioningStateCanceled', 'DomainProvisioningStateFailed' + ProvisioningState DomainProvisioningState `json:"provisioningState,omitempty"` + // Endpoint - READ-ONLY; Endpoint for the Event Grid Domain Resource which is used for publishing the events. + Endpoint *string `json:"endpoint,omitempty"` + // InputSchema - This determines the format that Event Grid should expect for incoming events published to the Event Grid Domain Resource. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventSchemaV10' + InputSchema InputSchema `json:"inputSchema,omitempty"` + // InputSchemaMapping - Information about the InputSchemaMapping which specified the info about mapping event payload. + InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` + // MetricResourceID - READ-ONLY; Metric resource id for the Event Grid Domain Resource. + MetricResourceID *string `json:"metricResourceId,omitempty"` + // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. + // You can further restrict to specific IPs by configuring . Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` + // DisableLocalAuth - This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the domain. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // AutoCreateTopicWithFirstSubscription - This Boolean is used to specify the creation mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain resource. + // In this context, creation of domain topic can be auto-managed (when true) or self-managed (when false). The default value for this property is true. + // When this property is null or set to true, Event Grid is responsible of automatically creating the domain topic when the first event subscription is + // created at the scope of the domain topic. If this property is set to false, then creating the first event subscription will require creating a domain topic + // by the user. The self-management mode can be used if the user wants full control of when the domain topic is created, while auto-managed mode provides the + // flexibility to perform less operations and manage fewer resources by the user. Also, note that in auto-managed creation mode, user is allowed to create the + // domain topic on demand if needed. + AutoCreateTopicWithFirstSubscription *bool `json:"autoCreateTopicWithFirstSubscription,omitempty"` + // AutoDeleteTopicWithLastSubscription - This Boolean is used to specify the deletion mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain resource. + // In this context, deletion of domain topic can be auto-managed (when true) or self-managed (when false). The default value for this property is true. + // When this property is set to true, Event Grid is responsible of automatically deleting the domain topic when the last event subscription at the scope + // of the domain topic is deleted. If this property is set to false, then the user needs to manually delete the domain topic when it is no longer needed + // (e.g., when last event subscription is deleted and the resource needs to be cleaned up). The self-management mode can be used if the user wants full + // control of when the domain topic needs to be deleted, while auto-managed mode provides the flexibility to perform less operations and manage fewer + // resources by the user. + AutoDeleteTopicWithLastSubscription *bool `json:"autoDeleteTopicWithLastSubscription,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainProperties. +func (dp DomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dp.InputSchema != "" { + objectMap["inputSchema"] = dp.InputSchema + } + objectMap["inputSchemaMapping"] = dp.InputSchemaMapping + if dp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = dp.PublicNetworkAccess + } + if dp.InboundIPRules != nil { + objectMap["inboundIpRules"] = dp.InboundIPRules + } + if dp.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = dp.DisableLocalAuth + } + if dp.AutoCreateTopicWithFirstSubscription != nil { + objectMap["autoCreateTopicWithFirstSubscription"] = dp.AutoCreateTopicWithFirstSubscription + } + if dp.AutoDeleteTopicWithLastSubscription != nil { + objectMap["autoDeleteTopicWithLastSubscription"] = dp.AutoDeleteTopicWithLastSubscription + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DomainProperties struct. +func (dp *DomainProperties) 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 "privateEndpointConnections": + if v != nil { + var privateEndpointConnections []PrivateEndpointConnection + err = json.Unmarshal(*v, &privateEndpointConnections) + if err != nil { + return err + } + dp.PrivateEndpointConnections = &privateEndpointConnections + } + case "provisioningState": + if v != nil { + var provisioningState DomainProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + dp.ProvisioningState = provisioningState + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + dp.Endpoint = &endpoint + } + case "inputSchema": + if v != nil { + var inputSchema InputSchema + err = json.Unmarshal(*v, &inputSchema) + if err != nil { + return err + } + dp.InputSchema = inputSchema + } + case "inputSchemaMapping": + if v != nil { + inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) + if err != nil { + return err + } + dp.InputSchemaMapping = inputSchemaMapping + } + case "metricResourceId": + if v != nil { + var metricResourceID string + err = json.Unmarshal(*v, &metricResourceID) + if err != nil { + return err + } + dp.MetricResourceID = &metricResourceID + } + case "publicNetworkAccess": + if v != nil { + var publicNetworkAccess PublicNetworkAccess + err = json.Unmarshal(*v, &publicNetworkAccess) + if err != nil { + return err + } + dp.PublicNetworkAccess = publicNetworkAccess + } + case "inboundIpRules": + if v != nil { + var inboundIPRules []InboundIPRule + err = json.Unmarshal(*v, &inboundIPRules) + if err != nil { + return err + } + dp.InboundIPRules = &inboundIPRules + } + case "disableLocalAuth": + if v != nil { + var disableLocalAuth bool + err = json.Unmarshal(*v, &disableLocalAuth) + if err != nil { + return err + } + dp.DisableLocalAuth = &disableLocalAuth + } + case "autoCreateTopicWithFirstSubscription": + if v != nil { + var autoCreateTopicWithFirstSubscription bool + err = json.Unmarshal(*v, &autoCreateTopicWithFirstSubscription) + if err != nil { + return err + } + dp.AutoCreateTopicWithFirstSubscription = &autoCreateTopicWithFirstSubscription + } + case "autoDeleteTopicWithLastSubscription": + if v != nil { + var autoDeleteTopicWithLastSubscription bool + err = json.Unmarshal(*v, &autoDeleteTopicWithLastSubscription) + if err != nil { + return err + } + dp.AutoDeleteTopicWithLastSubscription = &autoDeleteTopicWithLastSubscription + } + } + } + + return nil +} + +// DomainRegenerateKeyRequest domain regenerate share access key request. +type DomainRegenerateKeyRequest struct { + // KeyName - Key name to regenerate key1 or key2. + KeyName *string `json:"keyName,omitempty"` +} + +// DomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DomainsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DomainsClient) (Domain, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DomainsCreateOrUpdateFuture) 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 DomainsCreateOrUpdateFuture.Result. +func (future *DomainsCreateOrUpdateFuture) result(client DomainsClient) (d Domain, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + d.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.CreateOrUpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// DomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DomainsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DomainsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DomainsDeleteFuture) 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 DomainsDeleteFuture.Result. +func (future *DomainsDeleteFuture) result(client DomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DomainSharedAccessKeys shared access keys of the Domain. +type DomainSharedAccessKeys struct { + autorest.Response `json:"-"` + // Key1 - Shared access key1 for the domain. + Key1 *string `json:"key1,omitempty"` + // Key2 - Shared access key2 for the domain. + Key2 *string `json:"key2,omitempty"` +} + +// DomainsListResult result of the List Domains operation +type DomainsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of Domains + Value *[]Domain `json:"value,omitempty"` + // NextLink - A link for the next page of domains + NextLink *string `json:"nextLink,omitempty"` +} + +// DomainsListResultIterator provides access to a complete listing of Domain values. +type DomainsListResultIterator struct { + i int + page DomainsListResultPage +} + +// 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 *DomainsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsListResultIterator.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 *DomainsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DomainsListResultIterator) 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 DomainsListResultIterator) Response() DomainsListResult { + 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 DomainsListResultIterator) Value() Domain { + if !iter.page.NotDone() { + return Domain{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DomainsListResultIterator type. +func NewDomainsListResultIterator(page DomainsListResultPage) DomainsListResultIterator { + return DomainsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dlr DomainsListResult) IsEmpty() bool { + return dlr.Value == nil || len(*dlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dlr DomainsListResult) hasNextLink() bool { + return dlr.NextLink != nil && len(*dlr.NextLink) != 0 +} + +// domainsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dlr DomainsListResult) domainsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dlr.NextLink))) +} + +// DomainsListResultPage contains a page of Domain values. +type DomainsListResultPage struct { + fn func(context.Context, DomainsListResult) (DomainsListResult, error) + dlr DomainsListResult +} + +// 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 *DomainsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainsListResultPage.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.dlr) + if err != nil { + return err + } + page.dlr = 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 *DomainsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DomainsListResultPage) NotDone() bool { + return !page.dlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DomainsListResultPage) Response() DomainsListResult { + return page.dlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DomainsListResultPage) Values() []Domain { + if page.dlr.IsEmpty() { + return nil + } + return *page.dlr.Value +} + +// Creates a new instance of the DomainsListResultPage type. +func NewDomainsListResultPage(cur DomainsListResult, getNextPage func(context.Context, DomainsListResult) (DomainsListResult, error)) DomainsListResultPage { + return DomainsListResultPage{ + fn: getNextPage, + dlr: cur, + } +} + +// DomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DomainsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DomainsClient) (Domain, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DomainsUpdateFuture) 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 DomainsUpdateFuture.Result. +func (future *DomainsUpdateFuture) result(client DomainsClient) (d Domain, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + d.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.DomainsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.UpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainsUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// DomainTopic domain Topic. +type DomainTopic struct { + autorest.Response `json:"-"` + // DomainTopicProperties - READ-ONLY; Properties of the Domain Topic. + *DomainTopicProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to Domain Topic resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainTopic. +func (dt DomainTopic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DomainTopic struct. +func (dt *DomainTopic) 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 domainTopicProperties DomainTopicProperties + err = json.Unmarshal(*v, &domainTopicProperties) + if err != nil { + return err + } + dt.DomainTopicProperties = &domainTopicProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + dt.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dt.Type = &typeVar + } + } + } + + return nil +} + +// DomainTopicProperties properties of the Domain Topic. +type DomainTopicProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the domain topic. Possible values include: 'DomainTopicProvisioningStateCreating', 'DomainTopicProvisioningStateUpdating', 'DomainTopicProvisioningStateDeleting', 'DomainTopicProvisioningStateSucceeded', 'DomainTopicProvisioningStateCanceled', 'DomainTopicProvisioningStateFailed' + ProvisioningState DomainTopicProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainTopicProperties. +func (dtp DomainTopicProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DomainTopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DomainTopicsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DomainTopicsClient) (DomainTopic, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DomainTopicsCreateOrUpdateFuture) 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 DomainTopicsCreateOrUpdateFuture.Result. +func (future *DomainTopicsCreateOrUpdateFuture) result(client DomainTopicsClient) (dt DomainTopic, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.DomainTopicsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dt.Response.Response, err = future.GetResult(sender); err == nil && dt.Response.Response.StatusCode != http.StatusNoContent { + dt, err = client.CreateOrUpdateResponder(dt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsCreateOrUpdateFuture", "Result", dt.Response.Response, "Failure responding to request") + } + } + return +} + +// DomainTopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DomainTopicsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DomainTopicsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DomainTopicsDeleteFuture) 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 DomainTopicsDeleteFuture.Result. +func (future *DomainTopicsDeleteFuture) result(client DomainTopicsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.DomainTopicsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.DomainTopicsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DomainTopicsListResult result of the List Domain Topics operation. +type DomainTopicsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of Domain Topics. + Value *[]DomainTopic `json:"value,omitempty"` + // NextLink - A link for the next page of domain topics. + NextLink *string `json:"nextLink,omitempty"` +} + +// DomainTopicsListResultIterator provides access to a complete listing of DomainTopic values. +type DomainTopicsListResultIterator struct { + i int + page DomainTopicsListResultPage +} + +// 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 *DomainTopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsListResultIterator.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 *DomainTopicsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DomainTopicsListResultIterator) 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 DomainTopicsListResultIterator) Response() DomainTopicsListResult { + 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 DomainTopicsListResultIterator) Value() DomainTopic { + if !iter.page.NotDone() { + return DomainTopic{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DomainTopicsListResultIterator type. +func NewDomainTopicsListResultIterator(page DomainTopicsListResultPage) DomainTopicsListResultIterator { + return DomainTopicsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dtlr DomainTopicsListResult) IsEmpty() bool { + return dtlr.Value == nil || len(*dtlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dtlr DomainTopicsListResult) hasNextLink() bool { + return dtlr.NextLink != nil && len(*dtlr.NextLink) != 0 +} + +// domainTopicsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dtlr DomainTopicsListResult) domainTopicsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dtlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dtlr.NextLink))) +} + +// DomainTopicsListResultPage contains a page of DomainTopic values. +type DomainTopicsListResultPage struct { + fn func(context.Context, DomainTopicsListResult) (DomainTopicsListResult, error) + dtlr DomainTopicsListResult +} + +// 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 *DomainTopicsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainTopicsListResultPage.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.dtlr) + if err != nil { + return err + } + page.dtlr = 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 *DomainTopicsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DomainTopicsListResultPage) NotDone() bool { + return !page.dtlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DomainTopicsListResultPage) Response() DomainTopicsListResult { + return page.dtlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DomainTopicsListResultPage) Values() []DomainTopic { + if page.dtlr.IsEmpty() { + return nil + } + return *page.dtlr.Value +} + +// Creates a new instance of the DomainTopicsListResultPage type. +func NewDomainTopicsListResultPage(cur DomainTopicsListResult, getNextPage func(context.Context, DomainTopicsListResult) (DomainTopicsListResult, error)) DomainTopicsListResultPage { + return DomainTopicsListResultPage{ + fn: getNextPage, + dtlr: cur, + } +} + +// DomainUpdateParameterProperties information of domain update parameter properties. +type DomainUpdateParameterProperties struct { + // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. + // You can further restrict to specific IPs by configuring . Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` + // DisableLocalAuth - This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the domain. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` + // AutoCreateTopicWithFirstSubscription - This Boolean is used to specify the creation mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain resource. + // In this context, creation of domain topic can be auto-managed (when true) or self-managed (when false). The default value for this property is true. + // When this property is null or set to true, Event Grid is responsible of automatically creating the domain topic when the first event subscription is + // created at the scope of the domain topic. If this property is set to false, then creating the first event subscription will require creating a domain topic + // by the user. The self-management mode can be used if the user wants full control of when the domain topic is created, while auto-managed mode provides the + // flexibility to perform less operations and manage fewer resources by the user. Also, note that in auto-managed creation mode, user is allowed to create the + // domain topic on demand if needed. + AutoCreateTopicWithFirstSubscription *bool `json:"autoCreateTopicWithFirstSubscription,omitempty"` + // AutoDeleteTopicWithLastSubscription - This Boolean is used to specify the deletion mechanism for 'all' the Event Grid Domain Topics associated with this Event Grid Domain resource. + // In this context, deletion of domain topic can be auto-managed (when true) or self-managed (when false). The default value for this property is true. + // When this property is set to true, Event Grid is responsible of automatically deleting the domain topic when the last event subscription at the scope + // of the domain topic is deleted. If this property is set to false, then the user needs to manually delete the domain topic when it is no longer needed + // (e.g., when last event subscription is deleted and the resource needs to be cleaned up). The self-management mode can be used if the user wants full + // control of when the domain topic needs to be deleted, while auto-managed mode provides the flexibility to perform less operations and manage fewer + // resources by the user. + AutoDeleteTopicWithLastSubscription *bool `json:"autoDeleteTopicWithLastSubscription,omitempty"` +} + +// DomainUpdateParameters properties of the Domain update. +type DomainUpdateParameters struct { + // Tags - Tags of the domains resource. + Tags map[string]*string `json:"tags"` + // DomainUpdateParameterProperties - Properties of the resource. + *DomainUpdateParameterProperties `json:"properties,omitempty"` + // Identity - Identity information for the resource. + Identity *IdentityInfo `json:"identity,omitempty"` + // Sku - The Sku pricing tier for the domain. + Sku *ResourceSku `json:"sku,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainUpdateParameters. +func (dup DomainUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dup.Tags != nil { + objectMap["tags"] = dup.Tags + } + if dup.DomainUpdateParameterProperties != nil { + objectMap["properties"] = dup.DomainUpdateParameterProperties + } + if dup.Identity != nil { + objectMap["identity"] = dup.Identity + } + if dup.Sku != nil { + objectMap["sku"] = dup.Sku + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DomainUpdateParameters struct. +func (dup *DomainUpdateParameters) 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 + } + dup.Tags = tags + } + case "properties": + if v != nil { + var domainUpdateParameterProperties DomainUpdateParameterProperties + err = json.Unmarshal(*v, &domainUpdateParameterProperties) + if err != nil { + return err + } + dup.DomainUpdateParameterProperties = &domainUpdateParameterProperties + } + case "identity": + if v != nil { + var identity IdentityInfo + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + dup.Identity = &identity + } + case "sku": + if v != nil { + var sku ResourceSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + dup.Sku = &sku + } + } + } + + return nil +} + +// DynamicDeliveryAttributeMapping dynamic delivery attribute mapping details. +type DynamicDeliveryAttributeMapping struct { + // DynamicDeliveryAttributeMappingProperties - Properties of dynamic delivery attribute mapping. + *DynamicDeliveryAttributeMappingProperties `json:"properties,omitempty"` + // Name - Name of the delivery attribute or header. + Name *string `json:"name,omitempty"` + // Type - Possible values include: 'TypeDeliveryAttributeMapping', 'TypeStatic', 'TypeDynamic' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DynamicDeliveryAttributeMapping. +func (ddam DynamicDeliveryAttributeMapping) MarshalJSON() ([]byte, error) { + ddam.Type = TypeDynamic + objectMap := make(map[string]interface{}) + if ddam.DynamicDeliveryAttributeMappingProperties != nil { + objectMap["properties"] = ddam.DynamicDeliveryAttributeMappingProperties + } + if ddam.Name != nil { + objectMap["name"] = ddam.Name + } + if ddam.Type != "" { + objectMap["type"] = ddam.Type + } + return json.Marshal(objectMap) +} + +// AsStaticDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DynamicDeliveryAttributeMapping. +func (ddam DynamicDeliveryAttributeMapping) AsStaticDeliveryAttributeMapping() (*StaticDeliveryAttributeMapping, bool) { + return nil, false +} + +// AsDynamicDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DynamicDeliveryAttributeMapping. +func (ddam DynamicDeliveryAttributeMapping) AsDynamicDeliveryAttributeMapping() (*DynamicDeliveryAttributeMapping, bool) { + return &ddam, true +} + +// AsDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DynamicDeliveryAttributeMapping. +func (ddam DynamicDeliveryAttributeMapping) AsDeliveryAttributeMapping() (*DeliveryAttributeMapping, bool) { + return nil, false +} + +// AsBasicDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for DynamicDeliveryAttributeMapping. +func (ddam DynamicDeliveryAttributeMapping) AsBasicDeliveryAttributeMapping() (BasicDeliveryAttributeMapping, bool) { + return &ddam, true +} + +// UnmarshalJSON is the custom unmarshaler for DynamicDeliveryAttributeMapping struct. +func (ddam *DynamicDeliveryAttributeMapping) 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 dynamicDeliveryAttributeMappingProperties DynamicDeliveryAttributeMappingProperties + err = json.Unmarshal(*v, &dynamicDeliveryAttributeMappingProperties) + if err != nil { + return err + } + ddam.DynamicDeliveryAttributeMappingProperties = &dynamicDeliveryAttributeMappingProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ddam.Name = &name + } + case "type": + if v != nil { + var typeVar Type + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ddam.Type = typeVar + } + } + } + + return nil +} + +// DynamicDeliveryAttributeMappingProperties properties of dynamic delivery attribute mapping. +type DynamicDeliveryAttributeMappingProperties struct { + // SourceField - JSON path in the event which contains attribute value. + SourceField *string `json:"sourceField,omitempty"` +} + +// EventChannel event Channel. +type EventChannel struct { + autorest.Response `json:"-"` + // EventChannelProperties - Properties of the EventChannel. + *EventChannelProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to Event Channel resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventChannel. +func (ec EventChannel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ec.EventChannelProperties != nil { + objectMap["properties"] = ec.EventChannelProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EventChannel struct. +func (ec *EventChannel) 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 eventChannelProperties EventChannelProperties + err = json.Unmarshal(*v, &eventChannelProperties) + if err != nil { + return err + } + ec.EventChannelProperties = &eventChannelProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ec.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ec.Type = &typeVar + } + } + } + + return nil +} + +// EventChannelDestination properties of the destination of an event channel. +type EventChannelDestination struct { + // AzureSubscriptionID - Azure subscription ID of the customer creating the event channel. The partner topic + // associated with the event channel will be created under this Azure subscription. + AzureSubscriptionID *string `json:"azureSubscriptionId,omitempty"` + // ResourceGroup - Azure Resource Group of the customer creating the event channel. The partner topic + // associated with the event channel will be created under this resource group. + ResourceGroup *string `json:"resourceGroup,omitempty"` + // PartnerTopicName - Name of the partner topic associated with the event channel. + PartnerTopicName *string `json:"partnerTopicName,omitempty"` +} + +// EventChannelFilter filter for the Event Channel. +type EventChannelFilter struct { + // EnableAdvancedFilteringOnArrays - Allows advanced filters to be evaluated against an array of values instead of expecting a singular value. The default value is either false or null. + EnableAdvancedFilteringOnArrays *bool `json:"enableAdvancedFilteringOnArrays,omitempty"` + // AdvancedFilters - An array of advanced filters that are used for filtering event channels. + AdvancedFilters *[]BasicAdvancedFilter `json:"advancedFilters,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for EventChannelFilter struct. +func (ecf *EventChannelFilter) 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 "enableAdvancedFilteringOnArrays": + if v != nil { + var enableAdvancedFilteringOnArrays bool + err = json.Unmarshal(*v, &enableAdvancedFilteringOnArrays) + if err != nil { + return err + } + ecf.EnableAdvancedFilteringOnArrays = &enableAdvancedFilteringOnArrays + } + case "advancedFilters": + if v != nil { + advancedFilters, err := unmarshalBasicAdvancedFilterArray(*v) + if err != nil { + return err + } + ecf.AdvancedFilters = &advancedFilters + } + } + } + + return nil +} + +// EventChannelProperties properties of the Event Channel. +type EventChannelProperties struct { + // Source - Source of the event channel. This represents a unique resource in the partner's resource model. + Source *EventChannelSource `json:"source,omitempty"` + // Destination - Represents the destination of an event channel. + Destination *EventChannelDestination `json:"destination,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the event channel. Possible values include: 'EventChannelProvisioningStateCreating', 'EventChannelProvisioningStateUpdating', 'EventChannelProvisioningStateDeleting', 'EventChannelProvisioningStateSucceeded', 'EventChannelProvisioningStateCanceled', 'EventChannelProvisioningStateFailed' + ProvisioningState EventChannelProvisioningState `json:"provisioningState,omitempty"` + // PartnerTopicReadinessState - READ-ONLY; The readiness state of the corresponding partner topic. Possible values include: 'PartnerTopicReadinessStateNotActivatedByUserYet', 'PartnerTopicReadinessStateActivatedByUser', 'PartnerTopicReadinessStateDeactivatedByUser', 'PartnerTopicReadinessStateDeletedByUser' + PartnerTopicReadinessState PartnerTopicReadinessState `json:"partnerTopicReadinessState,omitempty"` + // ExpirationTimeIfNotActivatedUtc - Expiration time of the event channel. If this timer expires while the corresponding partner topic is never activated, + // the event channel and corresponding partner topic are deleted. + ExpirationTimeIfNotActivatedUtc *date.Time `json:"expirationTimeIfNotActivatedUtc,omitempty"` + // Filter - Information about the filter for the event channel. + Filter *EventChannelFilter `json:"filter,omitempty"` + // PartnerTopicFriendlyDescription - Friendly description about the topic. This can be set by the publisher/partner to show custom description for the customer partner topic. + // This will be helpful to remove any ambiguity of the origin of creation of the partner topic for the customer. + PartnerTopicFriendlyDescription *string `json:"partnerTopicFriendlyDescription,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventChannelProperties. +func (ecp EventChannelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ecp.Source != nil { + objectMap["source"] = ecp.Source + } + if ecp.Destination != nil { + objectMap["destination"] = ecp.Destination + } + if ecp.ExpirationTimeIfNotActivatedUtc != nil { + objectMap["expirationTimeIfNotActivatedUtc"] = ecp.ExpirationTimeIfNotActivatedUtc + } + if ecp.Filter != nil { + objectMap["filter"] = ecp.Filter + } + if ecp.PartnerTopicFriendlyDescription != nil { + objectMap["partnerTopicFriendlyDescription"] = ecp.PartnerTopicFriendlyDescription + } + return json.Marshal(objectMap) +} + +// EventChannelsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EventChannelsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EventChannelsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EventChannelsDeleteFuture) 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 EventChannelsDeleteFuture.Result. +func (future *EventChannelsDeleteFuture) result(client EventChannelsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventChannelsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.EventChannelsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// EventChannelsListResult result of the List Event Channels operation +type EventChannelsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of Event Channels + Value *[]EventChannel `json:"value,omitempty"` + // NextLink - A link for the next page of event channels + NextLink *string `json:"nextLink,omitempty"` +} + +// EventChannelsListResultIterator provides access to a complete listing of EventChannel values. +type EventChannelsListResultIterator struct { + i int + page EventChannelsListResultPage +} + +// 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 *EventChannelsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsListResultIterator.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 *EventChannelsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EventChannelsListResultIterator) 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 EventChannelsListResultIterator) Response() EventChannelsListResult { + 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 EventChannelsListResultIterator) Value() EventChannel { + if !iter.page.NotDone() { + return EventChannel{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EventChannelsListResultIterator type. +func NewEventChannelsListResultIterator(page EventChannelsListResultPage) EventChannelsListResultIterator { + return EventChannelsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (eclr EventChannelsListResult) IsEmpty() bool { + return eclr.Value == nil || len(*eclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (eclr EventChannelsListResult) hasNextLink() bool { + return eclr.NextLink != nil && len(*eclr.NextLink) != 0 +} + +// eventChannelsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (eclr EventChannelsListResult) eventChannelsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !eclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(eclr.NextLink))) +} + +// EventChannelsListResultPage contains a page of EventChannel values. +type EventChannelsListResultPage struct { + fn func(context.Context, EventChannelsListResult) (EventChannelsListResult, error) + eclr EventChannelsListResult +} + +// 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 *EventChannelsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventChannelsListResultPage.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.eclr) + if err != nil { + return err + } + page.eclr = 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 *EventChannelsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EventChannelsListResultPage) NotDone() bool { + return !page.eclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EventChannelsListResultPage) Response() EventChannelsListResult { + return page.eclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EventChannelsListResultPage) Values() []EventChannel { + if page.eclr.IsEmpty() { + return nil + } + return *page.eclr.Value +} + +// Creates a new instance of the EventChannelsListResultPage type. +func NewEventChannelsListResultPage(cur EventChannelsListResult, getNextPage func(context.Context, EventChannelsListResult) (EventChannelsListResult, error)) EventChannelsListResultPage { + return EventChannelsListResultPage{ + fn: getNextPage, + eclr: cur, + } +} + +// EventChannelSource properties of the source of an event channel. +type EventChannelSource struct { + // Source - The identifier of the resource that's the source of the events. + // This represents a unique resource in the partner's resource model. + Source *string `json:"source,omitempty"` +} + +// EventHubEventSubscriptionDestination information about the event hub destination for an event +// subscription. +type EventHubEventSubscriptionDestination struct { + // EventHubEventSubscriptionDestinationProperties - Event Hub Properties of the event subscription destination. + *EventHubEventSubscriptionDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + ehesd.EndpointType = EndpointTypeEventHub + objectMap := make(map[string]interface{}) + if ehesd.EventHubEventSubscriptionDestinationProperties != nil { + objectMap["properties"] = ehesd.EventHubEventSubscriptionDestinationProperties + } + if ehesd.EndpointType != "" { + objectMap["endpointType"] = ehesd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return &ehesd, true +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { + return nil, false +} + +// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return nil, false +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventHubEventSubscriptionDestination. +func (ehesd EventHubEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &ehesd, true +} + +// UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestination struct. +func (ehesd *EventHubEventSubscriptionDestination) 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 eventHubEventSubscriptionDestinationProperties EventHubEventSubscriptionDestinationProperties + err = json.Unmarshal(*v, &eventHubEventSubscriptionDestinationProperties) + if err != nil { + return err + } + ehesd.EventHubEventSubscriptionDestinationProperties = &eventHubEventSubscriptionDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointType + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + ehesd.EndpointType = endpointType + } + } + } + + return nil +} + +// EventHubEventSubscriptionDestinationProperties the properties for a event hub destination. +type EventHubEventSubscriptionDestinationProperties struct { + // ResourceID - The Azure Resource Id that represents the endpoint of an Event Hub destination of an event subscription. + ResourceID *string `json:"resourceId,omitempty"` + // DeliveryAttributeMappings - Delivery attribute details. + DeliveryAttributeMappings *[]BasicDeliveryAttributeMapping `json:"deliveryAttributeMappings,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for EventHubEventSubscriptionDestinationProperties struct. +func (ehesdp *EventHubEventSubscriptionDestinationProperties) 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 "resourceId": + if v != nil { + var resourceID string + err = json.Unmarshal(*v, &resourceID) + if err != nil { + return err + } + ehesdp.ResourceID = &resourceID + } + case "deliveryAttributeMappings": + if v != nil { + deliveryAttributeMappings, err := unmarshalBasicDeliveryAttributeMappingArray(*v) + if err != nil { + return err + } + ehesdp.DeliveryAttributeMappings = &deliveryAttributeMappings + } + } + } + + return nil +} + +// EventSubscription event Subscription +type EventSubscription struct { + autorest.Response `json:"-"` + // EventSubscriptionProperties - Properties of the event subscription. + *EventSubscriptionProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to Event Subscription resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventSubscription. +func (es EventSubscription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if es.EventSubscriptionProperties != nil { + objectMap["properties"] = es.EventSubscriptionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EventSubscription struct. +func (es *EventSubscription) 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 eventSubscriptionProperties EventSubscriptionProperties + err = json.Unmarshal(*v, &eventSubscriptionProperties) + if err != nil { + return err + } + es.EventSubscriptionProperties = &eventSubscriptionProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + es.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + es.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + es.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + es.Type = &typeVar + } + } + } + + return nil +} + +// BasicEventSubscriptionDestination information about the destination for an event subscription. +type BasicEventSubscriptionDestination interface { + AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) + AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) + AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) + AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) + AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) + AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) + AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) + AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) +} + +// EventSubscriptionDestination information about the destination for an event subscription. +type EventSubscriptionDestination struct { + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +func unmarshalBasicEventSubscriptionDestination(body []byte) (BasicEventSubscriptionDestination, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["endpointType"] { + case string(EndpointTypeWebHook): + var whesd WebHookEventSubscriptionDestination + err := json.Unmarshal(body, &whesd) + return whesd, err + case string(EndpointTypeEventHub): + var ehesd EventHubEventSubscriptionDestination + err := json.Unmarshal(body, &ehesd) + return ehesd, err + case string(EndpointTypeStorageQueue): + var sqesd StorageQueueEventSubscriptionDestination + err := json.Unmarshal(body, &sqesd) + return sqesd, err + case string(EndpointTypeHybridConnection): + var hcesd HybridConnectionEventSubscriptionDestination + err := json.Unmarshal(body, &hcesd) + return hcesd, err + case string(EndpointTypeServiceBusQueue): + var sbqesd ServiceBusQueueEventSubscriptionDestination + err := json.Unmarshal(body, &sbqesd) + return sbqesd, err + case string(EndpointTypeServiceBusTopic): + var sbtesd ServiceBusTopicEventSubscriptionDestination + err := json.Unmarshal(body, &sbtesd) + return sbtesd, err + case string(EndpointTypeAzureFunction): + var afesd AzureFunctionEventSubscriptionDestination + err := json.Unmarshal(body, &afesd) + return afesd, err + default: + var esd EventSubscriptionDestination + err := json.Unmarshal(body, &esd) + return esd, err + } +} +func unmarshalBasicEventSubscriptionDestinationArray(body []byte) ([]BasicEventSubscriptionDestination, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + esdArray := make([]BasicEventSubscriptionDestination, len(rawMessages)) + + for index, rawMessage := range rawMessages { + esd, err := unmarshalBasicEventSubscriptionDestination(*rawMessage) + if err != nil { + return nil, err + } + esdArray[index] = esd + } + return esdArray, nil +} + +// MarshalJSON is the custom marshaler for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) MarshalJSON() ([]byte, error) { + esd.EndpointType = EndpointTypeEventSubscriptionDestination + objectMap := make(map[string]interface{}) + if esd.EndpointType != "" { + objectMap["endpointType"] = esd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return nil, false +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { + return nil, false +} + +// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return &esd, true +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for EventSubscriptionDestination. +func (esd EventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &esd, true +} + +// EventSubscriptionFilter filter for the Event Subscription. +type EventSubscriptionFilter struct { + // SubjectBeginsWith - An optional string to filter events for an event subscription based on a resource path prefix. + // The format of this depends on the publisher of the events. + // Wildcard characters are not supported in this path. + SubjectBeginsWith *string `json:"subjectBeginsWith,omitempty"` + // SubjectEndsWith - An optional string to filter events for an event subscription based on a resource path suffix. + // Wildcard characters are not supported in this path. + SubjectEndsWith *string `json:"subjectEndsWith,omitempty"` + // IncludedEventTypes - A list of applicable event types that need to be part of the event subscription. If it is desired to subscribe to all default event types, set the IncludedEventTypes to null. + IncludedEventTypes *[]string `json:"includedEventTypes,omitempty"` + // IsSubjectCaseSensitive - Specifies if the SubjectBeginsWith and SubjectEndsWith properties of the filter + // should be compared in a case sensitive manner. + IsSubjectCaseSensitive *bool `json:"isSubjectCaseSensitive,omitempty"` + // EnableAdvancedFilteringOnArrays - Allows advanced filters to be evaluated against an array of values instead of expecting a singular value. + EnableAdvancedFilteringOnArrays *bool `json:"enableAdvancedFilteringOnArrays,omitempty"` + // AdvancedFilters - An array of advanced filters that are used for filtering event subscriptions. + AdvancedFilters *[]BasicAdvancedFilter `json:"advancedFilters,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for EventSubscriptionFilter struct. +func (esf *EventSubscriptionFilter) 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 "subjectBeginsWith": + if v != nil { + var subjectBeginsWith string + err = json.Unmarshal(*v, &subjectBeginsWith) + if err != nil { + return err + } + esf.SubjectBeginsWith = &subjectBeginsWith + } + case "subjectEndsWith": + if v != nil { + var subjectEndsWith string + err = json.Unmarshal(*v, &subjectEndsWith) + if err != nil { + return err + } + esf.SubjectEndsWith = &subjectEndsWith + } + case "includedEventTypes": + if v != nil { + var includedEventTypes []string + err = json.Unmarshal(*v, &includedEventTypes) + if err != nil { + return err + } + esf.IncludedEventTypes = &includedEventTypes + } + case "isSubjectCaseSensitive": + if v != nil { + var isSubjectCaseSensitive bool + err = json.Unmarshal(*v, &isSubjectCaseSensitive) + if err != nil { + return err + } + esf.IsSubjectCaseSensitive = &isSubjectCaseSensitive + } + case "enableAdvancedFilteringOnArrays": + if v != nil { + var enableAdvancedFilteringOnArrays bool + err = json.Unmarshal(*v, &enableAdvancedFilteringOnArrays) + if err != nil { + return err + } + esf.EnableAdvancedFilteringOnArrays = &enableAdvancedFilteringOnArrays + } + case "advancedFilters": + if v != nil { + advancedFilters, err := unmarshalBasicAdvancedFilterArray(*v) + if err != nil { + return err + } + esf.AdvancedFilters = &advancedFilters + } + } + } + + return nil +} + +// EventSubscriptionFullURL full endpoint url of an event subscription +type EventSubscriptionFullURL struct { + autorest.Response `json:"-"` + // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. + EndpointURL *string `json:"endpointUrl,omitempty"` +} + +// EventSubscriptionIdentity the identity information with the event subscription. +type EventSubscriptionIdentity struct { + // Type - The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identity. Possible values include: 'EventSubscriptionIdentityTypeSystemAssigned', 'EventSubscriptionIdentityTypeUserAssigned' + Type EventSubscriptionIdentityType `json:"type,omitempty"` + // UserAssignedIdentity - The user identity associated with the resource. + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} + +// EventSubscriptionProperties properties of the Event Subscription. +type EventSubscriptionProperties struct { + // Topic - READ-ONLY; Name of the topic of the event subscription. + Topic *string `json:"topic,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the event subscription. Possible values include: 'EventSubscriptionProvisioningStateCreating', 'EventSubscriptionProvisioningStateUpdating', 'EventSubscriptionProvisioningStateDeleting', 'EventSubscriptionProvisioningStateSucceeded', 'EventSubscriptionProvisioningStateCanceled', 'EventSubscriptionProvisioningStateFailed', 'EventSubscriptionProvisioningStateAwaitingManualAction' + ProvisioningState EventSubscriptionProvisioningState `json:"provisioningState,omitempty"` + // Destination - Information about the destination where events have to be delivered for the event subscription. + // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. + Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` + // DeliveryWithResourceIdentity - Information about the destination where events have to be delivered for the event subscription. + // Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. + DeliveryWithResourceIdentity *DeliveryWithResourceIdentity `json:"deliveryWithResourceIdentity,omitempty"` + // Filter - Information about the filter for the event subscription. + Filter *EventSubscriptionFilter `json:"filter,omitempty"` + // Labels - List of user defined labels. + Labels *[]string `json:"labels,omitempty"` + // ExpirationTimeUtc - Expiration time of the event subscription. + ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` + // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventDeliverySchemaEventGridSchema', 'EventDeliverySchemaCustomInputSchema', 'EventDeliverySchemaCloudEventSchemaV10' + EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` + // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. + RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` + // DeadLetterDestination - The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. + // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. + DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` + // DeadLetterWithResourceIdentity - The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. + // Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication tokens being used during delivery / dead-lettering. + DeadLetterWithResourceIdentity *DeadLetterWithResourceIdentity `json:"deadLetterWithResourceIdentity,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventSubscriptionProperties. +func (esp EventSubscriptionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["destination"] = esp.Destination + if esp.DeliveryWithResourceIdentity != nil { + objectMap["deliveryWithResourceIdentity"] = esp.DeliveryWithResourceIdentity + } + if esp.Filter != nil { + objectMap["filter"] = esp.Filter + } + if esp.Labels != nil { + objectMap["labels"] = esp.Labels + } + if esp.ExpirationTimeUtc != nil { + objectMap["expirationTimeUtc"] = esp.ExpirationTimeUtc + } + if esp.EventDeliverySchema != "" { + objectMap["eventDeliverySchema"] = esp.EventDeliverySchema + } + if esp.RetryPolicy != nil { + objectMap["retryPolicy"] = esp.RetryPolicy + } + objectMap["deadLetterDestination"] = esp.DeadLetterDestination + if esp.DeadLetterWithResourceIdentity != nil { + objectMap["deadLetterWithResourceIdentity"] = esp.DeadLetterWithResourceIdentity + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EventSubscriptionProperties struct. +func (esp *EventSubscriptionProperties) 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 "topic": + if v != nil { + var topic string + err = json.Unmarshal(*v, &topic) + if err != nil { + return err + } + esp.Topic = &topic + } + case "provisioningState": + if v != nil { + var provisioningState EventSubscriptionProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + esp.ProvisioningState = provisioningState + } + case "destination": + if v != nil { + destination, err := unmarshalBasicEventSubscriptionDestination(*v) + if err != nil { + return err + } + esp.Destination = destination + } + case "deliveryWithResourceIdentity": + if v != nil { + var deliveryWithResourceIdentity DeliveryWithResourceIdentity + err = json.Unmarshal(*v, &deliveryWithResourceIdentity) + if err != nil { + return err + } + esp.DeliveryWithResourceIdentity = &deliveryWithResourceIdentity + } + case "filter": + if v != nil { + var filter EventSubscriptionFilter + err = json.Unmarshal(*v, &filter) + if err != nil { + return err + } + esp.Filter = &filter + } + case "labels": + if v != nil { + var labels []string + err = json.Unmarshal(*v, &labels) + if err != nil { + return err + } + esp.Labels = &labels + } + case "expirationTimeUtc": + if v != nil { + var expirationTimeUtc date.Time + err = json.Unmarshal(*v, &expirationTimeUtc) + if err != nil { + return err + } + esp.ExpirationTimeUtc = &expirationTimeUtc + } + case "eventDeliverySchema": + if v != nil { + var eventDeliverySchema EventDeliverySchema + err = json.Unmarshal(*v, &eventDeliverySchema) + if err != nil { + return err + } + esp.EventDeliverySchema = eventDeliverySchema + } + case "retryPolicy": + if v != nil { + var retryPolicy RetryPolicy + err = json.Unmarshal(*v, &retryPolicy) + if err != nil { + return err + } + esp.RetryPolicy = &retryPolicy + } + case "deadLetterDestination": + if v != nil { + deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) + if err != nil { + return err + } + esp.DeadLetterDestination = deadLetterDestination + } + case "deadLetterWithResourceIdentity": + if v != nil { + var deadLetterWithResourceIdentity DeadLetterWithResourceIdentity + err = json.Unmarshal(*v, &deadLetterWithResourceIdentity) + if err != nil { + return err + } + esp.DeadLetterWithResourceIdentity = &deadLetterWithResourceIdentity + } + } + } + + return nil +} + +// EventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EventSubscriptionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EventSubscriptionsClient) (EventSubscription, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EventSubscriptionsCreateOrUpdateFuture) 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 EventSubscriptionsCreateOrUpdateFuture.Result. +func (future *EventSubscriptionsCreateOrUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + es.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { + es, err = client.CreateOrUpdateResponder(es.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") + } + } + return +} + +// EventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EventSubscriptionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EventSubscriptionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EventSubscriptionsDeleteFuture) 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 EventSubscriptionsDeleteFuture.Result. +func (future *EventSubscriptionsDeleteFuture) result(client EventSubscriptionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// EventSubscriptionsListResult result of the List EventSubscriptions operation +type EventSubscriptionsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of EventSubscriptions + Value *[]EventSubscription `json:"value,omitempty"` + // NextLink - A link for the next page of event subscriptions + NextLink *string `json:"nextLink,omitempty"` +} + +// EventSubscriptionsListResultIterator provides access to a complete listing of EventSubscription values. +type EventSubscriptionsListResultIterator struct { + i int + page EventSubscriptionsListResultPage +} + +// 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 *EventSubscriptionsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsListResultIterator.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 *EventSubscriptionsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EventSubscriptionsListResultIterator) 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 EventSubscriptionsListResultIterator) Response() EventSubscriptionsListResult { + 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 EventSubscriptionsListResultIterator) Value() EventSubscription { + if !iter.page.NotDone() { + return EventSubscription{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EventSubscriptionsListResultIterator type. +func NewEventSubscriptionsListResultIterator(page EventSubscriptionsListResultPage) EventSubscriptionsListResultIterator { + return EventSubscriptionsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (eslr EventSubscriptionsListResult) IsEmpty() bool { + return eslr.Value == nil || len(*eslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (eslr EventSubscriptionsListResult) hasNextLink() bool { + return eslr.NextLink != nil && len(*eslr.NextLink) != 0 +} + +// eventSubscriptionsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (eslr EventSubscriptionsListResult) eventSubscriptionsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !eslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(eslr.NextLink))) +} + +// EventSubscriptionsListResultPage contains a page of EventSubscription values. +type EventSubscriptionsListResultPage struct { + fn func(context.Context, EventSubscriptionsListResult) (EventSubscriptionsListResult, error) + eslr EventSubscriptionsListResult +} + +// 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 *EventSubscriptionsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventSubscriptionsListResultPage.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.eslr) + if err != nil { + return err + } + page.eslr = 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 *EventSubscriptionsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EventSubscriptionsListResultPage) NotDone() bool { + return !page.eslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EventSubscriptionsListResultPage) Response() EventSubscriptionsListResult { + return page.eslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EventSubscriptionsListResultPage) Values() []EventSubscription { + if page.eslr.IsEmpty() { + return nil + } + return *page.eslr.Value +} + +// Creates a new instance of the EventSubscriptionsListResultPage type. +func NewEventSubscriptionsListResultPage(cur EventSubscriptionsListResult, getNextPage func(context.Context, EventSubscriptionsListResult) (EventSubscriptionsListResult, error)) EventSubscriptionsListResultPage { + return EventSubscriptionsListResultPage{ + fn: getNextPage, + eslr: cur, + } +} + +// EventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type EventSubscriptionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EventSubscriptionsClient) (EventSubscription, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EventSubscriptionsUpdateFuture) 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 EventSubscriptionsUpdateFuture.Result. +func (future *EventSubscriptionsUpdateFuture) result(client EventSubscriptionsClient) (es EventSubscription, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + es.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.EventSubscriptionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { + es, err = client.UpdateResponder(es.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.EventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") + } + } + return +} + +// EventSubscriptionUpdateParameters properties of the Event Subscription update. +type EventSubscriptionUpdateParameters struct { + // Destination - Information about the destination where events have to be delivered for the event subscription. + // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. + Destination BasicEventSubscriptionDestination `json:"destination,omitempty"` + // DeliveryWithResourceIdentity - Information about the destination where events have to be delivered for the event subscription. + // Uses the managed identity setup on the parent resource (topic / domain) to acquire the authentication tokens being used during delivery / dead-lettering. + DeliveryWithResourceIdentity *DeliveryWithResourceIdentity `json:"deliveryWithResourceIdentity,omitempty"` + // Filter - Information about the filter for the event subscription. + Filter *EventSubscriptionFilter `json:"filter,omitempty"` + // Labels - List of user defined labels. + Labels *[]string `json:"labels,omitempty"` + // ExpirationTimeUtc - Information about the expiration time for the event subscription. + ExpirationTimeUtc *date.Time `json:"expirationTimeUtc,omitempty"` + // EventDeliverySchema - The event delivery schema for the event subscription. Possible values include: 'EventDeliverySchemaEventGridSchema', 'EventDeliverySchemaCustomInputSchema', 'EventDeliverySchemaCloudEventSchemaV10' + EventDeliverySchema EventDeliverySchema `json:"eventDeliverySchema,omitempty"` + // RetryPolicy - The retry policy for events. This can be used to configure maximum number of delivery attempts and time to live for events. + RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"` + // DeadLetterDestination - The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. + // Uses Azure Event Grid's identity to acquire the authentication tokens being used during delivery / dead-lettering. + DeadLetterDestination BasicDeadLetterDestination `json:"deadLetterDestination,omitempty"` + // DeadLetterWithResourceIdentity - The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. + // Uses the managed identity setup on the parent resource (topic / domain) to acquire the authentication tokens being used during delivery / dead-lettering. + DeadLetterWithResourceIdentity *DeadLetterWithResourceIdentity `json:"deadLetterWithResourceIdentity,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for EventSubscriptionUpdateParameters struct. +func (esup *EventSubscriptionUpdateParameters) 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 "destination": + if v != nil { + destination, err := unmarshalBasicEventSubscriptionDestination(*v) + if err != nil { + return err + } + esup.Destination = destination + } + case "deliveryWithResourceIdentity": + if v != nil { + var deliveryWithResourceIdentity DeliveryWithResourceIdentity + err = json.Unmarshal(*v, &deliveryWithResourceIdentity) + if err != nil { + return err + } + esup.DeliveryWithResourceIdentity = &deliveryWithResourceIdentity + } + case "filter": + if v != nil { + var filter EventSubscriptionFilter + err = json.Unmarshal(*v, &filter) + if err != nil { + return err + } + esup.Filter = &filter + } + case "labels": + if v != nil { + var labels []string + err = json.Unmarshal(*v, &labels) + if err != nil { + return err + } + esup.Labels = &labels + } + case "expirationTimeUtc": + if v != nil { + var expirationTimeUtc date.Time + err = json.Unmarshal(*v, &expirationTimeUtc) + if err != nil { + return err + } + esup.ExpirationTimeUtc = &expirationTimeUtc + } + case "eventDeliverySchema": + if v != nil { + var eventDeliverySchema EventDeliverySchema + err = json.Unmarshal(*v, &eventDeliverySchema) + if err != nil { + return err + } + esup.EventDeliverySchema = eventDeliverySchema + } + case "retryPolicy": + if v != nil { + var retryPolicy RetryPolicy + err = json.Unmarshal(*v, &retryPolicy) + if err != nil { + return err + } + esup.RetryPolicy = &retryPolicy + } + case "deadLetterDestination": + if v != nil { + deadLetterDestination, err := unmarshalBasicDeadLetterDestination(*v) + if err != nil { + return err + } + esup.DeadLetterDestination = deadLetterDestination + } + case "deadLetterWithResourceIdentity": + if v != nil { + var deadLetterWithResourceIdentity DeadLetterWithResourceIdentity + err = json.Unmarshal(*v, &deadLetterWithResourceIdentity) + if err != nil { + return err + } + esup.DeadLetterWithResourceIdentity = &deadLetterWithResourceIdentity + } + } + } + + return nil +} + +// EventType event Type for a subject under a topic +type EventType struct { + // EventTypeProperties - Properties of the event type. + *EventTypeProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventType. +func (et EventType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if et.EventTypeProperties != nil { + objectMap["properties"] = et.EventTypeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EventType struct. +func (et *EventType) 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 eventTypeProperties EventTypeProperties + err = json.Unmarshal(*v, &eventTypeProperties) + if err != nil { + return err + } + et.EventTypeProperties = &eventTypeProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + et.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + et.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + et.Type = &typeVar + } + } + } + + return nil +} + +// EventTypeProperties properties of the event type +type EventTypeProperties struct { + // DisplayName - Display name of the event type. + DisplayName *string `json:"displayName,omitempty"` + // Description - Description of the event type. + Description *string `json:"description,omitempty"` + // SchemaURL - Url of the schema for this event type. + SchemaURL *string `json:"schemaUrl,omitempty"` + // IsInDefaultSet - IsInDefaultSet flag of the event type. + IsInDefaultSet *bool `json:"isInDefaultSet,omitempty"` +} + +// EventTypesListResult result of the List Event Types operation +type EventTypesListResult struct { + autorest.Response `json:"-"` + // Value - A collection of event types + Value *[]EventType `json:"value,omitempty"` +} + +// ExtendedLocation definition of an Extended Location +type ExtendedLocation struct { + // Name - Fully qualified name of the extended location. + Name *string `json:"name,omitempty"` + // Type - Type of the extended location. + Type *string `json:"type,omitempty"` +} + +// ExtensionTopic event grid Extension Topic. This is used for getting Event Grid related metrics for Azure +// resources. +type ExtensionTopic struct { + autorest.Response `json:"-"` + // ExtensionTopicProperties - Properties of the extension topic + *ExtensionTopicProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionTopic. +func (et ExtensionTopic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if et.ExtensionTopicProperties != nil { + objectMap["properties"] = et.ExtensionTopicProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExtensionTopic struct. +func (et *ExtensionTopic) 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 extensionTopicProperties ExtensionTopicProperties + err = json.Unmarshal(*v, &extensionTopicProperties) + if err != nil { + return err + } + et.ExtensionTopicProperties = &extensionTopicProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + et.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + et.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + et.Type = &typeVar + } + } + } + + return nil +} + +// ExtensionTopicProperties properties of the Extension Topic +type ExtensionTopicProperties struct { + // Description - Description of the extension topic. + Description *string `json:"description,omitempty"` + // SystemTopic - System topic resource id which is mapped to the source. + SystemTopic *string `json:"systemTopic,omitempty"` +} + +// HybridConnectionEventSubscriptionDestination information about the HybridConnection destination for an +// event subscription. +type HybridConnectionEventSubscriptionDestination struct { + // HybridConnectionEventSubscriptionDestinationProperties - Hybrid connection Properties of the event subscription destination. + *HybridConnectionEventSubscriptionDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + hcesd.EndpointType = EndpointTypeHybridConnection + objectMap := make(map[string]interface{}) + if hcesd.HybridConnectionEventSubscriptionDestinationProperties != nil { + objectMap["properties"] = hcesd.HybridConnectionEventSubscriptionDestinationProperties + } + if hcesd.EndpointType != "" { + objectMap["endpointType"] = hcesd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return nil, false +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return &hcesd, true +} + +// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { + return nil, false +} + +// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return nil, false +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for HybridConnectionEventSubscriptionDestination. +func (hcesd HybridConnectionEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &hcesd, true +} + +// UnmarshalJSON is the custom unmarshaler for HybridConnectionEventSubscriptionDestination struct. +func (hcesd *HybridConnectionEventSubscriptionDestination) 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 hybridConnectionEventSubscriptionDestinationProperties HybridConnectionEventSubscriptionDestinationProperties + err = json.Unmarshal(*v, &hybridConnectionEventSubscriptionDestinationProperties) + if err != nil { + return err + } + hcesd.HybridConnectionEventSubscriptionDestinationProperties = &hybridConnectionEventSubscriptionDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointType + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + hcesd.EndpointType = endpointType + } + } + } + + return nil +} + +// HybridConnectionEventSubscriptionDestinationProperties the properties for a hybrid connection +// destination. +type HybridConnectionEventSubscriptionDestinationProperties struct { + // ResourceID - The Azure Resource ID of an hybrid connection that is the destination of an event subscription. + ResourceID *string `json:"resourceId,omitempty"` + // DeliveryAttributeMappings - Delivery attribute details. + DeliveryAttributeMappings *[]BasicDeliveryAttributeMapping `json:"deliveryAttributeMappings,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for HybridConnectionEventSubscriptionDestinationProperties struct. +func (hcesdp *HybridConnectionEventSubscriptionDestinationProperties) 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 "resourceId": + if v != nil { + var resourceID string + err = json.Unmarshal(*v, &resourceID) + if err != nil { + return err + } + hcesdp.ResourceID = &resourceID + } + case "deliveryAttributeMappings": + if v != nil { + deliveryAttributeMappings, err := unmarshalBasicDeliveryAttributeMappingArray(*v) + if err != nil { + return err + } + hcesdp.DeliveryAttributeMappings = &deliveryAttributeMappings + } + } + } + + return nil +} + +// IdentityInfo the identity information for the resource. +type IdentityInfo struct { + // Type - The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identity. Possible values include: 'IdentityTypeNone', 'IdentityTypeSystemAssigned', 'IdentityTypeUserAssigned', 'IdentityTypeSystemAssignedUserAssigned' + Type IdentityType `json:"type,omitempty"` + // PrincipalID - The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + // This property is currently not used and reserved for future usage. + UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for IdentityInfo. +func (ii IdentityInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ii.Type != "" { + objectMap["type"] = ii.Type + } + if ii.PrincipalID != nil { + objectMap["principalId"] = ii.PrincipalID + } + if ii.TenantID != nil { + objectMap["tenantId"] = ii.TenantID + } + if ii.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = ii.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// InboundIPRule ... +type InboundIPRule struct { + // IPMask - IP Address in CIDR notation e.g., 10.0.0.0/8. + IPMask *string `json:"ipMask,omitempty"` + // Action - Action to perform based on the match or no match of the IpMask. Possible values include: 'IPActionTypeAllow' + Action IPActionType `json:"action,omitempty"` +} + +// BasicInputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an +// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only supported +// type of InputSchemaMapping is 'JsonInputSchemaMapping'. +type BasicInputSchemaMapping interface { + AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) + AsInputSchemaMapping() (*InputSchemaMapping, bool) +} + +// InputSchemaMapping by default, Event Grid expects events to be in the Event Grid event schema. Specifying an +// input schema mapping enables publishing to Event Grid using a custom input schema. Currently, the only +// supported type of InputSchemaMapping is 'JsonInputSchemaMapping'. +type InputSchemaMapping struct { + // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' + InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` +} + +func unmarshalBasicInputSchemaMapping(body []byte) (BasicInputSchemaMapping, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["inputSchemaMappingType"] { + case string(InputSchemaMappingTypeJSON): + var jism JSONInputSchemaMapping + err := json.Unmarshal(body, &jism) + return jism, err + default: + var ism InputSchemaMapping + err := json.Unmarshal(body, &ism) + return ism, err + } +} +func unmarshalBasicInputSchemaMappingArray(body []byte) ([]BasicInputSchemaMapping, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ismArray := make([]BasicInputSchemaMapping, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ism, err := unmarshalBasicInputSchemaMapping(*rawMessage) + if err != nil { + return nil, err + } + ismArray[index] = ism + } + return ismArray, nil +} + +// MarshalJSON is the custom marshaler for InputSchemaMapping. +func (ism InputSchemaMapping) MarshalJSON() ([]byte, error) { + ism.InputSchemaMappingType = InputSchemaMappingTypeInputSchemaMapping + objectMap := make(map[string]interface{}) + if ism.InputSchemaMappingType != "" { + objectMap["inputSchemaMappingType"] = ism.InputSchemaMappingType + } + return json.Marshal(objectMap) +} + +// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. +func (ism InputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { + return nil, false +} + +// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. +func (ism InputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { + return &ism, true +} + +// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for InputSchemaMapping. +func (ism InputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { + return &ism, true +} + +// IsNotNullAdvancedFilter isNotNull Advanced Filter. +type IsNotNullAdvancedFilter struct { + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) MarshalJSON() ([]byte, error) { + innaf.OperatorType = OperatorTypeIsNotNull + objectMap := make(map[string]interface{}) + if innaf.Key != nil { + objectMap["key"] = innaf.Key + } + if innaf.OperatorType != "" { + objectMap["operatorType"] = innaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return &innaf, true +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for IsNotNullAdvancedFilter. +func (innaf IsNotNullAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &innaf, true +} + +// IsNullOrUndefinedAdvancedFilter isNullOrUndefined Advanced Filter. +type IsNullOrUndefinedAdvancedFilter struct { + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) MarshalJSON() ([]byte, error) { + inouaf.OperatorType = OperatorTypeIsNullOrUndefined + objectMap := make(map[string]interface{}) + if inouaf.Key != nil { + objectMap["key"] = inouaf.Key + } + if inouaf.OperatorType != "" { + objectMap["operatorType"] = inouaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return &inouaf, true +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for IsNullOrUndefinedAdvancedFilter. +func (inouaf IsNullOrUndefinedAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &inouaf, true +} + +// JSONField this is used to express the source of an input schema mapping for a single target field in the +// Event Grid Event schema. This is currently used in the mappings for the 'id', 'topic' and 'eventtime' +// properties. This represents a field in the input event schema. +type JSONField struct { + // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. + SourceField *string `json:"sourceField,omitempty"` +} + +// JSONFieldWithDefault this is used to express the source of an input schema mapping for a single target +// field +// in the Event Grid Event schema. This is currently used in the mappings for the 'subject', +// 'eventtype' and 'dataversion' properties. This represents a field in the input event schema +// along with a default value to be used, and at least one of these two properties should be provided. +type JSONFieldWithDefault struct { + // SourceField - Name of a field in the input event schema that's to be used as the source of a mapping. + SourceField *string `json:"sourceField,omitempty"` + // DefaultValue - The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload. + DefaultValue *string `json:"defaultValue,omitempty"` +} + +// JSONInputSchemaMapping this enables publishing to Event Grid using a custom input schema. This can be +// used to map properties from a custom input JSON schema to the Event Grid event schema. +type JSONInputSchemaMapping struct { + // JSONInputSchemaMappingProperties - JSON Properties of the input schema mapping + *JSONInputSchemaMappingProperties `json:"properties,omitempty"` + // InputSchemaMappingType - Possible values include: 'InputSchemaMappingTypeInputSchemaMapping', 'InputSchemaMappingTypeJSON' + InputSchemaMappingType InputSchemaMappingType `json:"inputSchemaMappingType,omitempty"` +} + +// MarshalJSON is the custom marshaler for JSONInputSchemaMapping. +func (jism JSONInputSchemaMapping) MarshalJSON() ([]byte, error) { + jism.InputSchemaMappingType = InputSchemaMappingTypeJSON + objectMap := make(map[string]interface{}) + if jism.JSONInputSchemaMappingProperties != nil { + objectMap["properties"] = jism.JSONInputSchemaMappingProperties + } + if jism.InputSchemaMappingType != "" { + objectMap["inputSchemaMappingType"] = jism.InputSchemaMappingType + } + return json.Marshal(objectMap) +} + +// AsJSONInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. +func (jism JSONInputSchemaMapping) AsJSONInputSchemaMapping() (*JSONInputSchemaMapping, bool) { + return &jism, true +} + +// AsInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. +func (jism JSONInputSchemaMapping) AsInputSchemaMapping() (*InputSchemaMapping, bool) { + return nil, false +} + +// AsBasicInputSchemaMapping is the BasicInputSchemaMapping implementation for JSONInputSchemaMapping. +func (jism JSONInputSchemaMapping) AsBasicInputSchemaMapping() (BasicInputSchemaMapping, bool) { + return &jism, true +} + +// UnmarshalJSON is the custom unmarshaler for JSONInputSchemaMapping struct. +func (jism *JSONInputSchemaMapping) 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 JSONInputSchemaMappingProperties JSONInputSchemaMappingProperties + err = json.Unmarshal(*v, &JSONInputSchemaMappingProperties) + if err != nil { + return err + } + jism.JSONInputSchemaMappingProperties = &JSONInputSchemaMappingProperties + } + case "inputSchemaMappingType": + if v != nil { + var inputSchemaMappingType InputSchemaMappingType + err = json.Unmarshal(*v, &inputSchemaMappingType) + if err != nil { + return err + } + jism.InputSchemaMappingType = inputSchemaMappingType + } + } + } + + return nil +} + +// JSONInputSchemaMappingProperties this can be used to map properties of a source schema (or default +// values, for certain supported properties) to properties of the EventGridEvent schema. +type JSONInputSchemaMappingProperties struct { + // ID - The mapping information for the Id property of the Event Grid Event. + ID *JSONField `json:"id,omitempty"` + // Topic - The mapping information for the Topic property of the Event Grid Event. + Topic *JSONField `json:"topic,omitempty"` + // EventTime - The mapping information for the EventTime property of the Event Grid Event. + EventTime *JSONField `json:"eventTime,omitempty"` + // EventType - The mapping information for the EventType property of the Event Grid Event. + EventType *JSONFieldWithDefault `json:"eventType,omitempty"` + // Subject - The mapping information for the Subject property of the Event Grid Event. + Subject *JSONFieldWithDefault `json:"subject,omitempty"` + // DataVersion - The mapping information for the DataVersion property of the Event Grid Event. + DataVersion *JSONFieldWithDefault `json:"dataVersion,omitempty"` +} + +// NumberGreaterThanAdvancedFilter numberGreaterThan Advanced Filter. +type NumberGreaterThanAdvancedFilter struct { + // Value - The filter value. + Value *float64 `json:"value,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) MarshalJSON() ([]byte, error) { + ngtaf.OperatorType = OperatorTypeNumberGreaterThan + objectMap := make(map[string]interface{}) + if ngtaf.Value != nil { + objectMap["value"] = ngtaf.Value + } + if ngtaf.Key != nil { + objectMap["key"] = ngtaf.Key + } + if ngtaf.OperatorType != "" { + objectMap["operatorType"] = ngtaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return &ngtaf, true +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanAdvancedFilter. +func (ngtaf NumberGreaterThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &ngtaf, true +} + +// NumberGreaterThanOrEqualsAdvancedFilter numberGreaterThanOrEquals Advanced Filter. +type NumberGreaterThanOrEqualsAdvancedFilter struct { + // Value - The filter value. + Value *float64 `json:"value,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { + ngtoeaf.OperatorType = OperatorTypeNumberGreaterThanOrEquals + objectMap := make(map[string]interface{}) + if ngtoeaf.Value != nil { + objectMap["value"] = ngtoeaf.Value + } + if ngtoeaf.Key != nil { + objectMap["key"] = ngtoeaf.Key + } + if ngtoeaf.OperatorType != "" { + objectMap["operatorType"] = ngtoeaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return &ngtoeaf, true +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberGreaterThanOrEqualsAdvancedFilter. +func (ngtoeaf NumberGreaterThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &ngtoeaf, true +} + +// NumberInAdvancedFilter numberIn Advanced Filter. +type NumberInAdvancedFilter struct { + // Values - The set of filter values. + Values *[]float64 `json:"values,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) MarshalJSON() ([]byte, error) { + niaf.OperatorType = OperatorTypeNumberIn + objectMap := make(map[string]interface{}) + if niaf.Values != nil { + objectMap["values"] = niaf.Values + } + if niaf.Key != nil { + objectMap["key"] = niaf.Key + } + if niaf.OperatorType != "" { + objectMap["operatorType"] = niaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return &niaf, true +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberInAdvancedFilter. +func (niaf NumberInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &niaf, true +} + +// NumberInRangeAdvancedFilter numberInRange Advanced Filter. +type NumberInRangeAdvancedFilter struct { + // Values - The set of filter values. + Values *[][]float64 `json:"values,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) MarshalJSON() ([]byte, error) { + niraf.OperatorType = OperatorTypeNumberInRange + objectMap := make(map[string]interface{}) + if niraf.Values != nil { + objectMap["values"] = niraf.Values + } + if niraf.Key != nil { + objectMap["key"] = niraf.Key + } + if niraf.OperatorType != "" { + objectMap["operatorType"] = niraf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return &niraf, true +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberInRangeAdvancedFilter. +func (niraf NumberInRangeAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &niraf, true +} + +// NumberLessThanAdvancedFilter numberLessThan Advanced Filter. +type NumberLessThanAdvancedFilter struct { + // Value - The filter value. + Value *float64 `json:"value,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) MarshalJSON() ([]byte, error) { + nltaf.OperatorType = OperatorTypeNumberLessThan + objectMap := make(map[string]interface{}) + if nltaf.Value != nil { + objectMap["value"] = nltaf.Value + } + if nltaf.Key != nil { + objectMap["key"] = nltaf.Key + } + if nltaf.OperatorType != "" { + objectMap["operatorType"] = nltaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return &nltaf, true +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanAdvancedFilter. +func (nltaf NumberLessThanAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &nltaf, true +} + +// NumberLessThanOrEqualsAdvancedFilter numberLessThanOrEquals Advanced Filter. +type NumberLessThanOrEqualsAdvancedFilter struct { + // Value - The filter value. + Value *float64 `json:"value,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) MarshalJSON() ([]byte, error) { + nltoeaf.OperatorType = OperatorTypeNumberLessThanOrEquals + objectMap := make(map[string]interface{}) + if nltoeaf.Value != nil { + objectMap["value"] = nltoeaf.Value + } + if nltoeaf.Key != nil { + objectMap["key"] = nltoeaf.Key + } + if nltoeaf.OperatorType != "" { + objectMap["operatorType"] = nltoeaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return &nltoeaf, true +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberLessThanOrEqualsAdvancedFilter. +func (nltoeaf NumberLessThanOrEqualsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &nltoeaf, true +} + +// NumberNotInAdvancedFilter numberNotIn Advanced Filter. +type NumberNotInAdvancedFilter struct { + // Values - The set of filter values. + Values *[]float64 `json:"values,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) MarshalJSON() ([]byte, error) { + nniaf.OperatorType = OperatorTypeNumberNotIn + objectMap := make(map[string]interface{}) + if nniaf.Values != nil { + objectMap["values"] = nniaf.Values + } + if nniaf.Key != nil { + objectMap["key"] = nniaf.Key + } + if nniaf.OperatorType != "" { + objectMap["operatorType"] = nniaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return &nniaf, true +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInAdvancedFilter. +func (nniaf NumberNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &nniaf, true +} + +// NumberNotInRangeAdvancedFilter numberNotInRange Advanced Filter. +type NumberNotInRangeAdvancedFilter struct { + // Values - The set of filter values. + Values *[][]float64 `json:"values,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) MarshalJSON() ([]byte, error) { + nniraf.OperatorType = OperatorTypeNumberNotInRange + objectMap := make(map[string]interface{}) + if nniraf.Values != nil { + objectMap["values"] = nniraf.Values + } + if nniraf.Key != nil { + objectMap["key"] = nniraf.Key + } + if nniraf.OperatorType != "" { + objectMap["operatorType"] = nniraf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return &nniraf, true +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for NumberNotInRangeAdvancedFilter. +func (nniraf NumberNotInRangeAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &nniraf, true +} + +// Operation represents an operation returned by the GetOperations request +type Operation struct { + // Name - Name of the operation + Name *string `json:"name,omitempty"` + // Display - Display name of the operation + Display *OperationInfo `json:"display,omitempty"` + // Origin - Origin of the operation + Origin *string `json:"origin,omitempty"` + // IsDataAction - This Boolean is used to determine if the operation is a data plane action or not. + IsDataAction *bool `json:"isDataAction,omitempty"` + // Properties - Properties of the operation + Properties interface{} `json:"properties,omitempty"` +} + +// OperationInfo information about an operation +type OperationInfo struct { + // Provider - Name of the provider + Provider *string `json:"provider,omitempty"` + // Resource - Name of the resource type + Resource *string `json:"resource,omitempty"` + // Operation - Name of the operation + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation + Description *string `json:"description,omitempty"` +} + +// OperationsListResult result of the List Operations operation +type OperationsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of operations + Value *[]Operation `json:"value,omitempty"` +} + +// PartnerNamespace eventGrid Partner Namespace. +type PartnerNamespace struct { + autorest.Response `json:"-"` + // PartnerNamespaceProperties - Properties of the partner namespace. + *PartnerNamespaceProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to Partner Namespace resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Location - Location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartnerNamespace. +func (pn PartnerNamespace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pn.PartnerNamespaceProperties != nil { + objectMap["properties"] = pn.PartnerNamespaceProperties + } + if pn.Location != nil { + objectMap["location"] = pn.Location + } + if pn.Tags != nil { + objectMap["tags"] = pn.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PartnerNamespace struct. +func (pn *PartnerNamespace) 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 partnerNamespaceProperties PartnerNamespaceProperties + err = json.Unmarshal(*v, &partnerNamespaceProperties) + if err != nil { + return err + } + pn.PartnerNamespaceProperties = &partnerNamespaceProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + pn.SystemData = &systemData + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pn.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pn.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pn.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pn.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pn.Type = &typeVar + } + } + } + + return nil +} + +// PartnerNamespaceProperties properties of the partner namespace. +type PartnerNamespaceProperties struct { + // PrivateEndpointConnections - READ-ONLY + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the partner namespace. Possible values include: 'PartnerNamespaceProvisioningStateCreating', 'PartnerNamespaceProvisioningStateUpdating', 'PartnerNamespaceProvisioningStateDeleting', 'PartnerNamespaceProvisioningStateSucceeded', 'PartnerNamespaceProvisioningStateCanceled', 'PartnerNamespaceProvisioningStateFailed' + ProvisioningState PartnerNamespaceProvisioningState `json:"provisioningState,omitempty"` + // PartnerRegistrationFullyQualifiedID - The fully qualified ARM Id of the partner registration that should be associated with this partner namespace. This takes the following format: + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}. + PartnerRegistrationFullyQualifiedID *string `json:"partnerRegistrationFullyQualifiedId,omitempty"` + // Endpoint - READ-ONLY; Endpoint for the partner namespace. + Endpoint *string `json:"endpoint,omitempty"` + // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. + // You can further restrict to specific IPs by configuring . Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` + // DisableLocalAuth - This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the partner namespace. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartnerNamespaceProperties. +func (pnp PartnerNamespaceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pnp.PartnerRegistrationFullyQualifiedID != nil { + objectMap["partnerRegistrationFullyQualifiedId"] = pnp.PartnerRegistrationFullyQualifiedID + } + if pnp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = pnp.PublicNetworkAccess + } + if pnp.InboundIPRules != nil { + objectMap["inboundIpRules"] = pnp.InboundIPRules + } + if pnp.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = pnp.DisableLocalAuth + } + return json.Marshal(objectMap) +} + +// PartnerNamespaceRegenerateKeyRequest partnerNamespace regenerate shared access key request. +type PartnerNamespaceRegenerateKeyRequest struct { + // KeyName - Key name to regenerate (key1 or key2). + KeyName *string `json:"keyName,omitempty"` +} + +// PartnerNamespacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PartnerNamespacesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PartnerNamespacesClient) (PartnerNamespace, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PartnerNamespacesCreateOrUpdateFuture) 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 PartnerNamespacesCreateOrUpdateFuture.Result. +func (future *PartnerNamespacesCreateOrUpdateFuture) result(client PartnerNamespacesClient) (pn PartnerNamespace, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pn.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerNamespacesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pn.Response.Response, err = future.GetResult(sender); err == nil && pn.Response.Response.StatusCode != http.StatusNoContent { + pn, err = client.CreateOrUpdateResponder(pn.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesCreateOrUpdateFuture", "Result", pn.Response.Response, "Failure responding to request") + } + } + return +} + +// PartnerNamespacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PartnerNamespacesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PartnerNamespacesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PartnerNamespacesDeleteFuture) 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 PartnerNamespacesDeleteFuture.Result. +func (future *PartnerNamespacesDeleteFuture) result(client PartnerNamespacesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerNamespacesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PartnerNamespaceSharedAccessKeys shared access keys of the partner namespace. +type PartnerNamespaceSharedAccessKeys struct { + autorest.Response `json:"-"` + // Key1 - Shared access key1 for the partner namespace. + Key1 *string `json:"key1,omitempty"` + // Key2 - Shared access key2 for the partner namespace. + Key2 *string `json:"key2,omitempty"` +} + +// PartnerNamespacesListResult result of the List Partner Namespaces operation +type PartnerNamespacesListResult struct { + autorest.Response `json:"-"` + // Value - A collection of partner namespaces. + Value *[]PartnerNamespace `json:"value,omitempty"` + // NextLink - A link for the next page of partner namespaces. + NextLink *string `json:"nextLink,omitempty"` +} + +// PartnerNamespacesListResultIterator provides access to a complete listing of PartnerNamespace values. +type PartnerNamespacesListResultIterator struct { + i int + page PartnerNamespacesListResultPage +} + +// 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 *PartnerNamespacesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesListResultIterator.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 *PartnerNamespacesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PartnerNamespacesListResultIterator) 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 PartnerNamespacesListResultIterator) Response() PartnerNamespacesListResult { + 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 PartnerNamespacesListResultIterator) Value() PartnerNamespace { + if !iter.page.NotDone() { + return PartnerNamespace{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PartnerNamespacesListResultIterator type. +func NewPartnerNamespacesListResultIterator(page PartnerNamespacesListResultPage) PartnerNamespacesListResultIterator { + return PartnerNamespacesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pnlr PartnerNamespacesListResult) IsEmpty() bool { + return pnlr.Value == nil || len(*pnlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pnlr PartnerNamespacesListResult) hasNextLink() bool { + return pnlr.NextLink != nil && len(*pnlr.NextLink) != 0 +} + +// partnerNamespacesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pnlr PartnerNamespacesListResult) partnerNamespacesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !pnlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pnlr.NextLink))) +} + +// PartnerNamespacesListResultPage contains a page of PartnerNamespace values. +type PartnerNamespacesListResultPage struct { + fn func(context.Context, PartnerNamespacesListResult) (PartnerNamespacesListResult, error) + pnlr PartnerNamespacesListResult +} + +// 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 *PartnerNamespacesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesListResultPage.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.pnlr) + if err != nil { + return err + } + page.pnlr = 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 *PartnerNamespacesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PartnerNamespacesListResultPage) NotDone() bool { + return !page.pnlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PartnerNamespacesListResultPage) Response() PartnerNamespacesListResult { + return page.pnlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PartnerNamespacesListResultPage) Values() []PartnerNamespace { + if page.pnlr.IsEmpty() { + return nil + } + return *page.pnlr.Value +} + +// Creates a new instance of the PartnerNamespacesListResultPage type. +func NewPartnerNamespacesListResultPage(cur PartnerNamespacesListResult, getNextPage func(context.Context, PartnerNamespacesListResult) (PartnerNamespacesListResult, error)) PartnerNamespacesListResultPage { + return PartnerNamespacesListResultPage{ + fn: getNextPage, + pnlr: cur, + } +} + +// PartnerNamespacesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PartnerNamespacesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PartnerNamespacesClient) (PartnerNamespace, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PartnerNamespacesUpdateFuture) 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 PartnerNamespacesUpdateFuture.Result. +func (future *PartnerNamespacesUpdateFuture) result(client PartnerNamespacesClient) (pn PartnerNamespace, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pn.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerNamespacesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pn.Response.Response, err = future.GetResult(sender); err == nil && pn.Response.Response.StatusCode != http.StatusNoContent { + pn, err = client.UpdateResponder(pn.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesUpdateFuture", "Result", pn.Response.Response, "Failure responding to request") + } + } + return +} + +// PartnerNamespaceUpdateParameterProperties information of Partner Namespace update parameter properties. +type PartnerNamespaceUpdateParameterProperties struct { + // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. + // You can further restrict to specific IPs by configuring . Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` + // DisableLocalAuth - This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the partner namespace. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` +} + +// PartnerNamespaceUpdateParameters properties of the PartnerNamespace update. +type PartnerNamespaceUpdateParameters struct { + // Tags - Tags of the partner namespace. + Tags map[string]*string `json:"tags"` + // PartnerNamespaceUpdateParameterProperties - Properties of the Partner Namespace. + *PartnerNamespaceUpdateParameterProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartnerNamespaceUpdateParameters. +func (pnup PartnerNamespaceUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pnup.Tags != nil { + objectMap["tags"] = pnup.Tags + } + if pnup.PartnerNamespaceUpdateParameterProperties != nil { + objectMap["properties"] = pnup.PartnerNamespaceUpdateParameterProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PartnerNamespaceUpdateParameters struct. +func (pnup *PartnerNamespaceUpdateParameters) 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 + } + pnup.Tags = tags + } + case "properties": + if v != nil { + var partnerNamespaceUpdateParameterProperties PartnerNamespaceUpdateParameterProperties + err = json.Unmarshal(*v, &partnerNamespaceUpdateParameterProperties) + if err != nil { + return err + } + pnup.PartnerNamespaceUpdateParameterProperties = &partnerNamespaceUpdateParameterProperties + } + } + } + + return nil +} + +// PartnerRegistration information about a partner registration. +type PartnerRegistration struct { + autorest.Response `json:"-"` + // PartnerRegistrationProperties - Properties of the partner registration. + *PartnerRegistrationProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to Partner Registration resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Location - Location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartnerRegistration. +func (pr PartnerRegistration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pr.PartnerRegistrationProperties != nil { + objectMap["properties"] = pr.PartnerRegistrationProperties + } + if pr.Location != nil { + objectMap["location"] = pr.Location + } + if pr.Tags != nil { + objectMap["tags"] = pr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PartnerRegistration struct. +func (pr *PartnerRegistration) 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 partnerRegistrationProperties PartnerRegistrationProperties + err = json.Unmarshal(*v, &partnerRegistrationProperties) + if err != nil { + return err + } + pr.PartnerRegistrationProperties = &partnerRegistrationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + pr.SystemData = &systemData + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pr.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pr.Type = &typeVar + } + } + } + + return nil +} + +// PartnerRegistrationProperties properties of the partner registration. +type PartnerRegistrationProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the partner registration. Possible values include: 'PartnerRegistrationProvisioningStateCreating', 'PartnerRegistrationProvisioningStateUpdating', 'PartnerRegistrationProvisioningStateDeleting', 'PartnerRegistrationProvisioningStateSucceeded', 'PartnerRegistrationProvisioningStateCanceled', 'PartnerRegistrationProvisioningStateFailed' + ProvisioningState PartnerRegistrationProvisioningState `json:"provisioningState,omitempty"` + // PartnerName - Official name of the partner name. For example: "Contoso". + PartnerName *string `json:"partnerName,omitempty"` + // PartnerResourceTypeName - Name of the partner resource type. + PartnerResourceTypeName *string `json:"partnerResourceTypeName,omitempty"` + // PartnerResourceTypeDisplayName - Display name of the partner resource type. + PartnerResourceTypeDisplayName *string `json:"partnerResourceTypeDisplayName,omitempty"` + // PartnerResourceTypeDescription - Short description of the partner resource type. The length of this description should not exceed 256 characters. + PartnerResourceTypeDescription *string `json:"partnerResourceTypeDescription,omitempty"` + // LongDescription - Long description for the custom scenarios and integration to be displayed in the portal if needed. + // Length of this description should not exceed 2048 characters. + LongDescription *string `json:"longDescription,omitempty"` + // PartnerCustomerServiceNumber - The customer service number of the publisher. The expected phone format should start with a '+' sign + // followed by the country code. The remaining digits are then followed. Only digits and spaces are allowed and its + // length cannot exceed 16 digits including country code. Examples of valid phone numbers are: +1 515 123 4567 and + // +966 7 5115 2471. Examples of invalid phone numbers are: +1 (515) 123-4567, 1 515 123 4567 and +966 121 5115 24 7 551 1234 43 + PartnerCustomerServiceNumber *string `json:"partnerCustomerServiceNumber,omitempty"` + // PartnerCustomerServiceExtension - The extension of the customer service number of the publisher. Only digits are allowed and number of digits should not exceed 10. + PartnerCustomerServiceExtension *string `json:"partnerCustomerServiceExtension,omitempty"` + // CustomerServiceURI - The extension of the customer service URI of the publisher. + CustomerServiceURI *string `json:"customerServiceUri,omitempty"` + // SetupURI - URI of the partner website that can be used by Azure customers to setup Event Grid + // integration on an event source. + SetupURI *string `json:"setupUri,omitempty"` + // LogoURI - URI of the logo. + LogoURI *string `json:"logoUri,omitempty"` + // VisibilityState - Visibility state of the partner registration. Possible values include: 'PartnerRegistrationVisibilityStateHidden', 'PartnerRegistrationVisibilityStatePublicPreview', 'PartnerRegistrationVisibilityStateGenerallyAvailable' + VisibilityState PartnerRegistrationVisibilityState `json:"visibilityState,omitempty"` + // AuthorizedAzureSubscriptionIds - List of Azure subscription Ids that are authorized to create a partner namespace + // associated with this partner registration. This is an optional property. Creating + // partner namespaces is always permitted under the same Azure subscription as the one used + // for creating the partner registration. + AuthorizedAzureSubscriptionIds *[]string `json:"authorizedAzureSubscriptionIds,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartnerRegistrationProperties. +func (prp PartnerRegistrationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if prp.PartnerName != nil { + objectMap["partnerName"] = prp.PartnerName + } + if prp.PartnerResourceTypeName != nil { + objectMap["partnerResourceTypeName"] = prp.PartnerResourceTypeName + } + if prp.PartnerResourceTypeDisplayName != nil { + objectMap["partnerResourceTypeDisplayName"] = prp.PartnerResourceTypeDisplayName + } + if prp.PartnerResourceTypeDescription != nil { + objectMap["partnerResourceTypeDescription"] = prp.PartnerResourceTypeDescription + } + if prp.LongDescription != nil { + objectMap["longDescription"] = prp.LongDescription + } + if prp.PartnerCustomerServiceNumber != nil { + objectMap["partnerCustomerServiceNumber"] = prp.PartnerCustomerServiceNumber + } + if prp.PartnerCustomerServiceExtension != nil { + objectMap["partnerCustomerServiceExtension"] = prp.PartnerCustomerServiceExtension + } + if prp.CustomerServiceURI != nil { + objectMap["customerServiceUri"] = prp.CustomerServiceURI + } + if prp.SetupURI != nil { + objectMap["setupUri"] = prp.SetupURI + } + if prp.LogoURI != nil { + objectMap["logoUri"] = prp.LogoURI + } + if prp.VisibilityState != "" { + objectMap["visibilityState"] = prp.VisibilityState + } + if prp.AuthorizedAzureSubscriptionIds != nil { + objectMap["authorizedAzureSubscriptionIds"] = prp.AuthorizedAzureSubscriptionIds + } + return json.Marshal(objectMap) +} + +// PartnerRegistrationsListResult result of the List Partner Registrations operation. +type PartnerRegistrationsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of partner registrations. + Value *[]PartnerRegistration `json:"value,omitempty"` + // NextLink - A link for the next page of partner registrations. + NextLink *string `json:"nextLink,omitempty"` +} + +// PartnerRegistrationsListResultIterator provides access to a complete listing of PartnerRegistration +// values. +type PartnerRegistrationsListResultIterator struct { + i int + page PartnerRegistrationsListResultPage +} + +// 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 *PartnerRegistrationsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsListResultIterator.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 *PartnerRegistrationsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PartnerRegistrationsListResultIterator) 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 PartnerRegistrationsListResultIterator) Response() PartnerRegistrationsListResult { + 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 PartnerRegistrationsListResultIterator) Value() PartnerRegistration { + if !iter.page.NotDone() { + return PartnerRegistration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PartnerRegistrationsListResultIterator type. +func NewPartnerRegistrationsListResultIterator(page PartnerRegistrationsListResultPage) PartnerRegistrationsListResultIterator { + return PartnerRegistrationsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (prlr PartnerRegistrationsListResult) IsEmpty() bool { + return prlr.Value == nil || len(*prlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (prlr PartnerRegistrationsListResult) hasNextLink() bool { + return prlr.NextLink != nil && len(*prlr.NextLink) != 0 +} + +// partnerRegistrationsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (prlr PartnerRegistrationsListResult) partnerRegistrationsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !prlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(prlr.NextLink))) +} + +// PartnerRegistrationsListResultPage contains a page of PartnerRegistration values. +type PartnerRegistrationsListResultPage struct { + fn func(context.Context, PartnerRegistrationsListResult) (PartnerRegistrationsListResult, error) + prlr PartnerRegistrationsListResult +} + +// 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 *PartnerRegistrationsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsListResultPage.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.prlr) + if err != nil { + return err + } + page.prlr = 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 *PartnerRegistrationsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PartnerRegistrationsListResultPage) NotDone() bool { + return !page.prlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PartnerRegistrationsListResultPage) Response() PartnerRegistrationsListResult { + return page.prlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PartnerRegistrationsListResultPage) Values() []PartnerRegistration { + if page.prlr.IsEmpty() { + return nil + } + return *page.prlr.Value +} + +// Creates a new instance of the PartnerRegistrationsListResultPage type. +func NewPartnerRegistrationsListResultPage(cur PartnerRegistrationsListResult, getNextPage func(context.Context, PartnerRegistrationsListResult) (PartnerRegistrationsListResult, error)) PartnerRegistrationsListResultPage { + return PartnerRegistrationsListResultPage{ + fn: getNextPage, + prlr: cur, + } +} + +// PartnerRegistrationUpdateParameters properties of the Partner Registration update. +type PartnerRegistrationUpdateParameters struct { + // Tags - Tags of the partner registration resource. + Tags map[string]*string `json:"tags"` + // PartnerTopicTypeName - Name of the partner topic type. + PartnerTopicTypeName *string `json:"partnerTopicTypeName,omitempty"` + // PartnerTopicTypeDisplayName - Display name of the partner topic type. + PartnerTopicTypeDisplayName *string `json:"partnerTopicTypeDisplayName,omitempty"` + // PartnerTopicTypeDescription - Description of the partner topic type. + PartnerTopicTypeDescription *string `json:"partnerTopicTypeDescription,omitempty"` + // SetupURI - URI of the partner website that can be used by Azure customers to setup Event Grid + // integration on an event source. + SetupURI *string `json:"setupUri,omitempty"` + // LogoURI - URI of the partner logo. + LogoURI *string `json:"logoUri,omitempty"` + // AuthorizedAzureSubscriptionIds - List of IDs of Azure AD applications that are authorized to create a partner namespace + // associated with this partner registration. This is an optional property. Creating + // partner namespaces is always permitted under the same Azure subscription as the one used + // for creating the partner registration. + AuthorizedAzureSubscriptionIds *[]string `json:"authorizedAzureSubscriptionIds,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartnerRegistrationUpdateParameters. +func (prup PartnerRegistrationUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if prup.Tags != nil { + objectMap["tags"] = prup.Tags + } + if prup.PartnerTopicTypeName != nil { + objectMap["partnerTopicTypeName"] = prup.PartnerTopicTypeName + } + if prup.PartnerTopicTypeDisplayName != nil { + objectMap["partnerTopicTypeDisplayName"] = prup.PartnerTopicTypeDisplayName + } + if prup.PartnerTopicTypeDescription != nil { + objectMap["partnerTopicTypeDescription"] = prup.PartnerTopicTypeDescription + } + if prup.SetupURI != nil { + objectMap["setupUri"] = prup.SetupURI + } + if prup.LogoURI != nil { + objectMap["logoUri"] = prup.LogoURI + } + if prup.AuthorizedAzureSubscriptionIds != nil { + objectMap["authorizedAzureSubscriptionIds"] = prup.AuthorizedAzureSubscriptionIds + } + return json.Marshal(objectMap) +} + +// PartnerTopic eventGrid Partner Topic. +type PartnerTopic struct { + autorest.Response `json:"-"` + // PartnerTopicProperties - Properties of the partner topic. + *PartnerTopicProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to Partner Topic resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Identity - Identity information for the Partner Topic resource. + Identity *IdentityInfo `json:"identity,omitempty"` + // Location - Location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartnerTopic. +func (pt PartnerTopic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pt.PartnerTopicProperties != nil { + objectMap["properties"] = pt.PartnerTopicProperties + } + if pt.Identity != nil { + objectMap["identity"] = pt.Identity + } + if pt.Location != nil { + objectMap["location"] = pt.Location + } + if pt.Tags != nil { + objectMap["tags"] = pt.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PartnerTopic struct. +func (pt *PartnerTopic) 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 partnerTopicProperties PartnerTopicProperties + err = json.Unmarshal(*v, &partnerTopicProperties) + if err != nil { + return err + } + pt.PartnerTopicProperties = &partnerTopicProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + pt.SystemData = &systemData + } + case "identity": + if v != nil { + var identity IdentityInfo + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + pt.Identity = &identity + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pt.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pt.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pt.Type = &typeVar + } + } + } + + return nil +} + +// PartnerTopicEventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type PartnerTopicEventSubscriptionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PartnerTopicEventSubscriptionsClient) (EventSubscription, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PartnerTopicEventSubscriptionsCreateOrUpdateFuture) 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 PartnerTopicEventSubscriptionsCreateOrUpdateFuture.Result. +func (future *PartnerTopicEventSubscriptionsCreateOrUpdateFuture) result(client PartnerTopicEventSubscriptionsClient) (es EventSubscription, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + es.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerTopicEventSubscriptionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { + es, err = client.CreateOrUpdateResponder(es.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") + } + } + return +} + +// PartnerTopicEventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PartnerTopicEventSubscriptionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PartnerTopicEventSubscriptionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PartnerTopicEventSubscriptionsDeleteFuture) 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 PartnerTopicEventSubscriptionsDeleteFuture.Result. +func (future *PartnerTopicEventSubscriptionsDeleteFuture) result(client PartnerTopicEventSubscriptionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerTopicEventSubscriptionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PartnerTopicEventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PartnerTopicEventSubscriptionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PartnerTopicEventSubscriptionsClient) (EventSubscription, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PartnerTopicEventSubscriptionsUpdateFuture) 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 PartnerTopicEventSubscriptionsUpdateFuture.Result. +func (future *PartnerTopicEventSubscriptionsUpdateFuture) result(client PartnerTopicEventSubscriptionsClient) (es EventSubscription, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + es.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerTopicEventSubscriptionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { + es, err = client.UpdateResponder(es.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") + } + } + return +} + +// PartnerTopicProperties properties of the Partner Topic. +type PartnerTopicProperties struct { + // Source - Source associated with this partner topic. This represents a unique partner resource. + Source *string `json:"source,omitempty"` + // ExpirationTimeIfNotActivatedUtc - Expiration time of the partner topic. If this timer expires while the partner topic is still never activated, + // the partner topic and corresponding event channel are deleted. + ExpirationTimeIfNotActivatedUtc *date.Time `json:"expirationTimeIfNotActivatedUtc,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the partner topic. Possible values include: 'PartnerTopicProvisioningStateCreating', 'PartnerTopicProvisioningStateUpdating', 'PartnerTopicProvisioningStateDeleting', 'PartnerTopicProvisioningStateSucceeded', 'PartnerTopicProvisioningStateCanceled', 'PartnerTopicProvisioningStateFailed' + ProvisioningState PartnerTopicProvisioningState `json:"provisioningState,omitempty"` + // ActivationState - Activation state of the partner topic. Possible values include: 'PartnerTopicActivationStateNeverActivated', 'PartnerTopicActivationStateActivated', 'PartnerTopicActivationStateDeactivated' + ActivationState PartnerTopicActivationState `json:"activationState,omitempty"` + // PartnerTopicFriendlyDescription - Friendly description about the topic. This can be set by the publisher/partner to show custom description for the customer partner topic. + // This will be helpful to remove any ambiguity of the origin of creation of the partner topic for the customer. + PartnerTopicFriendlyDescription *string `json:"partnerTopicFriendlyDescription,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartnerTopicProperties. +func (ptp PartnerTopicProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ptp.Source != nil { + objectMap["source"] = ptp.Source + } + if ptp.ExpirationTimeIfNotActivatedUtc != nil { + objectMap["expirationTimeIfNotActivatedUtc"] = ptp.ExpirationTimeIfNotActivatedUtc + } + if ptp.ActivationState != "" { + objectMap["activationState"] = ptp.ActivationState + } + if ptp.PartnerTopicFriendlyDescription != nil { + objectMap["partnerTopicFriendlyDescription"] = ptp.PartnerTopicFriendlyDescription + } + return json.Marshal(objectMap) +} + +// PartnerTopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PartnerTopicsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PartnerTopicsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PartnerTopicsDeleteFuture) 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 PartnerTopicsDeleteFuture.Result. +func (future *PartnerTopicsDeleteFuture) result(client PartnerTopicsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.PartnerTopicsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PartnerTopicsListResult result of the List Partner Topics operation. +type PartnerTopicsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of partner topics. + Value *[]PartnerTopic `json:"value,omitempty"` + // NextLink - A link for the next page of partner topics. + NextLink *string `json:"nextLink,omitempty"` +} + +// PartnerTopicsListResultIterator provides access to a complete listing of PartnerTopic values. +type PartnerTopicsListResultIterator struct { + i int + page PartnerTopicsListResultPage +} + +// 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 *PartnerTopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsListResultIterator.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 *PartnerTopicsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PartnerTopicsListResultIterator) 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 PartnerTopicsListResultIterator) Response() PartnerTopicsListResult { + 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 PartnerTopicsListResultIterator) Value() PartnerTopic { + if !iter.page.NotDone() { + return PartnerTopic{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PartnerTopicsListResultIterator type. +func NewPartnerTopicsListResultIterator(page PartnerTopicsListResultPage) PartnerTopicsListResultIterator { + return PartnerTopicsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ptlr PartnerTopicsListResult) IsEmpty() bool { + return ptlr.Value == nil || len(*ptlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ptlr PartnerTopicsListResult) hasNextLink() bool { + return ptlr.NextLink != nil && len(*ptlr.NextLink) != 0 +} + +// partnerTopicsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ptlr PartnerTopicsListResult) partnerTopicsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ptlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ptlr.NextLink))) +} + +// PartnerTopicsListResultPage contains a page of PartnerTopic values. +type PartnerTopicsListResultPage struct { + fn func(context.Context, PartnerTopicsListResult) (PartnerTopicsListResult, error) + ptlr PartnerTopicsListResult +} + +// 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 *PartnerTopicsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsListResultPage.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.ptlr) + if err != nil { + return err + } + page.ptlr = 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 *PartnerTopicsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PartnerTopicsListResultPage) NotDone() bool { + return !page.ptlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PartnerTopicsListResultPage) Response() PartnerTopicsListResult { + return page.ptlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PartnerTopicsListResultPage) Values() []PartnerTopic { + if page.ptlr.IsEmpty() { + return nil + } + return *page.ptlr.Value +} + +// Creates a new instance of the PartnerTopicsListResultPage type. +func NewPartnerTopicsListResultPage(cur PartnerTopicsListResult, getNextPage func(context.Context, PartnerTopicsListResult) (PartnerTopicsListResult, error)) PartnerTopicsListResultPage { + return PartnerTopicsListResultPage{ + fn: getNextPage, + ptlr: cur, + } +} + +// PartnerTopicUpdateParameters properties of the Partner Topic update. +type PartnerTopicUpdateParameters struct { + // Tags - Tags of the Partner Topic resource. + Tags map[string]*string `json:"tags"` + // Identity - Identity information for the Partner Topic resource. + Identity *IdentityInfo `json:"identity,omitempty"` +} + +// MarshalJSON is the custom marshaler for PartnerTopicUpdateParameters. +func (ptup PartnerTopicUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ptup.Tags != nil { + objectMap["tags"] = ptup.Tags + } + if ptup.Identity != nil { + objectMap["identity"] = ptup.Identity + } + return json.Marshal(objectMap) +} + +// PrivateEndpoint privateEndpoint information. +type PrivateEndpoint struct { + // ID - The ARM identifier for Private Endpoint. + ID *string `json:"id,omitempty"` +} + +// PrivateEndpointConnection ... +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnection. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + 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 result of the list of all private endpoint connections operation. +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - A collection of private endpoint connection resources. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - A link for the next page of private endpoint connection resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// 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 the private endpoint connection resource. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - The Private Endpoint resource for this Connection. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // GroupIds - GroupIds from the private link service resource. + GroupIds *[]string `json:"groupIds,omitempty"` + // PrivateLinkServiceConnectionState - Details about the state of the connection. + PrivateLinkServiceConnectionState *ConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - Provisioning state of the Private Endpoint Connection. Possible values include: 'ResourceProvisioningStateCreating', 'ResourceProvisioningStateUpdating', 'ResourceProvisioningStateDeleting', 'ResourceProvisioningStateSucceeded', 'ResourceProvisioningStateCanceled', 'ResourceProvisioningStateFailed' + ProvisioningState ResourceProvisioningState `json:"provisioningState,omitempty"` +} + +// 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, "eventgrid.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateEndpointConnectionsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsUpdateFuture 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 *PrivateEndpointConnectionsUpdateFuture) 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 PrivateEndpointConnectionsUpdateFuture.Result. +func (future *PrivateEndpointConnectionsUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.PrivateEndpointConnectionsUpdateFuture") + 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.UpdateResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkResource information of the private link resource. +type PrivateLinkResource struct { + autorest.Response `json:"-"` + // PrivateLinkResourceProperties - Properties of the private link resource. + *PrivateLinkResourceProperties `json:"properties,omitempty"` + // ID - Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - Name of the resource. + Name *string `json:"name,omitempty"` + // Type - Type of the resource. + 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 + } + if plr.ID != nil { + objectMap["id"] = plr.ID + } + if plr.Name != nil { + objectMap["name"] = plr.Name + } + if plr.Type != nil { + objectMap["type"] = plr.Type + } + 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 +} + +// PrivateLinkResourceProperties ... +type PrivateLinkResourceProperties struct { + GroupID *string `json:"groupId,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// PrivateLinkResourcesListResult result of the List private link resources operation. +type PrivateLinkResourcesListResult struct { + autorest.Response `json:"-"` + // Value - A collection of private link resources + Value *[]PrivateLinkResource `json:"value,omitempty"` + // NextLink - A link for the next page of private link resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// PrivateLinkResourcesListResultIterator provides access to a complete listing of PrivateLinkResource +// values. +type PrivateLinkResourcesListResultIterator struct { + i int + page PrivateLinkResourcesListResultPage +} + +// 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 *PrivateLinkResourcesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesListResultIterator.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 *PrivateLinkResourcesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateLinkResourcesListResultIterator) 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 PrivateLinkResourcesListResultIterator) Response() PrivateLinkResourcesListResult { + 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 PrivateLinkResourcesListResultIterator) Value() PrivateLinkResource { + if !iter.page.NotDone() { + return PrivateLinkResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateLinkResourcesListResultIterator type. +func NewPrivateLinkResourcesListResultIterator(page PrivateLinkResourcesListResultPage) PrivateLinkResourcesListResultIterator { + return PrivateLinkResourcesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plrlr PrivateLinkResourcesListResult) IsEmpty() bool { + return plrlr.Value == nil || len(*plrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plrlr PrivateLinkResourcesListResult) hasNextLink() bool { + return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 +} + +// privateLinkResourcesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plrlr PrivateLinkResourcesListResult) privateLinkResourcesListResultPreparer(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))) +} + +// PrivateLinkResourcesListResultPage contains a page of PrivateLinkResource values. +type PrivateLinkResourcesListResultPage struct { + fn func(context.Context, PrivateLinkResourcesListResult) (PrivateLinkResourcesListResult, error) + plrlr PrivateLinkResourcesListResult +} + +// 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 *PrivateLinkResourcesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesListResultPage.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 *PrivateLinkResourcesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateLinkResourcesListResultPage) NotDone() bool { + return !page.plrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateLinkResourcesListResultPage) Response() PrivateLinkResourcesListResult { + return page.plrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateLinkResourcesListResultPage) Values() []PrivateLinkResource { + if page.plrlr.IsEmpty() { + return nil + } + return *page.plrlr.Value +} + +// Creates a new instance of the PrivateLinkResourcesListResultPage type. +func NewPrivateLinkResourcesListResultPage(cur PrivateLinkResourcesListResult, getNextPage func(context.Context, PrivateLinkResourcesListResult) (PrivateLinkResourcesListResult, error)) PrivateLinkResourcesListResultPage { + return PrivateLinkResourcesListResultPage{ + fn: getNextPage, + plrlr: cur, + } +} + +// Resource definition of a Resource +type Resource struct { + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + 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) +} + +// ResourceSku describes an EventGrid Resource Sku. +type ResourceSku struct { + // Name - The Sku name of the resource. The possible values are: Basic or Premium. Possible values include: 'SkuBasic', 'SkuPremium' + Name Sku `json:"name,omitempty"` +} + +// RetryPolicy information about the retry policy for an event subscription. +type RetryPolicy struct { + // MaxDeliveryAttempts - Maximum number of delivery retry attempts for events. + MaxDeliveryAttempts *int32 `json:"maxDeliveryAttempts,omitempty"` + // EventTimeToLiveInMinutes - Time To Live (in minutes) for events. + EventTimeToLiveInMinutes *int32 `json:"eventTimeToLiveInMinutes,omitempty"` +} + +// ServiceBusQueueEventSubscriptionDestination information about the service bus destination for an event +// subscription. +type ServiceBusQueueEventSubscriptionDestination struct { + // ServiceBusQueueEventSubscriptionDestinationProperties - Service Bus Properties of the event subscription destination. + *ServiceBusQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceBusQueueEventSubscriptionDestination. +func (sbqesd ServiceBusQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + sbqesd.EndpointType = EndpointTypeServiceBusQueue + objectMap := make(map[string]interface{}) + if sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties != nil { + objectMap["properties"] = sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties + } + if sbqesd.EndpointType != "" { + objectMap["endpointType"] = sbqesd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. +func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. +func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return nil, false +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. +func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. +func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. +func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { + return &sbqesd, true +} + +// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. +func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { + return nil, false +} + +// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. +func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. +func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return nil, false +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusQueueEventSubscriptionDestination. +func (sbqesd ServiceBusQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &sbqesd, true +} + +// UnmarshalJSON is the custom unmarshaler for ServiceBusQueueEventSubscriptionDestination struct. +func (sbqesd *ServiceBusQueueEventSubscriptionDestination) 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 serviceBusQueueEventSubscriptionDestinationProperties ServiceBusQueueEventSubscriptionDestinationProperties + err = json.Unmarshal(*v, &serviceBusQueueEventSubscriptionDestinationProperties) + if err != nil { + return err + } + sbqesd.ServiceBusQueueEventSubscriptionDestinationProperties = &serviceBusQueueEventSubscriptionDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointType + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + sbqesd.EndpointType = endpointType + } + } + } + + return nil +} + +// ServiceBusQueueEventSubscriptionDestinationProperties the properties that represent the Service Bus +// destination of an event subscription. +type ServiceBusQueueEventSubscriptionDestinationProperties struct { + // ResourceID - The Azure Resource Id that represents the endpoint of the Service Bus destination of an event subscription. + ResourceID *string `json:"resourceId,omitempty"` + // DeliveryAttributeMappings - Delivery attribute details. + DeliveryAttributeMappings *[]BasicDeliveryAttributeMapping `json:"deliveryAttributeMappings,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ServiceBusQueueEventSubscriptionDestinationProperties struct. +func (sbqesdp *ServiceBusQueueEventSubscriptionDestinationProperties) 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 "resourceId": + if v != nil { + var resourceID string + err = json.Unmarshal(*v, &resourceID) + if err != nil { + return err + } + sbqesdp.ResourceID = &resourceID + } + case "deliveryAttributeMappings": + if v != nil { + deliveryAttributeMappings, err := unmarshalBasicDeliveryAttributeMappingArray(*v) + if err != nil { + return err + } + sbqesdp.DeliveryAttributeMappings = &deliveryAttributeMappings + } + } + } + + return nil +} + +// ServiceBusTopicEventSubscriptionDestination information about the service bus topic destination for an +// event subscription. +type ServiceBusTopicEventSubscriptionDestination struct { + // ServiceBusTopicEventSubscriptionDestinationProperties - Service Bus Topic Properties of the event subscription destination. + *ServiceBusTopicEventSubscriptionDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceBusTopicEventSubscriptionDestination. +func (sbtesd ServiceBusTopicEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + sbtesd.EndpointType = EndpointTypeServiceBusTopic + objectMap := make(map[string]interface{}) + if sbtesd.ServiceBusTopicEventSubscriptionDestinationProperties != nil { + objectMap["properties"] = sbtesd.ServiceBusTopicEventSubscriptionDestinationProperties + } + if sbtesd.EndpointType != "" { + objectMap["endpointType"] = sbtesd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. +func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. +func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return nil, false +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. +func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. +func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. +func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. +func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { + return &sbtesd, true +} + +// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. +func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. +func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return nil, false +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for ServiceBusTopicEventSubscriptionDestination. +func (sbtesd ServiceBusTopicEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &sbtesd, true +} + +// UnmarshalJSON is the custom unmarshaler for ServiceBusTopicEventSubscriptionDestination struct. +func (sbtesd *ServiceBusTopicEventSubscriptionDestination) 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 serviceBusTopicEventSubscriptionDestinationProperties ServiceBusTopicEventSubscriptionDestinationProperties + err = json.Unmarshal(*v, &serviceBusTopicEventSubscriptionDestinationProperties) + if err != nil { + return err + } + sbtesd.ServiceBusTopicEventSubscriptionDestinationProperties = &serviceBusTopicEventSubscriptionDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointType + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + sbtesd.EndpointType = endpointType + } + } + } + + return nil +} + +// ServiceBusTopicEventSubscriptionDestinationProperties the properties that represent the Service Bus +// Topic destination of an event subscription. +type ServiceBusTopicEventSubscriptionDestinationProperties struct { + // ResourceID - The Azure Resource Id that represents the endpoint of the Service Bus Topic destination of an event subscription. + ResourceID *string `json:"resourceId,omitempty"` + // DeliveryAttributeMappings - Delivery attribute details. + DeliveryAttributeMappings *[]BasicDeliveryAttributeMapping `json:"deliveryAttributeMappings,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ServiceBusTopicEventSubscriptionDestinationProperties struct. +func (sbtesdp *ServiceBusTopicEventSubscriptionDestinationProperties) 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 "resourceId": + if v != nil { + var resourceID string + err = json.Unmarshal(*v, &resourceID) + if err != nil { + return err + } + sbtesdp.ResourceID = &resourceID + } + case "deliveryAttributeMappings": + if v != nil { + deliveryAttributeMappings, err := unmarshalBasicDeliveryAttributeMappingArray(*v) + if err != nil { + return err + } + sbtesdp.DeliveryAttributeMappings = &deliveryAttributeMappings + } + } + } + + return nil +} + +// StaticDeliveryAttributeMapping static delivery attribute mapping details. +type StaticDeliveryAttributeMapping struct { + // StaticDeliveryAttributeMappingProperties - Properties of static delivery attribute mapping. + *StaticDeliveryAttributeMappingProperties `json:"properties,omitempty"` + // Name - Name of the delivery attribute or header. + Name *string `json:"name,omitempty"` + // Type - Possible values include: 'TypeDeliveryAttributeMapping', 'TypeStatic', 'TypeDynamic' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StaticDeliveryAttributeMapping. +func (sdam StaticDeliveryAttributeMapping) MarshalJSON() ([]byte, error) { + sdam.Type = TypeStatic + objectMap := make(map[string]interface{}) + if sdam.StaticDeliveryAttributeMappingProperties != nil { + objectMap["properties"] = sdam.StaticDeliveryAttributeMappingProperties + } + if sdam.Name != nil { + objectMap["name"] = sdam.Name + } + if sdam.Type != "" { + objectMap["type"] = sdam.Type + } + return json.Marshal(objectMap) +} + +// AsStaticDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for StaticDeliveryAttributeMapping. +func (sdam StaticDeliveryAttributeMapping) AsStaticDeliveryAttributeMapping() (*StaticDeliveryAttributeMapping, bool) { + return &sdam, true +} + +// AsDynamicDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for StaticDeliveryAttributeMapping. +func (sdam StaticDeliveryAttributeMapping) AsDynamicDeliveryAttributeMapping() (*DynamicDeliveryAttributeMapping, bool) { + return nil, false +} + +// AsDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for StaticDeliveryAttributeMapping. +func (sdam StaticDeliveryAttributeMapping) AsDeliveryAttributeMapping() (*DeliveryAttributeMapping, bool) { + return nil, false +} + +// AsBasicDeliveryAttributeMapping is the BasicDeliveryAttributeMapping implementation for StaticDeliveryAttributeMapping. +func (sdam StaticDeliveryAttributeMapping) AsBasicDeliveryAttributeMapping() (BasicDeliveryAttributeMapping, bool) { + return &sdam, true +} + +// UnmarshalJSON is the custom unmarshaler for StaticDeliveryAttributeMapping struct. +func (sdam *StaticDeliveryAttributeMapping) 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 staticDeliveryAttributeMappingProperties StaticDeliveryAttributeMappingProperties + err = json.Unmarshal(*v, &staticDeliveryAttributeMappingProperties) + if err != nil { + return err + } + sdam.StaticDeliveryAttributeMappingProperties = &staticDeliveryAttributeMappingProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sdam.Name = &name + } + case "type": + if v != nil { + var typeVar Type + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sdam.Type = typeVar + } + } + } + + return nil +} + +// StaticDeliveryAttributeMappingProperties properties of static delivery attribute mapping. +type StaticDeliveryAttributeMappingProperties struct { + // Value - Value of the delivery attribute. + Value *string `json:"value,omitempty"` + // IsSecret - Boolean flag to tell if the attribute contains sensitive information . + IsSecret *bool `json:"isSecret,omitempty"` +} + +// StorageBlobDeadLetterDestination information about the storage blob based dead letter destination. +type StorageBlobDeadLetterDestination struct { + // StorageBlobDeadLetterDestinationProperties - The properties of the Storage Blob based deadletter destination + *StorageBlobDeadLetterDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeBasicDeadLetterDestinationEndpointTypeDeadLetterDestination', 'EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob' + EndpointType EndpointTypeBasicDeadLetterDestination `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageBlobDeadLetterDestination. +func (sbdld StorageBlobDeadLetterDestination) MarshalJSON() ([]byte, error) { + sbdld.EndpointType = EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob + objectMap := make(map[string]interface{}) + if sbdld.StorageBlobDeadLetterDestinationProperties != nil { + objectMap["properties"] = sbdld.StorageBlobDeadLetterDestinationProperties + } + if sbdld.EndpointType != "" { + objectMap["endpointType"] = sbdld.EndpointType + } + return json.Marshal(objectMap) +} + +// AsStorageBlobDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. +func (sbdld StorageBlobDeadLetterDestination) AsStorageBlobDeadLetterDestination() (*StorageBlobDeadLetterDestination, bool) { + return &sbdld, true +} + +// AsDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. +func (sbdld StorageBlobDeadLetterDestination) AsDeadLetterDestination() (*DeadLetterDestination, bool) { + return nil, false +} + +// AsBasicDeadLetterDestination is the BasicDeadLetterDestination implementation for StorageBlobDeadLetterDestination. +func (sbdld StorageBlobDeadLetterDestination) AsBasicDeadLetterDestination() (BasicDeadLetterDestination, bool) { + return &sbdld, true +} + +// UnmarshalJSON is the custom unmarshaler for StorageBlobDeadLetterDestination struct. +func (sbdld *StorageBlobDeadLetterDestination) 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 storageBlobDeadLetterDestinationProperties StorageBlobDeadLetterDestinationProperties + err = json.Unmarshal(*v, &storageBlobDeadLetterDestinationProperties) + if err != nil { + return err + } + sbdld.StorageBlobDeadLetterDestinationProperties = &storageBlobDeadLetterDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointTypeBasicDeadLetterDestination + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + sbdld.EndpointType = endpointType + } + } + } + + return nil +} + +// StorageBlobDeadLetterDestinationProperties properties of the storage blob based dead letter destination. +type StorageBlobDeadLetterDestinationProperties struct { + // ResourceID - The Azure Resource ID of the storage account that is the destination of the deadletter events + ResourceID *string `json:"resourceId,omitempty"` + // BlobContainerName - The name of the Storage blob container that is the destination of the deadletter events + BlobContainerName *string `json:"blobContainerName,omitempty"` +} + +// StorageQueueEventSubscriptionDestination information about the storage queue destination for an event +// subscription. +type StorageQueueEventSubscriptionDestination struct { + // StorageQueueEventSubscriptionDestinationProperties - Storage Queue Properties of the event subscription destination. + *StorageQueueEventSubscriptionDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + sqesd.EndpointType = EndpointTypeStorageQueue + objectMap := make(map[string]interface{}) + if sqesd.StorageQueueEventSubscriptionDestinationProperties != nil { + objectMap["properties"] = sqesd.StorageQueueEventSubscriptionDestinationProperties + } + if sqesd.EndpointType != "" { + objectMap["endpointType"] = sqesd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return nil, false +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return &sqesd, true +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { + return nil, false +} + +// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return nil, false +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for StorageQueueEventSubscriptionDestination. +func (sqesd StorageQueueEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &sqesd, true +} + +// UnmarshalJSON is the custom unmarshaler for StorageQueueEventSubscriptionDestination struct. +func (sqesd *StorageQueueEventSubscriptionDestination) 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 storageQueueEventSubscriptionDestinationProperties StorageQueueEventSubscriptionDestinationProperties + err = json.Unmarshal(*v, &storageQueueEventSubscriptionDestinationProperties) + if err != nil { + return err + } + sqesd.StorageQueueEventSubscriptionDestinationProperties = &storageQueueEventSubscriptionDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointType + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + sqesd.EndpointType = endpointType + } + } + } + + return nil +} + +// StorageQueueEventSubscriptionDestinationProperties the properties for a storage queue destination. +type StorageQueueEventSubscriptionDestinationProperties struct { + // ResourceID - The Azure Resource ID of the storage account that contains the queue that is the destination of an event subscription. + ResourceID *string `json:"resourceId,omitempty"` + // QueueName - The name of the Storage queue under a storage account that is the destination of an event subscription. + QueueName *string `json:"queueName,omitempty"` + // QueueMessageTimeToLiveInSeconds - Storage queue message time to live in seconds. + QueueMessageTimeToLiveInSeconds *int64 `json:"queueMessageTimeToLiveInSeconds,omitempty"` +} + +// StringBeginsWithAdvancedFilter stringBeginsWith Advanced Filter. +type StringBeginsWithAdvancedFilter struct { + // Values - The set of filter values. + Values *[]string `json:"values,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { + sbwaf.OperatorType = OperatorTypeStringBeginsWith + objectMap := make(map[string]interface{}) + if sbwaf.Values != nil { + objectMap["values"] = sbwaf.Values + } + if sbwaf.Key != nil { + objectMap["key"] = sbwaf.Key + } + if sbwaf.OperatorType != "" { + objectMap["operatorType"] = sbwaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return &sbwaf, true +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringBeginsWithAdvancedFilter. +func (sbwaf StringBeginsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &sbwaf, true +} + +// StringContainsAdvancedFilter stringContains Advanced Filter. +type StringContainsAdvancedFilter struct { + // Values - The set of filter values. + Values *[]string `json:"values,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) MarshalJSON() ([]byte, error) { + scaf.OperatorType = OperatorTypeStringContains + objectMap := make(map[string]interface{}) + if scaf.Values != nil { + objectMap["values"] = scaf.Values + } + if scaf.Key != nil { + objectMap["key"] = scaf.Key + } + if scaf.OperatorType != "" { + objectMap["operatorType"] = scaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return &scaf, true +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringContainsAdvancedFilter. +func (scaf StringContainsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &scaf, true +} + +// StringEndsWithAdvancedFilter stringEndsWith Advanced Filter. +type StringEndsWithAdvancedFilter struct { + // Values - The set of filter values. + Values *[]string `json:"values,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { + sewaf.OperatorType = OperatorTypeStringEndsWith + objectMap := make(map[string]interface{}) + if sewaf.Values != nil { + objectMap["values"] = sewaf.Values + } + if sewaf.Key != nil { + objectMap["key"] = sewaf.Key + } + if sewaf.OperatorType != "" { + objectMap["operatorType"] = sewaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return &sewaf, true +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringEndsWithAdvancedFilter. +func (sewaf StringEndsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &sewaf, true +} + +// StringInAdvancedFilter stringIn Advanced Filter. +type StringInAdvancedFilter struct { + // Values - The set of filter values. + Values *[]string `json:"values,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) MarshalJSON() ([]byte, error) { + siaf.OperatorType = OperatorTypeStringIn + objectMap := make(map[string]interface{}) + if siaf.Values != nil { + objectMap["values"] = siaf.Values + } + if siaf.Key != nil { + objectMap["key"] = siaf.Key + } + if siaf.OperatorType != "" { + objectMap["operatorType"] = siaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return &siaf, true +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringInAdvancedFilter. +func (siaf StringInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &siaf, true +} + +// StringNotBeginsWithAdvancedFilter stringNotBeginsWith Advanced Filter. +type StringNotBeginsWithAdvancedFilter struct { + // Values - The set of filter values. + Values *[]string `json:"values,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { + snbwaf.OperatorType = OperatorTypeStringNotBeginsWith + objectMap := make(map[string]interface{}) + if snbwaf.Values != nil { + objectMap["values"] = snbwaf.Values + } + if snbwaf.Key != nil { + objectMap["key"] = snbwaf.Key + } + if snbwaf.OperatorType != "" { + objectMap["operatorType"] = snbwaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return &snbwaf, true +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotBeginsWithAdvancedFilter. +func (snbwaf StringNotBeginsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &snbwaf, true +} + +// StringNotContainsAdvancedFilter stringNotContains Advanced Filter. +type StringNotContainsAdvancedFilter struct { + // Values - The set of filter values. + Values *[]string `json:"values,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) MarshalJSON() ([]byte, error) { + sncaf.OperatorType = OperatorTypeStringNotContains + objectMap := make(map[string]interface{}) + if sncaf.Values != nil { + objectMap["values"] = sncaf.Values + } + if sncaf.Key != nil { + objectMap["key"] = sncaf.Key + } + if sncaf.OperatorType != "" { + objectMap["operatorType"] = sncaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return &sncaf, true +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotContainsAdvancedFilter. +func (sncaf StringNotContainsAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &sncaf, true +} + +// StringNotEndsWithAdvancedFilter stringNotEndsWith Advanced Filter. +type StringNotEndsWithAdvancedFilter struct { + // Values - The set of filter values. + Values *[]string `json:"values,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { + snewaf.OperatorType = OperatorTypeStringNotEndsWith + objectMap := make(map[string]interface{}) + if snewaf.Values != nil { + objectMap["values"] = snewaf.Values + } + if snewaf.Key != nil { + objectMap["key"] = snewaf.Key + } + if snewaf.OperatorType != "" { + objectMap["operatorType"] = snewaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return nil, false +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return &snewaf, true +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotEndsWithAdvancedFilter. +func (snewaf StringNotEndsWithAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &snewaf, true +} + +// StringNotInAdvancedFilter stringNotIn Advanced Filter. +type StringNotInAdvancedFilter struct { + // Values - The set of filter values. + Values *[]string `json:"values,omitempty"` + // Key - The field/property in the event based on which you want to filter. + Key *string `json:"key,omitempty"` + // OperatorType - Possible values include: 'OperatorTypeAdvancedFilter', 'OperatorTypeNumberIn', 'OperatorTypeNumberNotIn', 'OperatorTypeNumberLessThan', 'OperatorTypeNumberGreaterThan', 'OperatorTypeNumberLessThanOrEquals', 'OperatorTypeNumberGreaterThanOrEquals', 'OperatorTypeBoolEquals', 'OperatorTypeStringIn', 'OperatorTypeStringNotIn', 'OperatorTypeStringBeginsWith', 'OperatorTypeStringEndsWith', 'OperatorTypeStringContains', 'OperatorTypeNumberInRange', 'OperatorTypeNumberNotInRange', 'OperatorTypeStringNotBeginsWith', 'OperatorTypeStringNotEndsWith', 'OperatorTypeStringNotContains', 'OperatorTypeIsNullOrUndefined', 'OperatorTypeIsNotNull' + OperatorType OperatorType `json:"operatorType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) MarshalJSON() ([]byte, error) { + sniaf.OperatorType = OperatorTypeStringNotIn + objectMap := make(map[string]interface{}) + if sniaf.Values != nil { + objectMap["values"] = sniaf.Values + } + if sniaf.Key != nil { + objectMap["key"] = sniaf.Key + } + if sniaf.OperatorType != "" { + objectMap["operatorType"] = sniaf.OperatorType + } + return json.Marshal(objectMap) +} + +// AsNumberInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberInAdvancedFilter() (*NumberInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberNotInAdvancedFilter() (*NumberNotInAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberLessThanAdvancedFilter() (*NumberLessThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanAdvancedFilter() (*NumberGreaterThanAdvancedFilter, bool) { + return nil, false +} + +// AsNumberLessThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberLessThanOrEqualsAdvancedFilter() (*NumberLessThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberGreaterThanOrEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberGreaterThanOrEqualsAdvancedFilter() (*NumberGreaterThanOrEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsBoolEqualsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsBoolEqualsAdvancedFilter() (*BoolEqualsAdvancedFilter, bool) { + return nil, false +} + +// AsStringInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringInAdvancedFilter() (*StringInAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotInAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringNotInAdvancedFilter() (*StringNotInAdvancedFilter, bool) { + return &sniaf, true +} + +// AsStringBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringBeginsWithAdvancedFilter() (*StringBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringEndsWithAdvancedFilter() (*StringEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringContainsAdvancedFilter() (*StringContainsAdvancedFilter, bool) { + return nil, false +} + +// AsNumberInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberInRangeAdvancedFilter() (*NumberInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsNumberNotInRangeAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsNumberNotInRangeAdvancedFilter() (*NumberNotInRangeAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotBeginsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringNotBeginsWithAdvancedFilter() (*StringNotBeginsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotEndsWithAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringNotEndsWithAdvancedFilter() (*StringNotEndsWithAdvancedFilter, bool) { + return nil, false +} + +// AsStringNotContainsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsStringNotContainsAdvancedFilter() (*StringNotContainsAdvancedFilter, bool) { + return nil, false +} + +// AsIsNullOrUndefinedAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsIsNullOrUndefinedAdvancedFilter() (*IsNullOrUndefinedAdvancedFilter, bool) { + return nil, false +} + +// AsIsNotNullAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsIsNotNullAdvancedFilter() (*IsNotNullAdvancedFilter, bool) { + return nil, false +} + +// AsAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsAdvancedFilter() (*AdvancedFilter, bool) { + return nil, false +} + +// AsBasicAdvancedFilter is the BasicAdvancedFilter implementation for StringNotInAdvancedFilter. +func (sniaf StringNotInAdvancedFilter) AsBasicAdvancedFilter() (BasicAdvancedFilter, bool) { + return &sniaf, true +} + +// 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"` +} + +// SystemTopic eventGrid System Topic. +type SystemTopic struct { + autorest.Response `json:"-"` + // SystemTopicProperties - Properties of the system topic. + *SystemTopicProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to System Topic resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Identity - Identity information for the resource. + Identity *IdentityInfo `json:"identity,omitempty"` + // Location - Location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SystemTopic. +func (st SystemTopic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if st.SystemTopicProperties != nil { + objectMap["properties"] = st.SystemTopicProperties + } + if st.Identity != nil { + objectMap["identity"] = st.Identity + } + if st.Location != nil { + objectMap["location"] = st.Location + } + if st.Tags != nil { + objectMap["tags"] = st.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SystemTopic struct. +func (st *SystemTopic) 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 systemTopicProperties SystemTopicProperties + err = json.Unmarshal(*v, &systemTopicProperties) + if err != nil { + return err + } + st.SystemTopicProperties = &systemTopicProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + st.SystemData = &systemData + } + case "identity": + if v != nil { + var identity IdentityInfo + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + st.Identity = &identity + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + st.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + st.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + st.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + st.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + st.Type = &typeVar + } + } + } + + return nil +} + +// SystemTopicEventSubscriptionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type SystemTopicEventSubscriptionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SystemTopicEventSubscriptionsClient) (EventSubscription, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SystemTopicEventSubscriptionsCreateOrUpdateFuture) 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 SystemTopicEventSubscriptionsCreateOrUpdateFuture.Result. +func (future *SystemTopicEventSubscriptionsCreateOrUpdateFuture) result(client SystemTopicEventSubscriptionsClient) (es EventSubscription, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + es.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicEventSubscriptionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { + es, err = client.CreateOrUpdateResponder(es.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsCreateOrUpdateFuture", "Result", es.Response.Response, "Failure responding to request") + } + } + return +} + +// SystemTopicEventSubscriptionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SystemTopicEventSubscriptionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SystemTopicEventSubscriptionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SystemTopicEventSubscriptionsDeleteFuture) 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 SystemTopicEventSubscriptionsDeleteFuture.Result. +func (future *SystemTopicEventSubscriptionsDeleteFuture) result(client SystemTopicEventSubscriptionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicEventSubscriptionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SystemTopicEventSubscriptionsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SystemTopicEventSubscriptionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SystemTopicEventSubscriptionsClient) (EventSubscription, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SystemTopicEventSubscriptionsUpdateFuture) 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 SystemTopicEventSubscriptionsUpdateFuture.Result. +func (future *SystemTopicEventSubscriptionsUpdateFuture) result(client SystemTopicEventSubscriptionsClient) (es EventSubscription, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + es.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicEventSubscriptionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if es.Response.Response, err = future.GetResult(sender); err == nil && es.Response.Response.StatusCode != http.StatusNoContent { + es, err = client.UpdateResponder(es.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsUpdateFuture", "Result", es.Response.Response, "Failure responding to request") + } + } + return +} + +// SystemTopicProperties properties of the System Topic. +type SystemTopicProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the system topic. Possible values include: 'ResourceProvisioningStateCreating', 'ResourceProvisioningStateUpdating', 'ResourceProvisioningStateDeleting', 'ResourceProvisioningStateSucceeded', 'ResourceProvisioningStateCanceled', 'ResourceProvisioningStateFailed' + ProvisioningState ResourceProvisioningState `json:"provisioningState,omitempty"` + // Source - Source for the system topic. + Source *string `json:"source,omitempty"` + // TopicType - TopicType for the system topic. + TopicType *string `json:"topicType,omitempty"` + // MetricResourceID - READ-ONLY; Metric resource id for the system topic. + MetricResourceID *string `json:"metricResourceId,omitempty"` +} + +// MarshalJSON is the custom marshaler for SystemTopicProperties. +func (stp SystemTopicProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if stp.Source != nil { + objectMap["source"] = stp.Source + } + if stp.TopicType != nil { + objectMap["topicType"] = stp.TopicType + } + return json.Marshal(objectMap) +} + +// SystemTopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SystemTopicsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SystemTopicsClient) (SystemTopic, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SystemTopicsCreateOrUpdateFuture) 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 SystemTopicsCreateOrUpdateFuture.Result. +func (future *SystemTopicsCreateOrUpdateFuture) result(client SystemTopicsClient) (st SystemTopic, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + st.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if st.Response.Response, err = future.GetResult(sender); err == nil && st.Response.Response.StatusCode != http.StatusNoContent { + st, err = client.CreateOrUpdateResponder(st.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsCreateOrUpdateFuture", "Result", st.Response.Response, "Failure responding to request") + } + } + return +} + +// SystemTopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SystemTopicsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SystemTopicsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SystemTopicsDeleteFuture) 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 SystemTopicsDeleteFuture.Result. +func (future *SystemTopicsDeleteFuture) result(client SystemTopicsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SystemTopicsListResult result of the List System topics operation. +type SystemTopicsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of system Topics. + Value *[]SystemTopic `json:"value,omitempty"` + // NextLink - A link for the next page of topics. + NextLink *string `json:"nextLink,omitempty"` +} + +// SystemTopicsListResultIterator provides access to a complete listing of SystemTopic values. +type SystemTopicsListResultIterator struct { + i int + page SystemTopicsListResultPage +} + +// 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 *SystemTopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsListResultIterator.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 *SystemTopicsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SystemTopicsListResultIterator) 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 SystemTopicsListResultIterator) Response() SystemTopicsListResult { + 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 SystemTopicsListResultIterator) Value() SystemTopic { + if !iter.page.NotDone() { + return SystemTopic{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SystemTopicsListResultIterator type. +func NewSystemTopicsListResultIterator(page SystemTopicsListResultPage) SystemTopicsListResultIterator { + return SystemTopicsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (stlr SystemTopicsListResult) IsEmpty() bool { + return stlr.Value == nil || len(*stlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (stlr SystemTopicsListResult) hasNextLink() bool { + return stlr.NextLink != nil && len(*stlr.NextLink) != 0 +} + +// systemTopicsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (stlr SystemTopicsListResult) systemTopicsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !stlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(stlr.NextLink))) +} + +// SystemTopicsListResultPage contains a page of SystemTopic values. +type SystemTopicsListResultPage struct { + fn func(context.Context, SystemTopicsListResult) (SystemTopicsListResult, error) + stlr SystemTopicsListResult +} + +// 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 *SystemTopicsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsListResultPage.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.stlr) + if err != nil { + return err + } + page.stlr = 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 *SystemTopicsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SystemTopicsListResultPage) NotDone() bool { + return !page.stlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SystemTopicsListResultPage) Response() SystemTopicsListResult { + return page.stlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SystemTopicsListResultPage) Values() []SystemTopic { + if page.stlr.IsEmpty() { + return nil + } + return *page.stlr.Value +} + +// Creates a new instance of the SystemTopicsListResultPage type. +func NewSystemTopicsListResultPage(cur SystemTopicsListResult, getNextPage func(context.Context, SystemTopicsListResult) (SystemTopicsListResult, error)) SystemTopicsListResultPage { + return SystemTopicsListResultPage{ + fn: getNextPage, + stlr: cur, + } +} + +// SystemTopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SystemTopicsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SystemTopicsClient) (SystemTopic, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SystemTopicsUpdateFuture) 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 SystemTopicsUpdateFuture.Result. +func (future *SystemTopicsUpdateFuture) result(client SystemTopicsClient) (st SystemTopic, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + st.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.SystemTopicsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if st.Response.Response, err = future.GetResult(sender); err == nil && st.Response.Response.StatusCode != http.StatusNoContent { + st, err = client.UpdateResponder(st.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsUpdateFuture", "Result", st.Response.Response, "Failure responding to request") + } + } + return +} + +// SystemTopicUpdateParameters properties of the System Topic update. +type SystemTopicUpdateParameters struct { + // Tags - Tags of the system topic. + Tags map[string]*string `json:"tags"` + // Identity - Resource identity information. + Identity *IdentityInfo `json:"identity,omitempty"` +} + +// MarshalJSON is the custom marshaler for SystemTopicUpdateParameters. +func (stup SystemTopicUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if stup.Tags != nil { + objectMap["tags"] = stup.Tags + } + if stup.Identity != nil { + objectMap["identity"] = stup.Identity + } + return json.Marshal(objectMap) +} + +// Topic eventGrid Topic +type Topic struct { + autorest.Response `json:"-"` + // TopicProperties - Properties of the topic. + *TopicProperties `json:"properties,omitempty"` + // Sku - The Sku pricing tier for the topic. + Sku *ResourceSku `json:"sku,omitempty"` + // Identity - Identity information for the resource. + Identity *IdentityInfo `json:"identity,omitempty"` + // Kind - Kind of the resource. Possible values include: 'ResourceKindAzure', 'ResourceKindAzureArc' + Kind ResourceKind `json:"kind,omitempty"` + // ExtendedLocation - Extended location of the resource. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to Topic resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Location - Location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Topic. +func (t Topic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.TopicProperties != nil { + objectMap["properties"] = t.TopicProperties + } + if t.Sku != nil { + objectMap["sku"] = t.Sku + } + if t.Identity != nil { + objectMap["identity"] = t.Identity + } + if t.Kind != "" { + objectMap["kind"] = t.Kind + } + if t.ExtendedLocation != nil { + objectMap["extendedLocation"] = t.ExtendedLocation + } + if t.Location != nil { + objectMap["location"] = t.Location + } + if t.Tags != nil { + objectMap["tags"] = t.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Topic struct. +func (t *Topic) 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 topicProperties TopicProperties + err = json.Unmarshal(*v, &topicProperties) + if err != nil { + return err + } + t.TopicProperties = &topicProperties + } + case "sku": + if v != nil { + var sku ResourceSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + t.Sku = &sku + } + case "identity": + if v != nil { + var identity IdentityInfo + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + t.Identity = &identity + } + case "kind": + if v != nil { + var kind ResourceKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + t.Kind = kind + } + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + t.ExtendedLocation = &extendedLocation + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + t.SystemData = &systemData + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + t.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + t.Tags = tags + } + 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 +} + +// TopicProperties properties of the Topic. +type TopicProperties struct { + // PrivateEndpointConnections - READ-ONLY + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the topic. Possible values include: 'TopicProvisioningStateCreating', 'TopicProvisioningStateUpdating', 'TopicProvisioningStateDeleting', 'TopicProvisioningStateSucceeded', 'TopicProvisioningStateCanceled', 'TopicProvisioningStateFailed' + ProvisioningState TopicProvisioningState `json:"provisioningState,omitempty"` + // Endpoint - READ-ONLY; Endpoint for the topic. + Endpoint *string `json:"endpoint,omitempty"` + // InputSchema - This determines the format that Event Grid should expect for incoming events published to the topic. Possible values include: 'InputSchemaEventGridSchema', 'InputSchemaCustomEventSchema', 'InputSchemaCloudEventSchemaV10' + InputSchema InputSchema `json:"inputSchema,omitempty"` + // InputSchemaMapping - This enables publishing using custom event schemas. An InputSchemaMapping can be specified to map various properties of a source schema to various required properties of the EventGridEvent schema. + InputSchemaMapping BasicInputSchemaMapping `json:"inputSchemaMapping,omitempty"` + // MetricResourceID - READ-ONLY; Metric resource id for the topic. + MetricResourceID *string `json:"metricResourceId,omitempty"` + // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. + // You can further restrict to specific IPs by configuring . Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` + // DisableLocalAuth - This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the topic. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` +} + +// MarshalJSON is the custom marshaler for TopicProperties. +func (tp TopicProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tp.InputSchema != "" { + objectMap["inputSchema"] = tp.InputSchema + } + objectMap["inputSchemaMapping"] = tp.InputSchemaMapping + if tp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = tp.PublicNetworkAccess + } + if tp.InboundIPRules != nil { + objectMap["inboundIpRules"] = tp.InboundIPRules + } + if tp.DisableLocalAuth != nil { + objectMap["disableLocalAuth"] = tp.DisableLocalAuth + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TopicProperties struct. +func (tp *TopicProperties) 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 "privateEndpointConnections": + if v != nil { + var privateEndpointConnections []PrivateEndpointConnection + err = json.Unmarshal(*v, &privateEndpointConnections) + if err != nil { + return err + } + tp.PrivateEndpointConnections = &privateEndpointConnections + } + case "provisioningState": + if v != nil { + var provisioningState TopicProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + tp.ProvisioningState = provisioningState + } + case "endpoint": + if v != nil { + var endpoint string + err = json.Unmarshal(*v, &endpoint) + if err != nil { + return err + } + tp.Endpoint = &endpoint + } + case "inputSchema": + if v != nil { + var inputSchema InputSchema + err = json.Unmarshal(*v, &inputSchema) + if err != nil { + return err + } + tp.InputSchema = inputSchema + } + case "inputSchemaMapping": + if v != nil { + inputSchemaMapping, err := unmarshalBasicInputSchemaMapping(*v) + if err != nil { + return err + } + tp.InputSchemaMapping = inputSchemaMapping + } + case "metricResourceId": + if v != nil { + var metricResourceID string + err = json.Unmarshal(*v, &metricResourceID) + if err != nil { + return err + } + tp.MetricResourceID = &metricResourceID + } + case "publicNetworkAccess": + if v != nil { + var publicNetworkAccess PublicNetworkAccess + err = json.Unmarshal(*v, &publicNetworkAccess) + if err != nil { + return err + } + tp.PublicNetworkAccess = publicNetworkAccess + } + case "inboundIpRules": + if v != nil { + var inboundIPRules []InboundIPRule + err = json.Unmarshal(*v, &inboundIPRules) + if err != nil { + return err + } + tp.InboundIPRules = &inboundIPRules + } + case "disableLocalAuth": + if v != nil { + var disableLocalAuth bool + err = json.Unmarshal(*v, &disableLocalAuth) + if err != nil { + return err + } + tp.DisableLocalAuth = &disableLocalAuth + } + } + } + + return nil +} + +// TopicRegenerateKeyRequest topic regenerate share access key request +type TopicRegenerateKeyRequest struct { + // KeyName - Key name to regenerate key1 or key2 + KeyName *string `json:"keyName,omitempty"` +} + +// TopicsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TopicsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TopicsClient) (Topic, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TopicsCreateOrUpdateFuture) 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 TopicsCreateOrUpdateFuture.Result. +func (future *TopicsCreateOrUpdateFuture) result(client TopicsClient) (t Topic, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + t.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { + t, err = client.CreateOrUpdateResponder(t.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsCreateOrUpdateFuture", "Result", t.Response.Response, "Failure responding to request") + } + } + return +} + +// TopicsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TopicsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TopicsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TopicsDeleteFuture) 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 TopicsDeleteFuture.Result. +func (future *TopicsDeleteFuture) result(client TopicsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// TopicSharedAccessKeys shared access keys of the Topic +type TopicSharedAccessKeys struct { + autorest.Response `json:"-"` + // Key1 - Shared access key1 for the topic. + Key1 *string `json:"key1,omitempty"` + // Key2 - Shared access key2 for the topic. + Key2 *string `json:"key2,omitempty"` +} + +// TopicsListResult result of the List Topics operation +type TopicsListResult struct { + autorest.Response `json:"-"` + // Value - A collection of Topics + Value *[]Topic `json:"value,omitempty"` + // NextLink - A link for the next page of topics + NextLink *string `json:"nextLink,omitempty"` +} + +// TopicsListResultIterator provides access to a complete listing of Topic values. +type TopicsListResultIterator struct { + i int + page TopicsListResultPage +} + +// 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 *TopicsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsListResultIterator.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 *TopicsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TopicsListResultIterator) 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 TopicsListResultIterator) Response() TopicsListResult { + 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 TopicsListResultIterator) Value() Topic { + if !iter.page.NotDone() { + return Topic{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TopicsListResultIterator type. +func NewTopicsListResultIterator(page TopicsListResultPage) TopicsListResultIterator { + return TopicsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (tlr TopicsListResult) IsEmpty() bool { + return tlr.Value == nil || len(*tlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (tlr TopicsListResult) hasNextLink() bool { + return tlr.NextLink != nil && len(*tlr.NextLink) != 0 +} + +// topicsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tlr TopicsListResult) topicsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !tlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(tlr.NextLink))) +} + +// TopicsListResultPage contains a page of Topic values. +type TopicsListResultPage struct { + fn func(context.Context, TopicsListResult) (TopicsListResult, error) + tlr TopicsListResult +} + +// 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 *TopicsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsListResultPage.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.tlr) + if err != nil { + return err + } + page.tlr = 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 *TopicsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TopicsListResultPage) NotDone() bool { + return !page.tlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TopicsListResultPage) Response() TopicsListResult { + return page.tlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TopicsListResultPage) Values() []Topic { + if page.tlr.IsEmpty() { + return nil + } + return *page.tlr.Value +} + +// Creates a new instance of the TopicsListResultPage type. +func NewTopicsListResultPage(cur TopicsListResult, getNextPage func(context.Context, TopicsListResult) (TopicsListResult, error)) TopicsListResultPage { + return TopicsListResultPage{ + fn: getNextPage, + tlr: cur, + } +} + +// TopicsRegenerateKeyFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TopicsRegenerateKeyFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TopicsClient) (TopicSharedAccessKeys, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TopicsRegenerateKeyFuture) 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 TopicsRegenerateKeyFuture.Result. +func (future *TopicsRegenerateKeyFuture) result(client TopicsClient) (tsak TopicSharedAccessKeys, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsRegenerateKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + tsak.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsRegenerateKeyFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tsak.Response.Response, err = future.GetResult(sender); err == nil && tsak.Response.Response.StatusCode != http.StatusNoContent { + tsak, err = client.RegenerateKeyResponder(tsak.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsRegenerateKeyFuture", "Result", tsak.Response.Response, "Failure responding to request") + } + } + return +} + +// TopicsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TopicsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TopicsClient) (Topic, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TopicsUpdateFuture) 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 TopicsUpdateFuture.Result. +func (future *TopicsUpdateFuture) result(client TopicsClient) (t Topic, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + t.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("eventgrid.TopicsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if t.Response.Response, err = future.GetResult(sender); err == nil && t.Response.Response.StatusCode != http.StatusNoContent { + t, err = client.UpdateResponder(t.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsUpdateFuture", "Result", t.Response.Response, "Failure responding to request") + } + } + return +} + +// TopicTypeInfo properties of a topic type info. +type TopicTypeInfo struct { + autorest.Response `json:"-"` + // TopicTypeProperties - Properties of the topic type info + *TopicTypeProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TopicTypeInfo. +func (tti TopicTypeInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tti.TopicTypeProperties != nil { + objectMap["properties"] = tti.TopicTypeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TopicTypeInfo struct. +func (tti *TopicTypeInfo) 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 topicTypeProperties TopicTypeProperties + err = json.Unmarshal(*v, &topicTypeProperties) + if err != nil { + return err + } + tti.TopicTypeProperties = &topicTypeProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tti.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tti.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tti.Type = &typeVar + } + } + } + + return nil +} + +// TopicTypeProperties properties of a topic type. +type TopicTypeProperties struct { + // Provider - Namespace of the provider of the topic type. + Provider *string `json:"provider,omitempty"` + // DisplayName - Display Name for the topic type. + DisplayName *string `json:"displayName,omitempty"` + // Description - Description of the topic type. + Description *string `json:"description,omitempty"` + // ResourceRegionType - Region type of the resource. Possible values include: 'ResourceRegionTypeRegionalResource', 'ResourceRegionTypeGlobalResource' + ResourceRegionType ResourceRegionType `json:"resourceRegionType,omitempty"` + // ProvisioningState - Provisioning state of the topic type. Possible values include: 'TopicTypeProvisioningStateCreating', 'TopicTypeProvisioningStateUpdating', 'TopicTypeProvisioningStateDeleting', 'TopicTypeProvisioningStateSucceeded', 'TopicTypeProvisioningStateCanceled', 'TopicTypeProvisioningStateFailed' + ProvisioningState TopicTypeProvisioningState `json:"provisioningState,omitempty"` + // SupportedLocations - List of locations supported by this topic type. + SupportedLocations *[]string `json:"supportedLocations,omitempty"` + // SourceResourceFormat - Source resource format. + SourceResourceFormat *string `json:"sourceResourceFormat,omitempty"` + // SupportedScopesForSource - Supported source scopes. + SupportedScopesForSource *[]string `json:"supportedScopesForSource,omitempty"` +} + +// TopicTypesListResult result of the List Topic Types operation +type TopicTypesListResult struct { + autorest.Response `json:"-"` + // Value - A collection of topic types + Value *[]TopicTypeInfo `json:"value,omitempty"` +} + +// TopicUpdateParameterProperties information of topic update parameter properties. +type TopicUpdateParameterProperties struct { + // PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. + // You can further restrict to specific IPs by configuring . Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // InboundIPRules - This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. + InboundIPRules *[]InboundIPRule `json:"inboundIpRules,omitempty"` + // DisableLocalAuth - This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate if user is allowed to publish to the topic. + DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` +} + +// TopicUpdateParameters properties of the Topic update +type TopicUpdateParameters struct { + // Tags - Tags of the Topic resource. + Tags map[string]*string `json:"tags"` + // Identity - Topic resource identity information. + Identity *IdentityInfo `json:"identity,omitempty"` + // TopicUpdateParameterProperties - Properties of the Topic resource. + *TopicUpdateParameterProperties `json:"properties,omitempty"` + // Sku - The Sku pricing tier for the topic. + Sku *ResourceSku `json:"sku,omitempty"` +} + +// MarshalJSON is the custom marshaler for TopicUpdateParameters. +func (tup TopicUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tup.Tags != nil { + objectMap["tags"] = tup.Tags + } + if tup.Identity != nil { + objectMap["identity"] = tup.Identity + } + if tup.TopicUpdateParameterProperties != nil { + objectMap["properties"] = tup.TopicUpdateParameterProperties + } + if tup.Sku != nil { + objectMap["sku"] = tup.Sku + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TopicUpdateParameters struct. +func (tup *TopicUpdateParameters) 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 + } + tup.Tags = tags + } + case "identity": + if v != nil { + var identity IdentityInfo + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + tup.Identity = &identity + } + case "properties": + if v != nil { + var topicUpdateParameterProperties TopicUpdateParameterProperties + err = json.Unmarshal(*v, &topicUpdateParameterProperties) + if err != nil { + return err + } + tup.TopicUpdateParameterProperties = &topicUpdateParameterProperties + } + case "sku": + if v != nil { + var sku ResourceSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + tup.Sku = &sku + } + } + } + + return nil +} + +// TrackedResource definition of a Tracked Resource. +type TrackedResource struct { + // Location - Location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified identifier of the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the resource. + 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.Location != nil { + objectMap["location"] = tr.Location + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + return json.Marshal(objectMap) +} + +// UserIdentityProperties the information about the user identity. +type UserIdentityProperties struct { + // PrincipalID - The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// WebHookEventSubscriptionDestination information about the webhook destination for an event subscription. +type WebHookEventSubscriptionDestination struct { + // WebHookEventSubscriptionDestinationProperties - WebHook Properties of the event subscription destination. + *WebHookEventSubscriptionDestinationProperties `json:"properties,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeEventSubscriptionDestination', 'EndpointTypeWebHook', 'EndpointTypeEventHub', 'EndpointTypeStorageQueue', 'EndpointTypeHybridConnection', 'EndpointTypeServiceBusQueue', 'EndpointTypeServiceBusTopic', 'EndpointTypeAzureFunction' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) MarshalJSON() ([]byte, error) { + whesd.EndpointType = EndpointTypeWebHook + objectMap := make(map[string]interface{}) + if whesd.WebHookEventSubscriptionDestinationProperties != nil { + objectMap["properties"] = whesd.WebHookEventSubscriptionDestinationProperties + } + if whesd.EndpointType != "" { + objectMap["endpointType"] = whesd.EndpointType + } + return json.Marshal(objectMap) +} + +// AsWebHookEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsWebHookEventSubscriptionDestination() (*WebHookEventSubscriptionDestination, bool) { + return &whesd, true +} + +// AsEventHubEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsEventHubEventSubscriptionDestination() (*EventHubEventSubscriptionDestination, bool) { + return nil, false +} + +// AsStorageQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsStorageQueueEventSubscriptionDestination() (*StorageQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsHybridConnectionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsHybridConnectionEventSubscriptionDestination() (*HybridConnectionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusQueueEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsServiceBusQueueEventSubscriptionDestination() (*ServiceBusQueueEventSubscriptionDestination, bool) { + return nil, false +} + +// AsServiceBusTopicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsServiceBusTopicEventSubscriptionDestination() (*ServiceBusTopicEventSubscriptionDestination, bool) { + return nil, false +} + +// AsAzureFunctionEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsAzureFunctionEventSubscriptionDestination() (*AzureFunctionEventSubscriptionDestination, bool) { + return nil, false +} + +// AsEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsEventSubscriptionDestination() (*EventSubscriptionDestination, bool) { + return nil, false +} + +// AsBasicEventSubscriptionDestination is the BasicEventSubscriptionDestination implementation for WebHookEventSubscriptionDestination. +func (whesd WebHookEventSubscriptionDestination) AsBasicEventSubscriptionDestination() (BasicEventSubscriptionDestination, bool) { + return &whesd, true +} + +// UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestination struct. +func (whesd *WebHookEventSubscriptionDestination) 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 webHookEventSubscriptionDestinationProperties WebHookEventSubscriptionDestinationProperties + err = json.Unmarshal(*v, &webHookEventSubscriptionDestinationProperties) + if err != nil { + return err + } + whesd.WebHookEventSubscriptionDestinationProperties = &webHookEventSubscriptionDestinationProperties + } + case "endpointType": + if v != nil { + var endpointType EndpointType + err = json.Unmarshal(*v, &endpointType) + if err != nil { + return err + } + whesd.EndpointType = endpointType + } + } + } + + return nil +} + +// WebHookEventSubscriptionDestinationProperties information about the webhook destination properties for +// an event subscription. +type WebHookEventSubscriptionDestinationProperties struct { + // EndpointURL - The URL that represents the endpoint of the destination of an event subscription. + EndpointURL *string `json:"endpointUrl,omitempty"` + // EndpointBaseURL - READ-ONLY; The base URL that represents the endpoint of the destination of an event subscription. + EndpointBaseURL *string `json:"endpointBaseUrl,omitempty"` + // MaxEventsPerBatch - Maximum number of events per batch. + MaxEventsPerBatch *int32 `json:"maxEventsPerBatch,omitempty"` + // PreferredBatchSizeInKilobytes - Preferred batch size in Kilobytes. + PreferredBatchSizeInKilobytes *int32 `json:"preferredBatchSizeInKilobytes,omitempty"` + // AzureActiveDirectoryTenantID - The Azure Active Directory Tenant ID to get the access token that will be included as the bearer token in delivery requests. + AzureActiveDirectoryTenantID *string `json:"azureActiveDirectoryTenantId,omitempty"` + // AzureActiveDirectoryApplicationIDOrURI - The Azure Active Directory Application ID or URI to get the access token that will be included as the bearer token in delivery requests. + AzureActiveDirectoryApplicationIDOrURI *string `json:"azureActiveDirectoryApplicationIdOrUri,omitempty"` + // DeliveryAttributeMappings - Delivery attribute details. + DeliveryAttributeMappings *[]BasicDeliveryAttributeMapping `json:"deliveryAttributeMappings,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebHookEventSubscriptionDestinationProperties. +func (whesdp WebHookEventSubscriptionDestinationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if whesdp.EndpointURL != nil { + objectMap["endpointUrl"] = whesdp.EndpointURL + } + if whesdp.MaxEventsPerBatch != nil { + objectMap["maxEventsPerBatch"] = whesdp.MaxEventsPerBatch + } + if whesdp.PreferredBatchSizeInKilobytes != nil { + objectMap["preferredBatchSizeInKilobytes"] = whesdp.PreferredBatchSizeInKilobytes + } + if whesdp.AzureActiveDirectoryTenantID != nil { + objectMap["azureActiveDirectoryTenantId"] = whesdp.AzureActiveDirectoryTenantID + } + if whesdp.AzureActiveDirectoryApplicationIDOrURI != nil { + objectMap["azureActiveDirectoryApplicationIdOrUri"] = whesdp.AzureActiveDirectoryApplicationIDOrURI + } + if whesdp.DeliveryAttributeMappings != nil { + objectMap["deliveryAttributeMappings"] = whesdp.DeliveryAttributeMappings + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WebHookEventSubscriptionDestinationProperties struct. +func (whesdp *WebHookEventSubscriptionDestinationProperties) 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 "endpointUrl": + if v != nil { + var endpointURL string + err = json.Unmarshal(*v, &endpointURL) + if err != nil { + return err + } + whesdp.EndpointURL = &endpointURL + } + case "endpointBaseUrl": + if v != nil { + var endpointBaseURL string + err = json.Unmarshal(*v, &endpointBaseURL) + if err != nil { + return err + } + whesdp.EndpointBaseURL = &endpointBaseURL + } + case "maxEventsPerBatch": + if v != nil { + var maxEventsPerBatch int32 + err = json.Unmarshal(*v, &maxEventsPerBatch) + if err != nil { + return err + } + whesdp.MaxEventsPerBatch = &maxEventsPerBatch + } + case "preferredBatchSizeInKilobytes": + if v != nil { + var preferredBatchSizeInKilobytes int32 + err = json.Unmarshal(*v, &preferredBatchSizeInKilobytes) + if err != nil { + return err + } + whesdp.PreferredBatchSizeInKilobytes = &preferredBatchSizeInKilobytes + } + case "azureActiveDirectoryTenantId": + if v != nil { + var azureActiveDirectoryTenantID string + err = json.Unmarshal(*v, &azureActiveDirectoryTenantID) + if err != nil { + return err + } + whesdp.AzureActiveDirectoryTenantID = &azureActiveDirectoryTenantID + } + case "azureActiveDirectoryApplicationIdOrUri": + if v != nil { + var azureActiveDirectoryApplicationIDOrURI string + err = json.Unmarshal(*v, &azureActiveDirectoryApplicationIDOrURI) + if err != nil { + return err + } + whesdp.AzureActiveDirectoryApplicationIDOrURI = &azureActiveDirectoryApplicationIDOrURI + } + case "deliveryAttributeMappings": + if v != nil { + deliveryAttributeMappings, err := unmarshalBasicDeliveryAttributeMappingArray(*v) + if err != nil { + return err + } + whesdp.DeliveryAttributeMappings = &deliveryAttributeMappings + } + } + } + + return nil +} diff --git a/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/operations.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/operations.go new file mode 100644 index 000000000000..f790b2ff2279 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/operations.go @@ -0,0 +1,98 @@ +package eventgrid + +// 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 azure EventGrid 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 list the available operations supported by the Microsoft.EventGrid resource provider. +func (client OperationsClient) List(ctx context.Context) (result OperationsListResult, 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, "eventgrid.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, "eventgrid.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.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 = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.EventGrid/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 OperationsListResult, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/partnernamespaces.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/partnernamespaces.go new file mode 100644 index 000000000000..6e5045b0f6d9 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/partnernamespaces.go @@ -0,0 +1,768 @@ +package eventgrid + +// 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" +) + +// PartnerNamespacesClient is the azure EventGrid Management Client +type PartnerNamespacesClient struct { + BaseClient +} + +// NewPartnerNamespacesClient creates an instance of the PartnerNamespacesClient client. +func NewPartnerNamespacesClient(subscriptionID string) PartnerNamespacesClient { + return NewPartnerNamespacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPartnerNamespacesClientWithBaseURI creates an instance of the PartnerNamespacesClient 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 NewPartnerNamespacesClientWithBaseURI(baseURI string, subscriptionID string) PartnerNamespacesClient { + return PartnerNamespacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate asynchronously creates a new partner namespace with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerNamespaceName - name of the partner namespace. +// partnerNamespaceInfo - partnerNamespace information. +func (client PartnerNamespacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo PartnerNamespace) (result PartnerNamespacesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, partnerNamespaceName, partnerNamespaceInfo) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PartnerNamespacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo PartnerNamespace) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + partnerNamespaceInfo.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.EventGrid/partnerNamespaces/{partnerNamespaceName}", pathParameters), + autorest.WithJSON(partnerNamespaceInfo), + 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 PartnerNamespacesClient) CreateOrUpdateSender(req *http.Request) (future PartnerNamespacesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PartnerNamespacesClient) CreateOrUpdateResponder(resp *http.Response) (result PartnerNamespace, 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 existing partner namespace. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerNamespaceName - name of the partner namespace. +func (client PartnerNamespacesClient) Delete(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result PartnerNamespacesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, partnerNamespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PartnerNamespacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}", 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 PartnerNamespacesClient) DeleteSender(req *http.Request) (future PartnerNamespacesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PartnerNamespacesClient) 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 get properties of a partner namespace. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerNamespaceName - name of the partner namespace. +func (client PartnerNamespacesClient) Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result PartnerNamespace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, partnerNamespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PartnerNamespacesClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}", 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 PartnerNamespacesClient) 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 PartnerNamespacesClient) GetResponder(resp *http.Response) (result PartnerNamespace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list all the partner namespaces under a resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client PartnerNamespacesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerNamespacesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.pnlr.Response.Response != nil { + sc = result.pnlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.pnlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.pnlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.pnlr.hasNextLink() && result.pnlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client PartnerNamespacesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces", 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 PartnerNamespacesClient) 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 PartnerNamespacesClient) ListByResourceGroupResponder(resp *http.Response) (result PartnerNamespacesListResult, 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 PartnerNamespacesClient) listByResourceGroupNextResults(ctx context.Context, lastResults PartnerNamespacesListResult) (result PartnerNamespacesListResult, err error) { + req, err := lastResults.partnerNamespacesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "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, "eventgrid.PartnerNamespacesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client PartnerNamespacesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerNamespacesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.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, filter, top) + return +} + +// ListBySubscription list all the partner namespaces under an Azure subscription. +// Parameters: +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client PartnerNamespacesClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result PartnerNamespacesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.ListBySubscription") + defer func() { + sc := -1 + if result.pnlr.Response.Response != nil { + sc = result.pnlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.pnlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.pnlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.pnlr.hasNextLink() && result.pnlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client PartnerNamespacesClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerNamespaces", 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 PartnerNamespacesClient) 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 PartnerNamespacesClient) ListBySubscriptionResponder(resp *http.Response) (result PartnerNamespacesListResult, 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 PartnerNamespacesClient) listBySubscriptionNextResults(ctx context.Context, lastResults PartnerNamespacesListResult) (result PartnerNamespacesListResult, err error) { + req, err := lastResults.partnerNamespacesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "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, "eventgrid.PartnerNamespacesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client PartnerNamespacesClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result PartnerNamespacesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.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, filter, top) + return +} + +// ListSharedAccessKeys list the two keys used to publish to a partner namespace. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerNamespaceName - name of the partner namespace. +func (client PartnerNamespacesClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (result PartnerNamespaceSharedAccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.ListSharedAccessKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, partnerNamespaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListSharedAccessKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListSharedAccessKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListSharedAccessKeys", resp, "Failure sending request") + return + } + + result, err = client.ListSharedAccessKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "ListSharedAccessKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. +func (client PartnerNamespacesClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the +// http.Response Body if it receives an error. +func (client PartnerNamespacesClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always +// closes the http.Response Body. +func (client PartnerNamespacesClient) ListSharedAccessKeysResponder(resp *http.Response) (result PartnerNamespaceSharedAccessKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerate a shared access key for a partner namespace. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerNamespaceName - name of the partner namespace. +// regenerateKeyRequest - request body to regenerate key. +func (client PartnerNamespacesClient) RegenerateKey(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest PartnerNamespaceRegenerateKeyRequest) (result PartnerNamespaceSharedAccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.RegenerateKey") + 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: regenerateKeyRequest, + Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("eventgrid.PartnerNamespacesClient", "RegenerateKey", err.Error()) + } + + req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, partnerNamespaceName, regenerateKeyRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "RegenerateKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "RegenerateKey", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client PartnerNamespacesClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest PartnerNamespaceRegenerateKeyRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/regenerateKey", pathParameters), + autorest.WithJSON(regenerateKeyRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client PartnerNamespacesClient) RegenerateKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client PartnerNamespacesClient) RegenerateKeyResponder(resp *http.Response) (result PartnerNamespaceSharedAccessKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update asynchronously updates a partner namespace with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerNamespaceName - name of the partner namespace. +// partnerNamespaceUpdateParameters - partner namespace update information. +func (client PartnerNamespacesClient) Update(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters PartnerNamespaceUpdateParameters) (result PartnerNamespacesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerNamespacesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, partnerNamespaceName, partnerNamespaceUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerNamespacesClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PartnerNamespacesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters PartnerNamespaceUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerNamespaceName": autorest.Encode("path", partnerNamespaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}", pathParameters), + autorest.WithJSON(partnerNamespaceUpdateParameters), + 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 PartnerNamespacesClient) UpdateSender(req *http.Request) (future PartnerNamespacesUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PartnerNamespacesClient) UpdateResponder(resp *http.Response) (result PartnerNamespace, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/partnerregistrations.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/partnerregistrations.go new file mode 100644 index 000000000000..d078614dd570 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/partnerregistrations.go @@ -0,0 +1,600 @@ +package eventgrid + +// 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" +) + +// PartnerRegistrationsClient is the azure EventGrid Management Client +type PartnerRegistrationsClient struct { + BaseClient +} + +// NewPartnerRegistrationsClient creates an instance of the PartnerRegistrationsClient client. +func NewPartnerRegistrationsClient(subscriptionID string) PartnerRegistrationsClient { + return NewPartnerRegistrationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPartnerRegistrationsClientWithBaseURI creates an instance of the PartnerRegistrationsClient 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 NewPartnerRegistrationsClientWithBaseURI(baseURI string, subscriptionID string) PartnerRegistrationsClient { + return PartnerRegistrationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new partner registration with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerRegistrationName - name of the partner registration. +// partnerRegistrationInfo - partnerRegistration information. +func (client PartnerRegistrationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo PartnerRegistration) (result PartnerRegistration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, partnerRegistrationName, partnerRegistrationInfo) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PartnerRegistrationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo PartnerRegistration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerRegistrationName": autorest.Encode("path", partnerRegistrationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + partnerRegistrationInfo.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.EventGrid/partnerRegistrations/{partnerRegistrationName}", pathParameters), + autorest.WithJSON(partnerRegistrationInfo), + 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) CreateOrUpdateResponder(resp *http.Response) (result PartnerRegistration, 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 partner registration with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerRegistrationName - name of the partner registration. +func (client PartnerRegistrationsClient) Delete(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, partnerRegistrationName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PartnerRegistrationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerRegistrationName": autorest.Encode("path", partnerRegistrationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}", 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) 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 partner registration with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerRegistrationName - name of the partner registration. +func (client PartnerRegistrationsClient) Get(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (result PartnerRegistration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, partnerRegistrationName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PartnerRegistrationsClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerRegistrationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerRegistrationName": autorest.Encode("path", partnerRegistrationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}", 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) GetResponder(resp *http.Response) (result PartnerRegistration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list all the partner registrations under a resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client PartnerRegistrationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerRegistrationsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.prlr.Response.Response != nil { + sc = result.prlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.prlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.prlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.prlr.hasNextLink() && result.prlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client PartnerRegistrationsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations", 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) ListByResourceGroupResponder(resp *http.Response) (result PartnerRegistrationsListResult, 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 PartnerRegistrationsClient) listByResourceGroupNextResults(ctx context.Context, lastResults PartnerRegistrationsListResult) (result PartnerRegistrationsListResult, err error) { + req, err := lastResults.partnerRegistrationsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "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, "eventgrid.PartnerRegistrationsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client PartnerRegistrationsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerRegistrationsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.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, filter, top) + return +} + +// ListBySubscription list all the partner registrations under an Azure subscription. +// Parameters: +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client PartnerRegistrationsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result PartnerRegistrationsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.ListBySubscription") + defer func() { + sc := -1 + if result.prlr.Response.Response != nil { + sc = result.prlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.prlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.prlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.prlr.hasNextLink() && result.prlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client PartnerRegistrationsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerRegistrations", 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) ListBySubscriptionResponder(resp *http.Response) (result PartnerRegistrationsListResult, 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 PartnerRegistrationsClient) listBySubscriptionNextResults(ctx context.Context, lastResults PartnerRegistrationsListResult) (result PartnerRegistrationsListResult, err error) { + req, err := lastResults.partnerRegistrationsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "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, "eventgrid.PartnerRegistrationsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client PartnerRegistrationsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result PartnerRegistrationsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.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, filter, top) + return +} + +// Update updates a partner registration with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerRegistrationName - name of the partner registration. +// partnerRegistrationUpdateParameters - partner registration update information. +func (client PartnerRegistrationsClient) Update(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters PartnerRegistrationUpdateParameters) (result PartnerRegistration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerRegistrationsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, partnerRegistrationName, partnerRegistrationUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerRegistrationsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PartnerRegistrationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters PartnerRegistrationUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerRegistrationName": autorest.Encode("path", partnerRegistrationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}", pathParameters), + autorest.WithJSON(partnerRegistrationUpdateParameters), + 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 PartnerRegistrationsClient) 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 PartnerRegistrationsClient) UpdateResponder(resp *http.Response) (result PartnerRegistration, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/partnertopiceventsubscriptions.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/partnertopiceventsubscriptions.go new file mode 100644 index 000000000000..c11ae7534356 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/partnertopiceventsubscriptions.go @@ -0,0 +1,651 @@ +package eventgrid + +// 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" +) + +// PartnerTopicEventSubscriptionsClient is the azure EventGrid Management Client +type PartnerTopicEventSubscriptionsClient struct { + BaseClient +} + +// NewPartnerTopicEventSubscriptionsClient creates an instance of the PartnerTopicEventSubscriptionsClient client. +func NewPartnerTopicEventSubscriptionsClient(subscriptionID string) PartnerTopicEventSubscriptionsClient { + return NewPartnerTopicEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPartnerTopicEventSubscriptionsClientWithBaseURI creates an instance of the PartnerTopicEventSubscriptionsClient +// 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 NewPartnerTopicEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) PartnerTopicEventSubscriptionsClient { + return PartnerTopicEventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate asynchronously creates or updates an event subscription of a partner topic with the specified +// parameters. Existing event subscriptions will be updated with this API. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerTopicName - name of the partner topic. +// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be +// between 3 and 100 characters in length and use alphanumeric letters only. +// eventSubscriptionInfo - event subscription properties containing the destination and filter information. +func (client PartnerTopicEventSubscriptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result PartnerTopicEventSubscriptionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, eventSubscriptionInfo) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PartnerTopicEventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "partnerTopicName": autorest.Encode("path", partnerTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + eventSubscriptionInfo.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.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}", pathParameters), + autorest.WithJSON(eventSubscriptionInfo), + 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 PartnerTopicEventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future PartnerTopicEventSubscriptionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PartnerTopicEventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 event subscription of a partner topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerTopicName - name of the partner topic. +// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be +// between 3 and 100 characters in length and use alphanumeric letters only. +func (client PartnerTopicEventSubscriptionsClient) Delete(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result PartnerTopicEventSubscriptionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PartnerTopicEventSubscriptionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "partnerTopicName": autorest.Encode("path", partnerTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}", 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 PartnerTopicEventSubscriptionsClient) DeleteSender(req *http.Request) (future PartnerTopicEventSubscriptionsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PartnerTopicEventSubscriptionsClient) 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 get an event subscription of a partner topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerTopicName - name of the partner topic. +// eventSubscriptionName - name of the event subscription to be found. Event subscription names must be between +// 3 and 100 characters in length and use alphanumeric letters only. +func (client PartnerTopicEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result EventSubscription, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PartnerTopicEventSubscriptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "partnerTopicName": autorest.Encode("path", partnerTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}", 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 PartnerTopicEventSubscriptionsClient) 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 PartnerTopicEventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeliveryAttributes get all delivery attributes for an event subscription of a partner topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerTopicName - name of the partner topic. +// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be +// between 3 and 100 characters in length and use alphanumeric letters only. +func (client PartnerTopicEventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result DeliveryAttributeListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.GetDeliveryAttributes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetDeliveryAttributesPreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetDeliveryAttributes", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeliveryAttributesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetDeliveryAttributes", resp, "Failure sending request") + return + } + + result, err = client.GetDeliveryAttributesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetDeliveryAttributes", resp, "Failure responding to request") + return + } + + return +} + +// GetDeliveryAttributesPreparer prepares the GetDeliveryAttributes request. +func (client PartnerTopicEventSubscriptionsClient) GetDeliveryAttributesPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "partnerTopicName": autorest.Encode("path", partnerTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeliveryAttributesSender sends the GetDeliveryAttributes request. The method will close the +// http.Response Body if it receives an error. +func (client PartnerTopicEventSubscriptionsClient) GetDeliveryAttributesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDeliveryAttributesResponder handles the response to the GetDeliveryAttributes request. The method always +// closes the http.Response Body. +func (client PartnerTopicEventSubscriptionsClient) GetDeliveryAttributesResponder(resp *http.Response) (result DeliveryAttributeListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFullURL get the full endpoint URL for an event subscription of a partner topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerTopicName - name of the partner topic. +// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be +// between 3 and 100 characters in length and use alphanumeric letters only. +func (client PartnerTopicEventSubscriptionsClient) GetFullURL(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.GetFullURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetFullURLPreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetFullURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") + return + } + + result, err = client.GetFullURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") + return + } + + return +} + +// GetFullURLPreparer prepares the GetFullURL request. +func (client PartnerTopicEventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "partnerTopicName": autorest.Encode("path", partnerTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFullURLSender sends the GetFullURL request. The method will close the +// http.Response Body if it receives an error. +func (client PartnerTopicEventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetFullURLResponder handles the response to the GetFullURL request. The method always +// closes the http.Response Body. +func (client PartnerTopicEventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByPartnerTopic list event subscriptions that belong to a specific partner topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerTopicName - name of the partner topic. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopic(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.ListByPartnerTopic") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByPartnerTopicNextResults + req, err := client.ListByPartnerTopicPreparer(ctx, resourceGroupName, partnerTopicName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "ListByPartnerTopic", nil, "Failure preparing request") + return + } + + resp, err := client.ListByPartnerTopicSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "ListByPartnerTopic", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListByPartnerTopicResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "ListByPartnerTopic", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByPartnerTopicPreparer prepares the ListByPartnerTopic request. +func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopicPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerTopicName": autorest.Encode("path", partnerTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByPartnerTopicSender sends the ListByPartnerTopic request. The method will close the +// http.Response Body if it receives an error. +func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopicSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByPartnerTopicResponder handles the response to the ListByPartnerTopic request. The method always +// closes the http.Response Body. +func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByPartnerTopicNextResults retrieves the next set of results, if any. +func (client PartnerTopicEventSubscriptionsClient) listByPartnerTopicNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { + req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "listByPartnerTopicNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByPartnerTopicSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "listByPartnerTopicNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByPartnerTopicResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "listByPartnerTopicNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByPartnerTopicComplete enumerates all values, automatically crossing page boundaries as required. +func (client PartnerTopicEventSubscriptionsClient) ListByPartnerTopicComplete(ctx context.Context, resourceGroupName string, partnerTopicName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.ListByPartnerTopic") + 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.ListByPartnerTopic(ctx, resourceGroupName, partnerTopicName, filter, top) + return +} + +// Update update event subscription of a partner topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerTopicName - name of the partner topic. +// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be +// between 3 and 100 characters in length and use alphanumeric letters only. +// eventSubscriptionUpdateParameters - updated event subscription information. +func (client PartnerTopicEventSubscriptionsClient) Update(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result PartnerTopicEventSubscriptionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicEventSubscriptionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, eventSubscriptionUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicEventSubscriptionsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PartnerTopicEventSubscriptionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "partnerTopicName": autorest.Encode("path", partnerTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}", pathParameters), + autorest.WithJSON(eventSubscriptionUpdateParameters), + 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 PartnerTopicEventSubscriptionsClient) UpdateSender(req *http.Request) (future PartnerTopicEventSubscriptionsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PartnerTopicEventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/partnertopics.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/partnertopics.go new file mode 100644 index 000000000000..14ad2b9229e7 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/partnertopics.go @@ -0,0 +1,673 @@ +package eventgrid + +// 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" +) + +// PartnerTopicsClient is the azure EventGrid Management Client +type PartnerTopicsClient struct { + BaseClient +} + +// NewPartnerTopicsClient creates an instance of the PartnerTopicsClient client. +func NewPartnerTopicsClient(subscriptionID string) PartnerTopicsClient { + return NewPartnerTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPartnerTopicsClientWithBaseURI creates an instance of the PartnerTopicsClient 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 NewPartnerTopicsClientWithBaseURI(baseURI string, subscriptionID string) PartnerTopicsClient { + return PartnerTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Activate activate a newly created partner topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerTopicName - name of the partner topic. +func (client PartnerTopicsClient) Activate(ctx context.Context, resourceGroupName string, partnerTopicName string) (result PartnerTopic, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.Activate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ActivatePreparer(ctx, resourceGroupName, partnerTopicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Activate", nil, "Failure preparing request") + return + } + + resp, err := client.ActivateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Activate", resp, "Failure sending request") + return + } + + result, err = client.ActivateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Activate", resp, "Failure responding to request") + return + } + + return +} + +// ActivatePreparer prepares the Activate request. +func (client PartnerTopicsClient) ActivatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerTopicName": autorest.Encode("path", partnerTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/activate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ActivateSender sends the Activate request. The method will close the +// http.Response Body if it receives an error. +func (client PartnerTopicsClient) ActivateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ActivateResponder handles the response to the Activate request. The method always +// closes the http.Response Body. +func (client PartnerTopicsClient) ActivateResponder(resp *http.Response) (result PartnerTopic, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Deactivate deactivate specific partner topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerTopicName - name of the partner topic. +func (client PartnerTopicsClient) Deactivate(ctx context.Context, resourceGroupName string, partnerTopicName string) (result PartnerTopic, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.Deactivate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeactivatePreparer(ctx, resourceGroupName, partnerTopicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Deactivate", nil, "Failure preparing request") + return + } + + resp, err := client.DeactivateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Deactivate", resp, "Failure sending request") + return + } + + result, err = client.DeactivateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Deactivate", resp, "Failure responding to request") + return + } + + return +} + +// DeactivatePreparer prepares the Deactivate request. +func (client PartnerTopicsClient) DeactivatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerTopicName": autorest.Encode("path", partnerTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/deactivate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeactivateSender sends the Deactivate request. The method will close the +// http.Response Body if it receives an error. +func (client PartnerTopicsClient) DeactivateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeactivateResponder handles the response to the Deactivate request. The method always +// closes the http.Response Body. +func (client PartnerTopicsClient) DeactivateResponder(resp *http.Response) (result PartnerTopic, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete existing partner topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerTopicName - name of the partner topic. +func (client PartnerTopicsClient) Delete(ctx context.Context, resourceGroupName string, partnerTopicName string) (result PartnerTopicsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, partnerTopicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PartnerTopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerTopicName": autorest.Encode("path", partnerTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}", 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 PartnerTopicsClient) DeleteSender(req *http.Request) (future PartnerTopicsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PartnerTopicsClient) 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 get properties of a partner topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerTopicName - name of the partner topic. +func (client PartnerTopicsClient) Get(ctx context.Context, resourceGroupName string, partnerTopicName string) (result PartnerTopic, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, partnerTopicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PartnerTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, partnerTopicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerTopicName": autorest.Encode("path", partnerTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}", 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 PartnerTopicsClient) 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 PartnerTopicsClient) GetResponder(resp *http.Response) (result PartnerTopic, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list all the partner topics under a resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client PartnerTopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerTopicsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.ptlr.Response.Response != nil { + sc = result.ptlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.ptlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.ptlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.ptlr.hasNextLink() && result.ptlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client PartnerTopicsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics", 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 PartnerTopicsClient) 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 PartnerTopicsClient) ListByResourceGroupResponder(resp *http.Response) (result PartnerTopicsListResult, 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 PartnerTopicsClient) listByResourceGroupNextResults(ctx context.Context, lastResults PartnerTopicsListResult) (result PartnerTopicsListResult, err error) { + req, err := lastResults.partnerTopicsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "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, "eventgrid.PartnerTopicsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client PartnerTopicsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result PartnerTopicsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.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, filter, top) + return +} + +// ListBySubscription list all the partner topics under an Azure subscription. +// Parameters: +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client PartnerTopicsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result PartnerTopicsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.ListBySubscription") + defer func() { + sc := -1 + if result.ptlr.Response.Response != nil { + sc = result.ptlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.ptlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.ptlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.ptlr.hasNextLink() && result.ptlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client PartnerTopicsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerTopics", 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 PartnerTopicsClient) 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 PartnerTopicsClient) ListBySubscriptionResponder(resp *http.Response) (result PartnerTopicsListResult, 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 PartnerTopicsClient) listBySubscriptionNextResults(ctx context.Context, lastResults PartnerTopicsListResult) (result PartnerTopicsListResult, err error) { + req, err := lastResults.partnerTopicsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "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, "eventgrid.PartnerTopicsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client PartnerTopicsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result PartnerTopicsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.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, filter, top) + return +} + +// Update asynchronously updates a partner topic with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// partnerTopicName - name of the partner topic. +// partnerTopicUpdateParameters - partnerTopic update information. +func (client PartnerTopicsClient) Update(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters PartnerTopicUpdateParameters) (result PartnerTopic, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PartnerTopicsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, partnerTopicName, partnerTopicUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PartnerTopicsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PartnerTopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters PartnerTopicUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "partnerTopicName": autorest.Encode("path", partnerTopicName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}", pathParameters), + autorest.WithJSON(partnerTopicUpdateParameters), + 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 PartnerTopicsClient) 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 PartnerTopicsClient) UpdateResponder(resp *http.Response) (result PartnerTopic, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/privateendpointconnections.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/privateendpointconnections.go new file mode 100644 index 000000000000..9d2941ebd3fc --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/privateendpointconnections.go @@ -0,0 +1,420 @@ +package eventgrid + +// 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" +) + +// PrivateEndpointConnectionsClient is the azure EventGrid 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)} +} + +// Delete delete a specific private endpoint connection under a topic, domain, or partner namespace. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// parentType - the type of the parent resource. This can be either \'topics\', \'domains\', or +// \'partnerNamespaces\'. +// parentName - the name of the parent resource (namely, either, the topic name, domain name, or partner +// namespace name). +// privateEndpointConnectionName - the name of the private endpoint connection connection. +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, parentType string, parentName 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) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentName": autorest.Encode("path", parentName), + "parentType": autorest.Encode("path", parentType), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/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 + 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 get a specific private endpoint connection under a topic, domain, or partner namespace. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// parentType - the type of the parent resource. This can be either \'topics\', \'domains\', or +// \'partnerNamespaces\'. +// parentName - the name of the parent resource (namely, either, the topic name, domain name, or partner +// namespace name). +// privateEndpointConnectionName - the name of the private endpoint connection connection. +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, parentType string, parentName 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) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.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, "eventgrid.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentName": autorest.Encode("path", parentName), + "parentType": autorest.Encode("path", parentType), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/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 +} + +// ListByResource get all private endpoint connections under a topic, domain, or partner namespace. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// parentType - the type of the parent resource. This can be either \'topics\', \'domains\', or +// \'partnerNamespaces\'. +// parentName - the name of the parent resource (namely, either, the topic name, domain name, or partner +// namespace name). +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client PrivateEndpointConnectionsClient) ListByResource(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result PrivateEndpointConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.ListByResource") + defer func() { + sc := -1 + if result.peclr.Response.Response != nil { + sc = result.peclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceNextResults + req, err := client.ListByResourcePreparer(ctx, resourceGroupName, parentType, parentName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "ListByResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceSender(req) + if err != nil { + result.peclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "ListByResource", resp, "Failure sending request") + return + } + + result.peclr, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "ListByResource", resp, "Failure responding to request") + return + } + if result.peclr.hasNextLink() && result.peclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourcePreparer prepares the ListByResource request. +func (client PrivateEndpointConnectionsClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentName": autorest.Encode("path", parentName), + "parentType": autorest.Encode("path", parentType), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections", 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 PrivateEndpointConnectionsClient) ListByResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceResponder handles the response to the ListByResource request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListByResourceResponder(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 +} + +// listByResourceNextResults retrieves the next set of results, if any. +func (client PrivateEndpointConnectionsClient) listByResourceNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { + req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "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, "eventgrid.PrivateEndpointConnectionsClient", "listByResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "listByResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointConnectionsClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result PrivateEndpointConnectionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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, resourceGroupName, parentType, parentName, filter, top) + return +} + +// Update update a specific private endpoint connection under a topic, domain or partner namespace. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// parentType - the type of the parent resource. This can be either \'topics\', \'domains\', or +// \'partnerNamespaces\'. +// parentName - the name of the parent resource (namely, either, the topic name, domain name, or partner +// namespace name). +// privateEndpointConnectionName - the name of the private endpoint connection connection. +// privateEndpointConnection - the private endpoint connection object to update. +func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName, privateEndpointConnection) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateEndpointConnectionsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentName": autorest.Encode("path", parentName), + "parentType": autorest.Encode("path", parentType), + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(privateEndpointConnection), + 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 PrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (future PrivateEndpointConnectionsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/privatelinkresources.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/privatelinkresources.go new file mode 100644 index 000000000000..104f552e3f30 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/privatelinkresources.go @@ -0,0 +1,250 @@ +package eventgrid + +// 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" +) + +// PrivateLinkResourcesClient is the azure EventGrid 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 get properties of a private link resource. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// parentType - the type of the parent resource. This can be either \'topics\', \'domains\', or +// \'partnerNamespaces\'. +// parentName - the name of the parent resource (namely, either, the topic name, domain name, or partner +// namespace name). +// privateLinkResourceName - the name of private link resource. +func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateLinkResourceName 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) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, parentType, parentName, privateLinkResourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.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, "eventgrid.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, privateLinkResourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentName": autorest.Encode("path", parentName), + "parentType": autorest.Encode("path", parentType), + "privateLinkResourceName": autorest.Encode("path", privateLinkResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources/{privateLinkResourceName}", 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 +} + +// ListByResource list all the private link resources under a topic, domain, or partner namespace. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// parentType - the type of the parent resource. This can be either \'topics\', \'domains\', or +// \'partnerNamespaces\'. +// parentName - the name of the parent resource (namely, either, the topic name, domain name, or partner +// namespace name). +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client PrivateLinkResourcesClient) ListByResource(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result PrivateLinkResourcesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.ListByResource") + defer func() { + sc := -1 + if result.plrlr.Response.Response != nil { + sc = result.plrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceNextResults + req, err := client.ListByResourcePreparer(ctx, resourceGroupName, parentType, parentName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "ListByResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceSender(req) + if err != nil { + result.plrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "ListByResource", resp, "Failure sending request") + return + } + + result.plrlr, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "ListByResource", resp, "Failure responding to request") + return + } + if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourcePreparer prepares the ListByResource request. +func (client PrivateLinkResourcesClient) ListByResourcePreparer(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentName": autorest.Encode("path", parentName), + "parentType": autorest.Encode("path", parentType), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateLinkResources", 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 PrivateLinkResourcesClient) ListByResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceResponder handles the response to the ListByResource request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListByResourceResponder(resp *http.Response) (result PrivateLinkResourcesListResult, 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 PrivateLinkResourcesClient) listByResourceNextResults(ctx context.Context, lastResults PrivateLinkResourcesListResult) (result PrivateLinkResourcesListResult, err error) { + req, err := lastResults.privateLinkResourcesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "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, "eventgrid.PrivateLinkResourcesClient", "listByResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.PrivateLinkResourcesClient", "listByResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkResourcesClient) ListByResourceComplete(ctx context.Context, resourceGroupName string, parentType string, parentName string, filter string, top *int32) (result PrivateLinkResourcesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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, resourceGroupName, parentType, parentName, filter, top) + return +} diff --git a/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/systemtopiceventsubscriptions.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/systemtopiceventsubscriptions.go new file mode 100644 index 000000000000..1cb48385a12d --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/systemtopiceventsubscriptions.go @@ -0,0 +1,651 @@ +package eventgrid + +// 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" +) + +// SystemTopicEventSubscriptionsClient is the azure EventGrid Management Client +type SystemTopicEventSubscriptionsClient struct { + BaseClient +} + +// NewSystemTopicEventSubscriptionsClient creates an instance of the SystemTopicEventSubscriptionsClient client. +func NewSystemTopicEventSubscriptionsClient(subscriptionID string) SystemTopicEventSubscriptionsClient { + return NewSystemTopicEventSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSystemTopicEventSubscriptionsClientWithBaseURI creates an instance of the SystemTopicEventSubscriptionsClient +// 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 NewSystemTopicEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SystemTopicEventSubscriptionsClient { + return SystemTopicEventSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate asynchronously creates or updates an event subscription with the specified parameters. Existing event +// subscriptions will be updated with this API. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// systemTopicName - name of the system topic. +// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be +// between 3 and 100 characters in length and use alphanumeric letters only. +// eventSubscriptionInfo - event subscription properties containing the destination and filter information. +func (client SystemTopicEventSubscriptionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (result SystemTopicEventSubscriptionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName, eventSubscriptionInfo) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SystemTopicEventSubscriptionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "systemTopicName": autorest.Encode("path", systemTopicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + eventSubscriptionInfo.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.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}", pathParameters), + autorest.WithJSON(eventSubscriptionInfo), + 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 SystemTopicEventSubscriptionsClient) CreateOrUpdateSender(req *http.Request) (future SystemTopicEventSubscriptionsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SystemTopicEventSubscriptionsClient) CreateOrUpdateResponder(resp *http.Response) (result EventSubscription, 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 event subscription of a system topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// systemTopicName - name of the system topic. +// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be +// between 3 and 100 characters in length and use alphanumeric letters only. +func (client SystemTopicEventSubscriptionsClient) Delete(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result SystemTopicEventSubscriptionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SystemTopicEventSubscriptionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "systemTopicName": autorest.Encode("path", systemTopicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}", 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 SystemTopicEventSubscriptionsClient) DeleteSender(req *http.Request) (future SystemTopicEventSubscriptionsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SystemTopicEventSubscriptionsClient) 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 get an event subscription. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// systemTopicName - name of the system topic. +// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be +// between 3 and 100 characters in length and use alphanumeric letters only. +func (client SystemTopicEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result EventSubscription, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SystemTopicEventSubscriptionsClient) GetPreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "systemTopicName": autorest.Encode("path", systemTopicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}", 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 SystemTopicEventSubscriptionsClient) 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 SystemTopicEventSubscriptionsClient) GetResponder(resp *http.Response) (result EventSubscription, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDeliveryAttributes get all delivery attributes for an event subscription. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// systemTopicName - name of the system topic. +// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be +// between 3 and 100 characters in length and use alphanumeric letters only. +func (client SystemTopicEventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result DeliveryAttributeListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.GetDeliveryAttributes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetDeliveryAttributesPreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetDeliveryAttributes", nil, "Failure preparing request") + return + } + + resp, err := client.GetDeliveryAttributesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetDeliveryAttributes", resp, "Failure sending request") + return + } + + result, err = client.GetDeliveryAttributesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetDeliveryAttributes", resp, "Failure responding to request") + return + } + + return +} + +// GetDeliveryAttributesPreparer prepares the GetDeliveryAttributes request. +func (client SystemTopicEventSubscriptionsClient) GetDeliveryAttributesPreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "systemTopicName": autorest.Encode("path", systemTopicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDeliveryAttributesSender sends the GetDeliveryAttributes request. The method will close the +// http.Response Body if it receives an error. +func (client SystemTopicEventSubscriptionsClient) GetDeliveryAttributesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDeliveryAttributesResponder handles the response to the GetDeliveryAttributes request. The method always +// closes the http.Response Body. +func (client SystemTopicEventSubscriptionsClient) GetDeliveryAttributesResponder(resp *http.Response) (result DeliveryAttributeListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFullURL get the full endpoint URL for an event subscription of a system topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// systemTopicName - name of the system topic. +// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be +// between 3 and 100 characters in length and use alphanumeric letters only. +func (client SystemTopicEventSubscriptionsClient) GetFullURL(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (result EventSubscriptionFullURL, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.GetFullURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetFullURLPreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetFullURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetFullURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetFullURL", resp, "Failure sending request") + return + } + + result, err = client.GetFullURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "GetFullURL", resp, "Failure responding to request") + return + } + + return +} + +// GetFullURLPreparer prepares the GetFullURL request. +func (client SystemTopicEventSubscriptionsClient) GetFullURLPreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "systemTopicName": autorest.Encode("path", systemTopicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFullURLSender sends the GetFullURL request. The method will close the +// http.Response Body if it receives an error. +func (client SystemTopicEventSubscriptionsClient) GetFullURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetFullURLResponder handles the response to the GetFullURL request. The method always +// closes the http.Response Body. +func (client SystemTopicEventSubscriptionsClient) GetFullURLResponder(resp *http.Response) (result EventSubscriptionFullURL, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySystemTopic list event subscriptions that belong to a specific system topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// systemTopicName - name of the system topic. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client SystemTopicEventSubscriptionsClient) ListBySystemTopic(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (result EventSubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.ListBySystemTopic") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySystemTopicNextResults + req, err := client.ListBySystemTopicPreparer(ctx, resourceGroupName, systemTopicName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "ListBySystemTopic", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySystemTopicSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "ListBySystemTopic", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListBySystemTopicResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "ListBySystemTopic", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySystemTopicPreparer prepares the ListBySystemTopic request. +func (client SystemTopicEventSubscriptionsClient) ListBySystemTopicPreparer(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "systemTopicName": autorest.Encode("path", systemTopicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySystemTopicSender sends the ListBySystemTopic request. The method will close the +// http.Response Body if it receives an error. +func (client SystemTopicEventSubscriptionsClient) ListBySystemTopicSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySystemTopicResponder handles the response to the ListBySystemTopic request. The method always +// closes the http.Response Body. +func (client SystemTopicEventSubscriptionsClient) ListBySystemTopicResponder(resp *http.Response) (result EventSubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySystemTopicNextResults retrieves the next set of results, if any. +func (client SystemTopicEventSubscriptionsClient) listBySystemTopicNextResults(ctx context.Context, lastResults EventSubscriptionsListResult) (result EventSubscriptionsListResult, err error) { + req, err := lastResults.eventSubscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "listBySystemTopicNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySystemTopicSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "listBySystemTopicNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySystemTopicResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "listBySystemTopicNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySystemTopicComplete enumerates all values, automatically crossing page boundaries as required. +func (client SystemTopicEventSubscriptionsClient) ListBySystemTopicComplete(ctx context.Context, resourceGroupName string, systemTopicName string, filter string, top *int32) (result EventSubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.ListBySystemTopic") + 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.ListBySystemTopic(ctx, resourceGroupName, systemTopicName, filter, top) + return +} + +// Update update event subscription of a system topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// systemTopicName - name of the system topic. +// eventSubscriptionName - name of the event subscription to be created. Event subscription names must be +// between 3 and 100 characters in length and use alphanumeric letters only. +// eventSubscriptionUpdateParameters - updated event subscription information. +func (client SystemTopicEventSubscriptionsClient) Update(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (result SystemTopicEventSubscriptionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicEventSubscriptionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, systemTopicName, eventSubscriptionName, eventSubscriptionUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicEventSubscriptionsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SystemTopicEventSubscriptionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "eventSubscriptionName": autorest.Encode("path", eventSubscriptionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "systemTopicName": autorest.Encode("path", systemTopicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}/eventSubscriptions/{eventSubscriptionName}", pathParameters), + autorest.WithJSON(eventSubscriptionUpdateParameters), + 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 SystemTopicEventSubscriptionsClient) UpdateSender(req *http.Request) (future SystemTopicEventSubscriptionsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SystemTopicEventSubscriptionsClient) UpdateResponder(resp *http.Response) (result EventSubscription, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/systemtopics.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/systemtopics.go new file mode 100644 index 000000000000..b802491f7a28 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/systemtopics.go @@ -0,0 +1,605 @@ +package eventgrid + +// 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" +) + +// SystemTopicsClient is the azure EventGrid Management Client +type SystemTopicsClient struct { + BaseClient +} + +// NewSystemTopicsClient creates an instance of the SystemTopicsClient client. +func NewSystemTopicsClient(subscriptionID string) SystemTopicsClient { + return NewSystemTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSystemTopicsClientWithBaseURI creates an instance of the SystemTopicsClient 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 NewSystemTopicsClientWithBaseURI(baseURI string, subscriptionID string) SystemTopicsClient { + return SystemTopicsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate asynchronously creates a new system topic with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// systemTopicName - name of the system topic. +// systemTopicInfo - system Topic information. +func (client SystemTopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicInfo SystemTopic) (result SystemTopicsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, systemTopicName, systemTopicInfo) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SystemTopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicInfo SystemTopic) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "systemTopicName": autorest.Encode("path", systemTopicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + systemTopicInfo.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.EventGrid/systemTopics/{systemTopicName}", pathParameters), + autorest.WithJSON(systemTopicInfo), + 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 SystemTopicsClient) CreateOrUpdateSender(req *http.Request) (future SystemTopicsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SystemTopicsClient) CreateOrUpdateResponder(resp *http.Response) (result SystemTopic, 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 existing system topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// systemTopicName - name of the system topic. +func (client SystemTopicsClient) Delete(ctx context.Context, resourceGroupName string, systemTopicName string) (result SystemTopicsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, systemTopicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SystemTopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, systemTopicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "systemTopicName": autorest.Encode("path", systemTopicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}", 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 SystemTopicsClient) DeleteSender(req *http.Request) (future SystemTopicsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SystemTopicsClient) 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 get properties of a system topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// systemTopicName - name of the system topic. +func (client SystemTopicsClient) Get(ctx context.Context, resourceGroupName string, systemTopicName string) (result SystemTopic, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, systemTopicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SystemTopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, systemTopicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "systemTopicName": autorest.Encode("path", systemTopicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}", 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 SystemTopicsClient) 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 SystemTopicsClient) GetResponder(resp *http.Response) (result SystemTopic, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list all the system topics under a resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client SystemTopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result SystemTopicsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.stlr.Response.Response != nil { + sc = result.stlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.stlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.stlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.stlr.hasNextLink() && result.stlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client SystemTopicsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics", 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 SystemTopicsClient) 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 SystemTopicsClient) ListByResourceGroupResponder(resp *http.Response) (result SystemTopicsListResult, 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 SystemTopicsClient) listByResourceGroupNextResults(ctx context.Context, lastResults SystemTopicsListResult) (result SystemTopicsListResult, err error) { + req, err := lastResults.systemTopicsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "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, "eventgrid.SystemTopicsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client SystemTopicsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result SystemTopicsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.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, filter, top) + return +} + +// ListBySubscription list all the system topics under an Azure subscription. +// Parameters: +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client SystemTopicsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result SystemTopicsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.ListBySubscription") + defer func() { + sc := -1 + if result.stlr.Response.Response != nil { + sc = result.stlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.stlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.stlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.stlr.hasNextLink() && result.stlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client SystemTopicsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/systemTopics", 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 SystemTopicsClient) 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 SystemTopicsClient) ListBySubscriptionResponder(resp *http.Response) (result SystemTopicsListResult, 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 SystemTopicsClient) listBySubscriptionNextResults(ctx context.Context, lastResults SystemTopicsListResult) (result SystemTopicsListResult, err error) { + req, err := lastResults.systemTopicsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "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, "eventgrid.SystemTopicsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client SystemTopicsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result SystemTopicsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.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, filter, top) + return +} + +// Update asynchronously updates a system topic with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// systemTopicName - name of the system topic. +// systemTopicUpdateParameters - systemTopic update information. +func (client SystemTopicsClient) Update(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicUpdateParameters SystemTopicUpdateParameters) (result SystemTopicsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SystemTopicsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, systemTopicName, systemTopicUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.SystemTopicsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SystemTopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, systemTopicName string, systemTopicUpdateParameters SystemTopicUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "systemTopicName": autorest.Encode("path", systemTopicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/systemTopics/{systemTopicName}", pathParameters), + autorest.WithJSON(systemTopicUpdateParameters), + 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 SystemTopicsClient) UpdateSender(req *http.Request) (future SystemTopicsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SystemTopicsClient) UpdateResponder(resp *http.Response) (result SystemTopic, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/topics.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/topics.go new file mode 100644 index 000000000000..e9c50dc9c809 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/topics.go @@ -0,0 +1,849 @@ +package eventgrid + +// 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" +) + +// TopicsClient is the azure EventGrid Management Client +type TopicsClient struct { + BaseClient +} + +// NewTopicsClient creates an instance of the TopicsClient client. +func NewTopicsClient(subscriptionID string) TopicsClient { + return NewTopicsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTopicsClientWithBaseURI creates an instance of the TopicsClient 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 NewTopicsClientWithBaseURI(baseURI string, subscriptionID string) TopicsClient { + return TopicsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate asynchronously creates a new topic with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicName - name of the topic. +// topicInfo - topic information. +func (client TopicsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (result TopicsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, topicName, topicInfo) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TopicsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicInfo Topic) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + topicInfo.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.EventGrid/topics/{topicName}", pathParameters), + autorest.WithJSON(topicInfo), + 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 TopicsClient) CreateOrUpdateSender(req *http.Request) (future TopicsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TopicsClient) CreateOrUpdateResponder(resp *http.Response) (result Topic, 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 existing topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicName - name of the topic. +func (client TopicsClient) Delete(ctx context.Context, resourceGroupName string, topicName string) (result TopicsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, topicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TopicsClient) DeletePreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}", 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 TopicsClient) DeleteSender(req *http.Request) (future TopicsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TopicsClient) 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 get properties of a topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicName - name of the topic. +func (client TopicsClient) Get(ctx context.Context, resourceGroupName string, topicName string) (result Topic, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, topicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TopicsClient) GetPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}", 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 TopicsClient) 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 TopicsClient) GetResponder(resp *http.Response) (result Topic, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup list all the topics under a resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client TopicsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, filter string, top *int32) (result TopicsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.tlr.Response.Response != nil { + sc = result.tlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.tlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.tlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.tlr.hasNextLink() && result.tlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client TopicsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListByResourceGroupResponder(resp *http.Response) (result TopicsListResult, 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 TopicsClient) listByResourceGroupNextResults(ctx context.Context, lastResults TopicsListResult) (result TopicsListResult, err error) { + req, err := lastResults.topicsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "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, "eventgrid.TopicsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client TopicsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, top *int32) (result TopicsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, filter, top) + return +} + +// ListBySubscription list all the topics under an Azure subscription. +// Parameters: +// filter - the query used to filter the search results using OData syntax. Filtering is permitted on the +// 'name' property only and with limited number of OData operations. These operations are: the 'contains' +// function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). +// No arithmetic operations are supported. The following is a valid filter example: $filter=contains(namE, +// 'PATTERN') and name ne 'PATTERN-1'. The following is not a valid filter example: $filter=location eq +// 'westus'. +// top - the number of results to return per page for the list operation. Valid range for top parameter is 1 to +// 100. If not specified, the default number of results to be returned is 20 items per page. +func (client TopicsClient) ListBySubscription(ctx context.Context, filter string, top *int32) (result TopicsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListBySubscription") + defer func() { + sc := -1 + if result.tlr.Response.Response != nil { + sc = result.tlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.tlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.tlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.tlr.hasNextLink() && result.tlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client TopicsClient) ListBySubscriptionPreparer(ctx context.Context, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/topics", 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 TopicsClient) 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 TopicsClient) ListBySubscriptionResponder(resp *http.Response) (result TopicsListResult, 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 TopicsClient) listBySubscriptionNextResults(ctx context.Context, lastResults TopicsListResult) (result TopicsListResult, err error) { + req, err := lastResults.topicsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "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, "eventgrid.TopicsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client TopicsClient) ListBySubscriptionComplete(ctx context.Context, filter string, top *int32) (result TopicsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.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, filter, top) + return +} + +// ListEventTypes list event types for a topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// providerNamespace - namespace of the provider of the topic. +// resourceTypeName - name of the topic type. +// resourceName - name of the topic. +func (client TopicsClient) ListEventTypes(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (result EventTypesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListEventTypes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListEventTypesPreparer(ctx, resourceGroupName, providerNamespace, resourceTypeName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", nil, "Failure preparing request") + return + } + + resp, err := client.ListEventTypesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure sending request") + return + } + + result, err = client.ListEventTypesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListEventTypes", resp, "Failure responding to request") + return + } + + return +} + +// ListEventTypesPreparer prepares the ListEventTypes request. +func (client TopicsClient) ListEventTypesPreparer(ctx context.Context, resourceGroupName string, providerNamespace string, resourceTypeName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "providerNamespace": autorest.Encode("path", providerNamespace), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceTypeName": autorest.Encode("path", resourceTypeName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerNamespace}/{resourceTypeName}/{resourceName}/providers/Microsoft.EventGrid/eventTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListEventTypesSender sends the ListEventTypes request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListEventTypesResponder handles the response to the ListEventTypes request. The method always +// closes the http.Response Body. +func (client TopicsClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSharedAccessKeys list the two keys used to publish to a topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicName - name of the topic. +func (client TopicsClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, topicName string) (result TopicSharedAccessKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.ListSharedAccessKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSharedAccessKeysPreparer(ctx, resourceGroupName, topicName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListSharedAccessKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure sending request") + return + } + + result, err = client.ListSharedAccessKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "ListSharedAccessKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListSharedAccessKeysPreparer prepares the ListSharedAccessKeys request. +func (client TopicsClient) ListSharedAccessKeysPreparer(ctx context.Context, resourceGroupName string, topicName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSharedAccessKeysSender sends the ListSharedAccessKeys request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) ListSharedAccessKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSharedAccessKeysResponder handles the response to the ListSharedAccessKeys request. The method always +// closes the http.Response Body. +func (client TopicsClient) ListSharedAccessKeysResponder(resp *http.Response) (result TopicSharedAccessKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateKey regenerate a shared access key for a topic. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicName - name of the topic. +// regenerateKeyRequest - request body to regenerate key. +func (client TopicsClient) RegenerateKey(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (result TopicsRegenerateKeyFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.RegenerateKey") + 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: regenerateKeyRequest, + Constraints: []validation.Constraint{{Target: "regenerateKeyRequest.KeyName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("eventgrid.TopicsClient", "RegenerateKey", err.Error()) + } + + req, err := client.RegenerateKeyPreparer(ctx, resourceGroupName, topicName, regenerateKeyRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", nil, "Failure preparing request") + return + } + + result, err = client.RegenerateKeySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "RegenerateKey", nil, "Failure sending request") + return + } + + return +} + +// RegenerateKeyPreparer prepares the RegenerateKey request. +func (client TopicsClient) RegenerateKeyPreparer(ctx context.Context, resourceGroupName string, topicName string, regenerateKeyRequest TopicRegenerateKeyRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/regenerateKey", pathParameters), + autorest.WithJSON(regenerateKeyRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateKeySender sends the RegenerateKey request. The method will close the +// http.Response Body if it receives an error. +func (client TopicsClient) RegenerateKeySender(req *http.Request) (future TopicsRegenerateKeyFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RegenerateKeyResponder handles the response to the RegenerateKey request. The method always +// closes the http.Response Body. +func (client TopicsClient) RegenerateKeyResponder(resp *http.Response) (result TopicSharedAccessKeys, 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 asynchronously updates a topic with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. +// topicName - name of the topic. +// topicUpdateParameters - topic update information. +func (client TopicsClient) Update(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (result TopicsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, topicName, topicUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicsClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TopicsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, topicName string, topicUpdateParameters TopicUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "topicName": autorest.Encode("path", topicName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}", pathParameters), + autorest.WithJSON(topicUpdateParameters), + 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 TopicsClient) UpdateSender(req *http.Request) (future TopicsUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client TopicsClient) UpdateResponder(resp *http.Response) (result Topic, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/topictypes.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/topictypes.go new file mode 100644 index 000000000000..a95139919d3c --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/topictypes.go @@ -0,0 +1,244 @@ +package eventgrid + +// 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" +) + +// TopicTypesClient is the azure EventGrid Management Client +type TopicTypesClient struct { + BaseClient +} + +// NewTopicTypesClient creates an instance of the TopicTypesClient client. +func NewTopicTypesClient(subscriptionID string) TopicTypesClient { + return NewTopicTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTopicTypesClientWithBaseURI creates an instance of the TopicTypesClient 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 NewTopicTypesClientWithBaseURI(baseURI string, subscriptionID string) TopicTypesClient { + return TopicTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get information about a topic type. +// Parameters: +// topicTypeName - name of the topic type. +func (client TopicTypesClient) Get(ctx context.Context, topicTypeName string) (result TopicTypeInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, topicTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TopicTypesClient) GetPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "topicTypeName": autorest.Encode("path", topicTypeName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}", 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 TopicTypesClient) 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 TopicTypesClient) GetResponder(resp *http.Response) (result TopicTypeInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all registered topic types. +func (client TopicTypesClient) List(ctx context.Context) (result TopicTypesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.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, "eventgrid.TopicTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client TopicTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.EventGrid/topicTypes"), + 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 TopicTypesClient) 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 TopicTypesClient) ListResponder(resp *http.Response) (result TopicTypesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListEventTypes list event types for a topic type. +// Parameters: +// topicTypeName - name of the topic type. +func (client TopicTypesClient) ListEventTypes(ctx context.Context, topicTypeName string) (result EventTypesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TopicTypesClient.ListEventTypes") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListEventTypesPreparer(ctx, topicTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", nil, "Failure preparing request") + return + } + + resp, err := client.ListEventTypesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure sending request") + return + } + + result, err = client.ListEventTypesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "eventgrid.TopicTypesClient", "ListEventTypes", resp, "Failure responding to request") + return + } + + return +} + +// ListEventTypesPreparer prepares the ListEventTypes request. +func (client TopicTypesClient) ListEventTypesPreparer(ctx context.Context, topicTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "topicTypeName": autorest.Encode("path", topicTypeName), + } + + const APIVersion = "2021-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.EventGrid/topicTypes/{topicTypeName}/eventTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListEventTypesSender sends the ListEventTypes request. The method will close the +// http.Response Body if it receives an error. +func (client TopicTypesClient) ListEventTypesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListEventTypesResponder handles the response to the ListEventTypes request. The method always +// closes the http.Response Body. +func (client TopicTypesClient) ListEventTypesResponder(resp *http.Response) (result EventTypesListResult, 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/eventgrid/mgmt/2021-06-01-preview/eventgrid/version.go b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/version.go new file mode 100644 index 000000000000..6a482ee5fcd5 --- /dev/null +++ b/services/preview/eventgrid/mgmt/2021-06-01-preview/eventgrid/version.go @@ -0,0 +1,19 @@ +package eventgrid + +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() + " eventgrid/2021-06-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/security/mgmt/v3.0/security/CHANGELOG.md b/services/preview/security/mgmt/v3.0/security/CHANGELOG.md index ead67f78da9a..aa3fea66c4aa 100644 --- a/services/preview/security/mgmt/v3.0/security/CHANGELOG.md +++ b/services/preview/security/mgmt/v3.0/security/CHANGELOG.md @@ -1,66 +1,562 @@ # Change History -## Additive Changes +## Breaking Changes -### New Funcs +### Removed Constants + +1. EnforcementMode.Audit +1. EnforcementMode.Enforce +1. EventSource.Assessments +1. EventSource.SecureScoreControls +1. EventSource.SecureScores +1. EventSource.SubAssessments + +### Removed Funcs -1. AllowedConnectionsList.MarshalJSON() ([]byte, error) -1. AllowedConnectionsResourceProperties.MarshalJSON() ([]byte, error) -1. AscLocationList.MarshalJSON() ([]byte, error) -1. AssessmentLinks.MarshalJSON() ([]byte, error) -1. AssessmentList.MarshalJSON() ([]byte, error) -1. AssessmentMetadataList.MarshalJSON() ([]byte, error) -1. AzureResourceLink.MarshalJSON() ([]byte, error) -1. CVE.MarshalJSON() ([]byte, error) -1. CVSS.MarshalJSON() ([]byte, error) -1. CloudErrorBody.MarshalJSON() ([]byte, error) -1. ComplianceProperties.MarshalJSON() ([]byte, error) -1. ComplianceResultProperties.MarshalJSON() ([]byte, error) -1. ComplianceSegment.MarshalJSON() ([]byte, error) -1. ConnectableResource.MarshalJSON() ([]byte, error) -1. ConnectedResource.MarshalJSON() ([]byte, error) -1. ContactList.MarshalJSON() ([]byte, error) -1. Firmware.MarshalJSON() ([]byte, error) -1. IPAddress.MarshalJSON() ([]byte, error) -1. IoTSecurityAggregatedAlertProperties.MarshalJSON() ([]byte, error) -1. IoTSecurityAggregatedAlertPropertiesTopDevicesListItem.MarshalJSON() ([]byte, error) -1. IoTSecurityAlertedDevice.MarshalJSON() ([]byte, error) -1. IoTSecurityDeviceAlert.MarshalJSON() ([]byte, error) -1. IoTSecurityDeviceRecommendation.MarshalJSON() ([]byte, error) +1. *IotAlert.UnmarshalJSON([]byte) error +1. *IotAlertListIterator.Next() error +1. *IotAlertListIterator.NextWithContext(context.Context) error +1. *IotAlertListPage.Next() error +1. *IotAlertListPage.NextWithContext(context.Context) error +1. *IotRecommendation.UnmarshalJSON([]byte) error +1. *IotRecommendationListIterator.Next() error +1. *IotRecommendationListIterator.NextWithContext(context.Context) error +1. *IotRecommendationListPage.Next() error +1. *IotRecommendationListPage.NextWithContext(context.Context) error +1. AlertsClient.GetResourceGroupLevelAlerts(context.Context, string, string) (Alert, error) +1. AlertsClient.GetResourceGroupLevelAlertsPreparer(context.Context, string, string) (*http.Request, error) +1. AlertsClient.GetResourceGroupLevelAlertsResponder(*http.Response) (Alert, error) +1. AlertsClient.GetResourceGroupLevelAlertsSender(*http.Request) (*http.Response, error) +1. AlertsClient.GetSubscriptionLevelAlert(context.Context, string) (Alert, error) +1. AlertsClient.GetSubscriptionLevelAlertPreparer(context.Context, string) (*http.Request, error) +1. AlertsClient.GetSubscriptionLevelAlertResponder(*http.Response) (Alert, error) +1. AlertsClient.GetSubscriptionLevelAlertSender(*http.Request) (*http.Response, error) +1. AlertsClient.ListResourceGroupLevelAlertsByRegion(context.Context, string) (AlertListPage, error) +1. AlertsClient.ListResourceGroupLevelAlertsByRegionComplete(context.Context, string) (AlertListIterator, error) +1. AlertsClient.ListResourceGroupLevelAlertsByRegionPreparer(context.Context, string) (*http.Request, error) +1. AlertsClient.ListResourceGroupLevelAlertsByRegionResponder(*http.Response) (AlertList, error) +1. AlertsClient.ListResourceGroupLevelAlertsByRegionSender(*http.Request) (*http.Response, error) +1. AlertsClient.ListSubscriptionLevelAlertsByRegion(context.Context) (AlertListPage, error) +1. AlertsClient.ListSubscriptionLevelAlertsByRegionComplete(context.Context) (AlertListIterator, error) +1. AlertsClient.ListSubscriptionLevelAlertsByRegionPreparer(context.Context) (*http.Request, error) +1. AlertsClient.ListSubscriptionLevelAlertsByRegionResponder(*http.Response) (AlertList, error) +1. AlertsClient.ListSubscriptionLevelAlertsByRegionSender(*http.Request) (*http.Response, error) +1. AlertsClient.UpdateResourceGroupLevelAlertStateToDismiss(context.Context, string, string) (autorest.Response, error) +1. AlertsClient.UpdateResourceGroupLevelAlertStateToDismissPreparer(context.Context, string, string) (*http.Request, error) +1. AlertsClient.UpdateResourceGroupLevelAlertStateToDismissResponder(*http.Response) (autorest.Response, error) +1. AlertsClient.UpdateResourceGroupLevelAlertStateToDismissSender(*http.Request) (*http.Response, error) +1. AlertsClient.UpdateResourceGroupLevelAlertStateToReactivate(context.Context, string, string) (autorest.Response, error) +1. AlertsClient.UpdateResourceGroupLevelAlertStateToReactivatePreparer(context.Context, string, string) (*http.Request, error) +1. AlertsClient.UpdateResourceGroupLevelAlertStateToReactivateResponder(*http.Response) (autorest.Response, error) +1. AlertsClient.UpdateResourceGroupLevelAlertStateToReactivateSender(*http.Request) (*http.Response, error) +1. AlertsClient.UpdateSubscriptionLevelAlertStateToDismiss(context.Context, string) (autorest.Response, error) +1. AlertsClient.UpdateSubscriptionLevelAlertStateToDismissPreparer(context.Context, string) (*http.Request, error) +1. AlertsClient.UpdateSubscriptionLevelAlertStateToDismissResponder(*http.Response) (autorest.Response, error) +1. AlertsClient.UpdateSubscriptionLevelAlertStateToDismissSender(*http.Request) (*http.Response, error) +1. AlertsClient.UpdateSubscriptionLevelAlertStateToReactivate(context.Context, string) (autorest.Response, error) +1. AlertsClient.UpdateSubscriptionLevelAlertStateToReactivatePreparer(context.Context, string) (*http.Request, error) +1. AlertsClient.UpdateSubscriptionLevelAlertStateToReactivateResponder(*http.Response) (autorest.Response, error) +1. AlertsClient.UpdateSubscriptionLevelAlertStateToReactivateSender(*http.Request) (*http.Response, error) +1. IotAlert.MarshalJSON() ([]byte, error) +1. IotAlertList.IsEmpty() bool 1. IotAlertList.MarshalJSON() ([]byte, error) -1. IotAlertListModel.MarshalJSON() ([]byte, error) -1. IotAlertTypeProperties.MarshalJSON() ([]byte, error) -1. IotDefenderSettingsList.MarshalJSON() ([]byte, error) +1. IotAlertListIterator.NotDone() bool +1. IotAlertListIterator.Response() IotAlertList +1. IotAlertListIterator.Value() IotAlert +1. IotAlertListPage.NotDone() bool +1. IotAlertListPage.Response() IotAlertList +1. IotAlertListPage.Values() []IotAlert +1. IotAlertProperties.MarshalJSON() ([]byte, error) +1. IotAlertTypesClient.Get1(context.Context, string) (IotAlertType, error) +1. IotAlertTypesClient.Get1Preparer(context.Context, string) (*http.Request, error) +1. IotAlertTypesClient.Get1Responder(*http.Response) (IotAlertType, error) +1. IotAlertTypesClient.Get1Sender(*http.Request) (*http.Response, error) +1. IotAlertTypesClient.List1(context.Context) (IotAlertTypeList, error) +1. IotAlertTypesClient.List1Preparer(context.Context) (*http.Request, error) +1. IotAlertTypesClient.List1Responder(*http.Response) (IotAlertTypeList, error) +1. IotAlertTypesClient.List1Sender(*http.Request) (*http.Response, error) +1. IotAlertsClient.Get1(context.Context, string, string) (IotAlertModel, error) +1. IotAlertsClient.Get1Preparer(context.Context, string, string) (*http.Request, error) +1. IotAlertsClient.Get1Responder(*http.Response) (IotAlertModel, error) +1. IotAlertsClient.Get1Sender(*http.Request) (*http.Response, error) +1. IotAlertsClient.List1(context.Context, string, string, string, string, ManagementState, string, *int32, string) (IotAlertListModelPage, error) +1. IotAlertsClient.List1Complete(context.Context, string, string, string, string, ManagementState, string, *int32, string) (IotAlertListModelIterator, error) +1. IotAlertsClient.List1Preparer(context.Context, string, string, string, string, ManagementState, string, *int32, string) (*http.Request, error) +1. IotAlertsClient.List1Responder(*http.Response) (IotAlertListModel, error) +1. IotAlertsClient.List1Sender(*http.Request) (*http.Response, error) +1. IotRecommendation.MarshalJSON() ([]byte, error) +1. IotRecommendationList.IsEmpty() bool 1. IotRecommendationList.MarshalJSON() ([]byte, error) -1. IotRecommendationListModel.MarshalJSON() ([]byte, error) -1. IotRecommendationTypeProperties.MarshalJSON() ([]byte, error) -1. IotSensorsList.MarshalJSON() ([]byte, error) -1. IotSitesList.MarshalJSON() ([]byte, error) -1. Location.MarshalJSON() ([]byte, error) -1. MacAddress.MarshalJSON() ([]byte, error) -1. OnPremiseIotSensorsList.MarshalJSON() ([]byte, error) -1. OperationDisplay.MarshalJSON() ([]byte, error) -1. PackageDownloads.MarshalJSON() ([]byte, error) -1. PackageDownloadsCentralManager.MarshalJSON() ([]byte, error) -1. PackageDownloadsCentralManagerFull.MarshalJSON() ([]byte, error) -1. PackageDownloadsCentralManagerFullOvf.MarshalJSON() ([]byte, error) -1. PackageDownloadsSensorFullOvf.MarshalJSON() ([]byte, error) -1. Resource.MarshalJSON() ([]byte, error) -1. ScoreDetails.MarshalJSON() ([]byte, error) -1. SecureScoreControlDefinitionItemProperties.MarshalJSON() ([]byte, error) -1. SecureScoreControlDefinitionList.MarshalJSON() ([]byte, error) -1. SecureScoreControlList.MarshalJSON() ([]byte, error) -1. SecureScoreControlScore.MarshalJSON() ([]byte, error) -1. SecureScoresList.MarshalJSON() ([]byte, error) -1. Sensor.MarshalJSON() ([]byte, error) -1. ServerVulnerabilityAssessmentProperties.MarshalJSON() ([]byte, error) -1. Site.MarshalJSON() ([]byte, error) -1. SubAssessmentList.MarshalJSON() ([]byte, error) -1. SubAssessmentStatus.MarshalJSON() ([]byte, error) -1. TaskList.MarshalJSON() ([]byte, error) -1. TopologyList.MarshalJSON() ([]byte, error) -1. TopologyResourceProperties.MarshalJSON() ([]byte, error) -1. TopologySingleResource.MarshalJSON() ([]byte, error) -1. TopologySingleResourceChild.MarshalJSON() ([]byte, error) -1. TopologySingleResourceParent.MarshalJSON() ([]byte, error) -1. VendorReference.MarshalJSON() ([]byte, error) +1. IotRecommendationListIterator.NotDone() bool +1. IotRecommendationListIterator.Response() IotRecommendationList +1. IotRecommendationListIterator.Value() IotRecommendation +1. IotRecommendationListPage.NotDone() bool +1. IotRecommendationListPage.Response() IotRecommendationList +1. IotRecommendationListPage.Values() []IotRecommendation +1. IotRecommendationProperties.MarshalJSON() ([]byte, error) +1. IotRecommendationTypesClient.Get1(context.Context, string) (IotRecommendationType, error) +1. IotRecommendationTypesClient.Get1Preparer(context.Context, string) (*http.Request, error) +1. IotRecommendationTypesClient.Get1Responder(*http.Response) (IotRecommendationType, error) +1. IotRecommendationTypesClient.Get1Sender(*http.Request) (*http.Response, error) +1. IotRecommendationTypesClient.List1(context.Context) (IotRecommendationTypeList, error) +1. IotRecommendationTypesClient.List1Preparer(context.Context) (*http.Request, error) +1. IotRecommendationTypesClient.List1Responder(*http.Response) (IotRecommendationTypeList, error) +1. IotRecommendationTypesClient.List1Sender(*http.Request) (*http.Response, error) +1. IotRecommendationsClient.Get1(context.Context, string, string) (IotRecommendationModel, error) +1. IotRecommendationsClient.Get1Preparer(context.Context, string, string) (*http.Request, error) +1. IotRecommendationsClient.Get1Responder(*http.Response) (IotRecommendationModel, error) +1. IotRecommendationsClient.Get1Sender(*http.Request) (*http.Response, error) +1. IotRecommendationsClient.List1(context.Context, string, string, string, *int32, string) (IotRecommendationListModelPage, error) +1. IotRecommendationsClient.List1Complete(context.Context, string, string, string, *int32, string) (IotRecommendationListModelIterator, error) +1. IotRecommendationsClient.List1Preparer(context.Context, string, string, string, *int32, string) (*http.Request, error) +1. IotRecommendationsClient.List1Responder(*http.Response) (IotRecommendationListModel, error) +1. IotRecommendationsClient.List1Sender(*http.Request) (*http.Response, error) +1. NewIotAlertListIterator(IotAlertListPage) IotAlertListIterator +1. NewIotAlertListPage(IotAlertList, func(context.Context, IotAlertList) (IotAlertList, error)) IotAlertListPage +1. NewIotRecommendationListIterator(IotRecommendationListPage) IotRecommendationListIterator +1. NewIotRecommendationListPage(IotRecommendationList, func(context.Context, IotRecommendationList) (IotRecommendationList, error)) IotRecommendationListPage +1. PossibleCategoryValues() []Category + +### Struct Changes + +#### Removed Structs + +1. IotAlert +1. IotAlertList +1. IotAlertListIterator +1. IotAlertListPage +1. IotAlertProperties +1. IotRecommendation +1. IotRecommendationList +1. IotRecommendationListIterator +1. IotRecommendationListPage +1. IotRecommendationProperties + +#### Removed Struct Fields + +1. AssessmentMetadataProperties.Category + +### Signature Changes + +#### Const Types + +1. Alerts changed type from EventSource to AdditionalWorkspaceDataType +1. Compute changed type from Category to Categories +1. Data changed type from Category to Categories +1. IdentityAndAccess changed type from Category to Categories +1. IoT changed type from Category to Categories +1. Networking changed type from Category to Categories +1. None changed type from EnforcementMode to EndOfSupportStatus +1. RawEvents changed type from ExportData to AdditionalWorkspaceDataType + +#### Funcs + +1. IotAlertTypesClient.Get + - Params + - From: context.Context, string, string, string + - To: context.Context, string +1. IotAlertTypesClient.GetPreparer + - Params + - From: context.Context, string, string, string + - To: context.Context, string +1. IotAlertTypesClient.List + - Params + - From: context.Context, string, string + - To: context.Context +1. IotAlertTypesClient.ListPreparer + - Params + - From: context.Context, string, string + - To: context.Context +1. IotAlertsClient.Get + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string + - Returns + - From: IotAlert, error + - To: IotAlertModel, error +1. IotAlertsClient.GetPreparer + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string +1. IotAlertsClient.GetResponder + - Returns + - From: IotAlert, error + - To: IotAlertModel, error +1. IotAlertsClient.List + - Params + - From: context.Context, string, string, string, string, string, string, *int32, string + - To: context.Context, string, string, string, string, ManagementState, string, *int32, string + - Returns + - From: IotAlertListPage, error + - To: IotAlertListModelPage, error +1. IotAlertsClient.ListComplete + - Params + - From: context.Context, string, string, string, string, string, string, *int32, string + - To: context.Context, string, string, string, string, ManagementState, string, *int32, string + - Returns + - From: IotAlertListIterator, error + - To: IotAlertListModelIterator, error +1. IotAlertsClient.ListPreparer + - Params + - From: context.Context, string, string, string, string, string, string, *int32, string + - To: context.Context, string, string, string, string, ManagementState, string, *int32, string +1. IotAlertsClient.ListResponder + - Returns + - From: IotAlertList, error + - To: IotAlertListModel, error +1. IotRecommendationTypesClient.Get + - Params + - From: context.Context, string, string, string + - To: context.Context, string +1. IotRecommendationTypesClient.GetPreparer + - Params + - From: context.Context, string, string, string + - To: context.Context, string +1. IotRecommendationTypesClient.List + - Params + - From: context.Context, string, string + - To: context.Context +1. IotRecommendationTypesClient.ListPreparer + - Params + - From: context.Context, string, string + - To: context.Context +1. IotRecommendationsClient.Get + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string + - Returns + - From: IotRecommendation, error + - To: IotRecommendationModel, error +1. IotRecommendationsClient.GetPreparer + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string +1. IotRecommendationsClient.GetResponder + - Returns + - From: IotRecommendation, error + - To: IotRecommendationModel, error +1. IotRecommendationsClient.List + - Params + - From: context.Context, string, string, string, string, *int32, string + - To: context.Context, string, string, string, *int32, string + - Returns + - From: IotRecommendationListPage, error + - To: IotRecommendationListModelPage, error +1. IotRecommendationsClient.ListComplete + - Params + - From: context.Context, string, string, string, string, *int32, string + - To: context.Context, string, string, string, *int32, string + - Returns + - From: IotRecommendationListIterator, error + - To: IotRecommendationListModelIterator, error +1. IotRecommendationsClient.ListPreparer + - Params + - From: context.Context, string, string, string, string, *int32, string + - To: context.Context, string, string, string, *int32, string +1. IotRecommendationsClient.ListResponder + - Returns + - From: IotRecommendationList, error + - To: IotRecommendationListModel, error +1. ServerVulnerabilityAssessmentClient.Delete + - Returns + - From: autorest.Response, error + - To: ServerVulnerabilityAssessmentDeleteFuture, error +1. ServerVulnerabilityAssessmentClient.DeleteSender + - Returns + - From: *http.Response, error + - To: ServerVulnerabilityAssessmentDeleteFuture, error + +#### Struct Fields + +1. IoTSecurityAggregatedAlertProperties.Count changed type from *int32 to *int64 +1. IoTSecurityAggregatedAlertPropertiesTopDevicesListItem.AlertsCount changed type from *int32 to *int64 +1. IoTSecurityAggregatedRecommendationProperties.HealthyDevices changed type from *int32 to *int64 +1. IoTSecurityAggregatedRecommendationProperties.UnhealthyDeviceCount changed type from *int32 to *int64 +1. IoTSecurityAlertedDevice.AlertsCount changed type from *int32 to *int64 +1. IoTSecurityDeviceAlert.AlertsCount changed type from *int32 to *int64 +1. IoTSecurityDeviceRecommendation.DevicesCount changed type from *int32 to *int64 +1. IoTSecuritySolutionAnalyticsModelProperties.UnhealthyDeviceCount changed type from *int32 to *int64 +1. IoTSeverityMetrics.High changed type from *int32 to *int64 +1. IoTSeverityMetrics.Low changed type from *int32 to *int64 +1. IoTSeverityMetrics.Medium changed type from *int32 to *int64 + +## Additive Changes + +### New Constants + +1. AdditionalWorkspaceType.Sentinel +1. BundleType.AppServices +1. BundleType.DNS +1. BundleType.KeyVaults +1. BundleType.KubernetesService +1. BundleType.ResourceManager +1. BundleType.SQLServers +1. BundleType.StorageAccounts +1. BundleType.VirtualMachines +1. CreatedByType.Application +1. CreatedByType.Key +1. CreatedByType.ManagedIdentity +1. CreatedByType.User +1. EndOfSupportStatus.NoLongerSupported +1. EndOfSupportStatus.UpcomingNoLongerSupported +1. EndOfSupportStatus.UpcomingVersionNoLongerSupported +1. EndOfSupportStatus.VersionNoLongerSupported +1. EnforcementMode.EnforcementModeAudit +1. EnforcementMode.EnforcementModeEnforce +1. EnforcementMode.EnforcementModeNone +1. EventSource.EventSourceAlerts +1. EventSource.EventSourceAssessments +1. EventSource.EventSourceRegulatoryComplianceAssessment +1. EventSource.EventSourceRegulatoryComplianceAssessmentSnapshot +1. EventSource.EventSourceSecureScoreControls +1. EventSource.EventSourceSecureScoreControlsSnapshot +1. EventSource.EventSourceSecureScores +1. EventSource.EventSourceSecureScoresSnapshot +1. EventSource.EventSourceSubAssessments +1. ExportData.ExportDataRawEvents +1. KindEnum2.KindAlertSimulatorRequestProperties +1. KindEnum2.KindBundles +1. OnboardingKind.Default +1. OnboardingKind.MigratedToAzure +1. RuleTypeBasicCustomAlertRule.RuleTypeConnectionFromIPNotAllowed +1. SensorType.SensorTypeEnterprise +1. SensorType.SensorTypeOt + +### New Funcs + +1. *AlertSimulatorBundlesRequestProperties.UnmarshalJSON([]byte) error +1. *AlertSimulatorRequestBody.UnmarshalJSON([]byte) error +1. *AlertSimulatorRequestProperties.UnmarshalJSON([]byte) error +1. *AlertsSimulateFuture.UnmarshalJSON([]byte) error +1. *IngestionSettingListIterator.Next() error +1. *IngestionSettingListIterator.NextWithContext(context.Context) error +1. *IngestionSettingListPage.Next() error +1. *IngestionSettingListPage.NextWithContext(context.Context) error +1. *ServerVulnerabilityAssessmentDeleteFuture.UnmarshalJSON([]byte) error +1. *Software.UnmarshalJSON([]byte) error +1. *SoftwaresListIterator.Next() error +1. *SoftwaresListIterator.NextWithContext(context.Context) error +1. *SoftwaresListPage.Next() error +1. *SoftwaresListPage.NextWithContext(context.Context) error +1. ActiveConnectionsNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. AlertSimulatorBundlesRequestProperties.AsAlertSimulatorBundlesRequestProperties() (*AlertSimulatorBundlesRequestProperties, bool) +1. AlertSimulatorBundlesRequestProperties.AsAlertSimulatorRequestProperties() (*AlertSimulatorRequestProperties, bool) +1. AlertSimulatorBundlesRequestProperties.AsBasicAlertSimulatorRequestProperties() (BasicAlertSimulatorRequestProperties, bool) +1. AlertSimulatorBundlesRequestProperties.MarshalJSON() ([]byte, error) +1. AlertSimulatorRequestProperties.AsAlertSimulatorBundlesRequestProperties() (*AlertSimulatorBundlesRequestProperties, bool) +1. AlertSimulatorRequestProperties.AsAlertSimulatorRequestProperties() (*AlertSimulatorRequestProperties, bool) +1. AlertSimulatorRequestProperties.AsBasicAlertSimulatorRequestProperties() (BasicAlertSimulatorRequestProperties, bool) +1. AlertSimulatorRequestProperties.MarshalJSON() ([]byte, error) +1. AlertsClient.GetResourceGroupLevel(context.Context, string, string) (Alert, error) +1. AlertsClient.GetResourceGroupLevelPreparer(context.Context, string, string) (*http.Request, error) +1. AlertsClient.GetResourceGroupLevelResponder(*http.Response) (Alert, error) +1. AlertsClient.GetResourceGroupLevelSender(*http.Request) (*http.Response, error) +1. AlertsClient.GetSubscriptionLevel(context.Context, string) (Alert, error) +1. AlertsClient.GetSubscriptionLevelPreparer(context.Context, string) (*http.Request, error) +1. AlertsClient.GetSubscriptionLevelResponder(*http.Response) (Alert, error) +1. AlertsClient.GetSubscriptionLevelSender(*http.Request) (*http.Response, error) +1. AlertsClient.ListResourceGroupLevelByRegion(context.Context, string) (AlertListPage, error) +1. AlertsClient.ListResourceGroupLevelByRegionComplete(context.Context, string) (AlertListIterator, error) +1. AlertsClient.ListResourceGroupLevelByRegionPreparer(context.Context, string) (*http.Request, error) +1. AlertsClient.ListResourceGroupLevelByRegionResponder(*http.Response) (AlertList, error) +1. AlertsClient.ListResourceGroupLevelByRegionSender(*http.Request) (*http.Response, error) +1. AlertsClient.ListSubscriptionLevelByRegion(context.Context) (AlertListPage, error) +1. AlertsClient.ListSubscriptionLevelByRegionComplete(context.Context) (AlertListIterator, error) +1. AlertsClient.ListSubscriptionLevelByRegionPreparer(context.Context) (*http.Request, error) +1. AlertsClient.ListSubscriptionLevelByRegionResponder(*http.Response) (AlertList, error) +1. AlertsClient.ListSubscriptionLevelByRegionSender(*http.Request) (*http.Response, error) +1. AlertsClient.Simulate(context.Context, AlertSimulatorRequestBody) (AlertsSimulateFuture, error) +1. AlertsClient.SimulatePreparer(context.Context, AlertSimulatorRequestBody) (*http.Request, error) +1. AlertsClient.SimulateResponder(*http.Response) (autorest.Response, error) +1. AlertsClient.SimulateSender(*http.Request) (AlertsSimulateFuture, error) +1. AlertsClient.UpdateResourceGroupLevelStateToActivate(context.Context, string, string) (autorest.Response, error) +1. AlertsClient.UpdateResourceGroupLevelStateToActivatePreparer(context.Context, string, string) (*http.Request, error) +1. AlertsClient.UpdateResourceGroupLevelStateToActivateResponder(*http.Response) (autorest.Response, error) +1. AlertsClient.UpdateResourceGroupLevelStateToActivateSender(*http.Request) (*http.Response, error) +1. AlertsClient.UpdateResourceGroupLevelStateToDismiss(context.Context, string, string) (autorest.Response, error) +1. AlertsClient.UpdateResourceGroupLevelStateToDismissPreparer(context.Context, string, string) (*http.Request, error) +1. AlertsClient.UpdateResourceGroupLevelStateToDismissResponder(*http.Response) (autorest.Response, error) +1. AlertsClient.UpdateResourceGroupLevelStateToDismissSender(*http.Request) (*http.Response, error) +1. AlertsClient.UpdateSubscriptionLevelStateToActivate(context.Context, string) (autorest.Response, error) +1. AlertsClient.UpdateSubscriptionLevelStateToActivatePreparer(context.Context, string) (*http.Request, error) +1. AlertsClient.UpdateSubscriptionLevelStateToActivateResponder(*http.Response) (autorest.Response, error) +1. AlertsClient.UpdateSubscriptionLevelStateToActivateSender(*http.Request) (*http.Response, error) +1. AlertsClient.UpdateSubscriptionLevelStateToDismiss(context.Context, string) (autorest.Response, error) +1. AlertsClient.UpdateSubscriptionLevelStateToDismissPreparer(context.Context, string) (*http.Request, error) +1. AlertsClient.UpdateSubscriptionLevelStateToDismissResponder(*http.Response) (autorest.Response, error) +1. AlertsClient.UpdateSubscriptionLevelStateToDismissSender(*http.Request) (*http.Response, error) +1. AllowlistCustomAlertRule.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. AmqpC2DMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. AmqpC2DRejectedMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. AmqpD2CMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. ConnectionFromIPNotAllowed.AsActiveConnectionsNotInAllowedRange() (*ActiveConnectionsNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) +1. ConnectionFromIPNotAllowed.AsAmqpC2DMessagesNotInAllowedRange() (*AmqpC2DMessagesNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsAmqpC2DRejectedMessagesNotInAllowedRange() (*AmqpC2DRejectedMessagesNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsAmqpD2CMessagesNotInAllowedRange() (*AmqpD2CMessagesNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsBasicAllowlistCustomAlertRule() (BasicAllowlistCustomAlertRule, bool) +1. ConnectionFromIPNotAllowed.AsBasicCustomAlertRule() (BasicCustomAlertRule, bool) +1. ConnectionFromIPNotAllowed.AsBasicListCustomAlertRule() (BasicListCustomAlertRule, bool) +1. ConnectionFromIPNotAllowed.AsBasicThresholdCustomAlertRule() (BasicThresholdCustomAlertRule, bool) +1. ConnectionFromIPNotAllowed.AsBasicTimeWindowCustomAlertRule() (BasicTimeWindowCustomAlertRule, bool) +1. ConnectionFromIPNotAllowed.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. ConnectionFromIPNotAllowed.AsConnectionToIPNotAllowed() (*ConnectionToIPNotAllowed, bool) +1. ConnectionFromIPNotAllowed.AsCustomAlertRule() (*CustomAlertRule, bool) +1. ConnectionFromIPNotAllowed.AsDenylistCustomAlertRule() (*DenylistCustomAlertRule, bool) +1. ConnectionFromIPNotAllowed.AsDirectMethodInvokesNotInAllowedRange() (*DirectMethodInvokesNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsFileUploadsNotInAllowedRange() (*FileUploadsNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsHTTPC2DMessagesNotInAllowedRange() (*HTTPC2DMessagesNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsHTTPC2DRejectedMessagesNotInAllowedRange() (*HTTPC2DRejectedMessagesNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsHTTPD2CMessagesNotInAllowedRange() (*HTTPD2CMessagesNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsListCustomAlertRule() (*ListCustomAlertRule, bool) +1. ConnectionFromIPNotAllowed.AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) +1. ConnectionFromIPNotAllowed.AsMqttC2DMessagesNotInAllowedRange() (*MqttC2DMessagesNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsMqttC2DRejectedMessagesNotInAllowedRange() (*MqttC2DRejectedMessagesNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsMqttD2CMessagesNotInAllowedRange() (*MqttD2CMessagesNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsProcessNotAllowed() (*ProcessNotAllowed, bool) +1. ConnectionFromIPNotAllowed.AsQueuePurgesNotInAllowedRange() (*QueuePurgesNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsThresholdCustomAlertRule() (*ThresholdCustomAlertRule, bool) +1. ConnectionFromIPNotAllowed.AsTimeWindowCustomAlertRule() (*TimeWindowCustomAlertRule, bool) +1. ConnectionFromIPNotAllowed.AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.AsUnauthorizedOperationsNotInAllowedRange() (*UnauthorizedOperationsNotInAllowedRange, bool) +1. ConnectionFromIPNotAllowed.MarshalJSON() ([]byte, error) +1. ConnectionToIPNotAllowed.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. CustomAlertRule.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. DenylistCustomAlertRule.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. DirectMethodInvokesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. ErrorAdditionalInfo.MarshalJSON() ([]byte, error) +1. FailedLocalLoginsNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. FileUploadsNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. HTTPC2DMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. HTTPC2DRejectedMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. HTTPD2CMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. IngestionConnectionString.MarshalJSON() ([]byte, error) +1. IngestionSetting.MarshalJSON() ([]byte, error) +1. IngestionSettingList.IsEmpty() bool +1. IngestionSettingList.MarshalJSON() ([]byte, error) +1. IngestionSettingListIterator.NotDone() bool +1. IngestionSettingListIterator.Response() IngestionSettingList +1. IngestionSettingListIterator.Value() IngestionSetting +1. IngestionSettingListPage.NotDone() bool +1. IngestionSettingListPage.Response() IngestionSettingList +1. IngestionSettingListPage.Values() []IngestionSetting +1. IngestionSettingToken.MarshalJSON() ([]byte, error) +1. IngestionSettingsClient.Create(context.Context, string, IngestionSetting) (IngestionSetting, error) +1. IngestionSettingsClient.CreatePreparer(context.Context, string, IngestionSetting) (*http.Request, error) +1. IngestionSettingsClient.CreateResponder(*http.Response) (IngestionSetting, error) +1. IngestionSettingsClient.CreateSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.Delete(context.Context, string) (autorest.Response, error) +1. IngestionSettingsClient.DeletePreparer(context.Context, string) (*http.Request, error) +1. IngestionSettingsClient.DeleteResponder(*http.Response) (autorest.Response, error) +1. IngestionSettingsClient.DeleteSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.Get(context.Context, string) (IngestionSetting, error) +1. IngestionSettingsClient.GetPreparer(context.Context, string) (*http.Request, error) +1. IngestionSettingsClient.GetResponder(*http.Response) (IngestionSetting, error) +1. IngestionSettingsClient.GetSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.List(context.Context) (IngestionSettingListPage, error) +1. IngestionSettingsClient.ListComplete(context.Context) (IngestionSettingListIterator, error) +1. IngestionSettingsClient.ListConnectionStrings(context.Context, string) (ConnectionStrings, error) +1. IngestionSettingsClient.ListConnectionStringsPreparer(context.Context, string) (*http.Request, error) +1. IngestionSettingsClient.ListConnectionStringsResponder(*http.Response) (ConnectionStrings, error) +1. IngestionSettingsClient.ListConnectionStringsSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.ListPreparer(context.Context) (*http.Request, error) +1. IngestionSettingsClient.ListResponder(*http.Response) (IngestionSettingList, error) +1. IngestionSettingsClient.ListSender(*http.Request) (*http.Response, error) +1. IngestionSettingsClient.ListTokens(context.Context, string) (IngestionSettingToken, error) +1. IngestionSettingsClient.ListTokensPreparer(context.Context, string) (*http.Request, error) +1. IngestionSettingsClient.ListTokensResponder(*http.Response) (IngestionSettingToken, error) +1. IngestionSettingsClient.ListTokensSender(*http.Request) (*http.Response, error) +1. ListCustomAlertRule.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. LocalUserNotAllowed.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. MqttC2DMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. MqttC2DRejectedMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. MqttD2CMessagesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. NewIngestionSettingListIterator(IngestionSettingListPage) IngestionSettingListIterator +1. NewIngestionSettingListPage(IngestionSettingList, func(context.Context, IngestionSettingList) (IngestionSettingList, error)) IngestionSettingListPage +1. NewIngestionSettingsClient(string, string) IngestionSettingsClient +1. NewIngestionSettingsClientWithBaseURI(string, string, string) IngestionSettingsClient +1. NewSoftwareInventoriesClient(string, string) SoftwareInventoriesClient +1. NewSoftwareInventoriesClientWithBaseURI(string, string, string) SoftwareInventoriesClient +1. NewSoftwaresListIterator(SoftwaresListPage) SoftwaresListIterator +1. NewSoftwaresListPage(SoftwaresList, func(context.Context, SoftwaresList) (SoftwaresList, error)) SoftwaresListPage +1. PossibleAdditionalWorkspaceDataTypeValues() []AdditionalWorkspaceDataType +1. PossibleAdditionalWorkspaceTypeValues() []AdditionalWorkspaceType +1. PossibleBundleTypeValues() []BundleType +1. PossibleCategoriesValues() []Categories +1. PossibleCreatedByTypeValues() []CreatedByType +1. PossibleEndOfSupportStatusValues() []EndOfSupportStatus +1. PossibleKindEnum2Values() []KindEnum2 +1. PossibleOnboardingKindValues() []OnboardingKind +1. PossibleSensorTypeValues() []SensorType +1. ProcessNotAllowed.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. QueuePurgesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. Software.MarshalJSON() ([]byte, error) +1. SoftwareInventoriesClient.Get(context.Context, string, string, string, string, string) (Software, error) +1. SoftwareInventoriesClient.GetPreparer(context.Context, string, string, string, string, string) (*http.Request, error) +1. SoftwareInventoriesClient.GetResponder(*http.Response) (Software, error) +1. SoftwareInventoriesClient.GetSender(*http.Request) (*http.Response, error) +1. SoftwareInventoriesClient.ListByExtendedResource(context.Context, string, string, string, string) (SoftwaresListPage, error) +1. SoftwareInventoriesClient.ListByExtendedResourceComplete(context.Context, string, string, string, string) (SoftwaresListIterator, error) +1. SoftwareInventoriesClient.ListByExtendedResourcePreparer(context.Context, string, string, string, string) (*http.Request, error) +1. SoftwareInventoriesClient.ListByExtendedResourceResponder(*http.Response) (SoftwaresList, error) +1. SoftwareInventoriesClient.ListByExtendedResourceSender(*http.Request) (*http.Response, error) +1. SoftwareInventoriesClient.ListBySubscription(context.Context) (SoftwaresListPage, error) +1. SoftwareInventoriesClient.ListBySubscriptionComplete(context.Context) (SoftwaresListIterator, error) +1. SoftwareInventoriesClient.ListBySubscriptionPreparer(context.Context) (*http.Request, error) +1. SoftwareInventoriesClient.ListBySubscriptionResponder(*http.Response) (SoftwaresList, error) +1. SoftwareInventoriesClient.ListBySubscriptionSender(*http.Request) (*http.Response, error) +1. SoftwaresList.IsEmpty() bool +1. SoftwaresList.MarshalJSON() ([]byte, error) +1. SoftwaresListIterator.NotDone() bool +1. SoftwaresListIterator.Response() SoftwaresList +1. SoftwaresListIterator.Value() Software +1. SoftwaresListPage.NotDone() bool +1. SoftwaresListPage.Response() SoftwaresList +1. SoftwaresListPage.Values() []Software +1. ThresholdCustomAlertRule.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. TimeWindowCustomAlertRule.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. TwinUpdatesNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) +1. UnauthorizedOperationsNotInAllowedRange.AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) + +### Struct Changes + +#### New Structs + +1. AdditionalWorkspacesProperties +1. AlertSimulatorBundlesRequestProperties +1. AlertSimulatorRequestBody +1. AlertSimulatorRequestProperties +1. AlertsSimulateFuture +1. ConnectionFromIPNotAllowed +1. ConnectionStrings +1. ErrorAdditionalInfo +1. IngestionConnectionString +1. IngestionSetting +1. IngestionSettingList +1. IngestionSettingListIterator +1. IngestionSettingListPage +1. IngestionSettingToken +1. IngestionSettingsClient +1. ServerVulnerabilityAssessmentDeleteFuture +1. Software +1. SoftwareInventoriesClient +1. SoftwareProperties +1. SoftwaresList +1. SoftwaresListIterator +1. SoftwaresListPage +1. SystemData + +#### New Struct Fields + +1. AssessmentMetadataProperties.Categories +1. CloudErrorBody.AdditionalInfo +1. CloudErrorBody.Details +1. CloudErrorBody.Target +1. IoTSecuritySolutionModel.SystemData +1. IoTSecuritySolutionProperties.AdditionalWorkspaces +1. IotAlertModel.ID +1. IotAlertModel.Name +1. IotAlertModel.Type +1. IotDefenderSettingsProperties.OnboardingKind +1. IotSensorProperties.SensorType diff --git a/services/preview/security/mgmt/v3.0/security/_meta.json b/services/preview/security/mgmt/v3.0/security/_meta.json index fa4db040bff6..5f95c7bcb6c4 100644 --- a/services/preview/security/mgmt/v3.0/security/_meta.json +++ b/services/preview/security/mgmt/v3.0/security/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3a3a9452f965a227ce43e6b545035b99dd175f23", + "commit": "2b0b50e3e5bd467aa039a51cafa2a071593eca28", "readme": "/_/azure-rest-api-specs/specification/security/resource-manager/readme.md", "tag": "package-composite-v3", "use": "@microsoft.azure/autorest.go@2.1.183", diff --git a/services/preview/security/mgmt/v3.0/security/alerts.go b/services/preview/security/mgmt/v3.0/security/alerts.go index 1076bb2ad6ad..700b821ab120 100644 --- a/services/preview/security/mgmt/v3.0/security/alerts.go +++ b/services/preview/security/mgmt/v3.0/security/alerts.go @@ -31,14 +31,14 @@ func NewAlertsClientWithBaseURI(baseURI string, subscriptionID string, ascLocati return AlertsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} } -// GetResourceGroupLevelAlerts get an alert that is associated a resource group or a resource in a resource group +// GetResourceGroupLevel get an alert that is associated a resource group or a resource in a resource group // Parameters: // alertName - name of the alert object // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -func (client AlertsClient) GetResourceGroupLevelAlerts(ctx context.Context, alertName string, resourceGroupName string) (result Alert, err error) { +func (client AlertsClient) GetResourceGroupLevel(ctx context.Context, alertName string, resourceGroupName string) (result Alert, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.GetResourceGroupLevelAlerts") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.GetResourceGroupLevel") defer func() { sc := -1 if result.Response.Response != nil { @@ -54,33 +54,33 @@ func (client AlertsClient) GetResourceGroupLevelAlerts(ctx context.Context, aler 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("security.AlertsClient", "GetResourceGroupLevelAlerts", err.Error()) + return result, validation.NewError("security.AlertsClient", "GetResourceGroupLevel", err.Error()) } - req, err := client.GetResourceGroupLevelAlertsPreparer(ctx, alertName, resourceGroupName) + req, err := client.GetResourceGroupLevelPreparer(ctx, alertName, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "GetResourceGroupLevelAlerts", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "GetResourceGroupLevel", nil, "Failure preparing request") return } - resp, err := client.GetResourceGroupLevelAlertsSender(req) + resp, err := client.GetResourceGroupLevelSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.AlertsClient", "GetResourceGroupLevelAlerts", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "GetResourceGroupLevel", resp, "Failure sending request") return } - result, err = client.GetResourceGroupLevelAlertsResponder(resp) + result, err = client.GetResourceGroupLevelResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "GetResourceGroupLevelAlerts", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "GetResourceGroupLevel", resp, "Failure responding to request") return } return } -// GetResourceGroupLevelAlertsPreparer prepares the GetResourceGroupLevelAlerts request. -func (client AlertsClient) GetResourceGroupLevelAlertsPreparer(ctx context.Context, alertName string, resourceGroupName string) (*http.Request, error) { +// GetResourceGroupLevelPreparer prepares the GetResourceGroupLevel request. +func (client AlertsClient) GetResourceGroupLevelPreparer(ctx context.Context, alertName string, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "alertName": autorest.Encode("path", alertName), "ascLocation": autorest.Encode("path", client.AscLocation), @@ -88,7 +88,7 @@ func (client AlertsClient) GetResourceGroupLevelAlertsPreparer(ctx context.Conte "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-01-01" + const APIVersion = "2021-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -101,15 +101,15 @@ func (client AlertsClient) GetResourceGroupLevelAlertsPreparer(ctx context.Conte return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetResourceGroupLevelAlertsSender sends the GetResourceGroupLevelAlerts request. The method will close the +// GetResourceGroupLevelSender sends the GetResourceGroupLevel request. The method will close the // http.Response Body if it receives an error. -func (client AlertsClient) GetResourceGroupLevelAlertsSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) GetResourceGroupLevelSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// GetResourceGroupLevelAlertsResponder handles the response to the GetResourceGroupLevelAlerts request. The method always +// GetResourceGroupLevelResponder handles the response to the GetResourceGroupLevel request. The method always // closes the http.Response Body. -func (client AlertsClient) GetResourceGroupLevelAlertsResponder(resp *http.Response) (result Alert, err error) { +func (client AlertsClient) GetResourceGroupLevelResponder(resp *http.Response) (result Alert, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -119,12 +119,12 @@ func (client AlertsClient) GetResourceGroupLevelAlertsResponder(resp *http.Respo return } -// GetSubscriptionLevelAlert get an alert that is associated with a subscription +// GetSubscriptionLevel get an alert that is associated with a subscription // Parameters: // alertName - name of the alert object -func (client AlertsClient) GetSubscriptionLevelAlert(ctx context.Context, alertName string) (result Alert, err error) { +func (client AlertsClient) GetSubscriptionLevel(ctx context.Context, alertName string) (result Alert, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.GetSubscriptionLevelAlert") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.GetSubscriptionLevel") defer func() { sc := -1 if result.Response.Response != nil { @@ -136,40 +136,40 @@ func (client AlertsClient) GetSubscriptionLevelAlert(ctx context.Context, alertN if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.AlertsClient", "GetSubscriptionLevelAlert", err.Error()) + return result, validation.NewError("security.AlertsClient", "GetSubscriptionLevel", err.Error()) } - req, err := client.GetSubscriptionLevelAlertPreparer(ctx, alertName) + req, err := client.GetSubscriptionLevelPreparer(ctx, alertName) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "GetSubscriptionLevelAlert", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "GetSubscriptionLevel", nil, "Failure preparing request") return } - resp, err := client.GetSubscriptionLevelAlertSender(req) + resp, err := client.GetSubscriptionLevelSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.AlertsClient", "GetSubscriptionLevelAlert", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "GetSubscriptionLevel", resp, "Failure sending request") return } - result, err = client.GetSubscriptionLevelAlertResponder(resp) + result, err = client.GetSubscriptionLevelResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "GetSubscriptionLevelAlert", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "GetSubscriptionLevel", resp, "Failure responding to request") return } return } -// GetSubscriptionLevelAlertPreparer prepares the GetSubscriptionLevelAlert request. -func (client AlertsClient) GetSubscriptionLevelAlertPreparer(ctx context.Context, alertName string) (*http.Request, error) { +// GetSubscriptionLevelPreparer prepares the GetSubscriptionLevel request. +func (client AlertsClient) GetSubscriptionLevelPreparer(ctx context.Context, alertName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "alertName": autorest.Encode("path", alertName), "ascLocation": autorest.Encode("path", client.AscLocation), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-01-01" + const APIVersion = "2021-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -182,15 +182,15 @@ func (client AlertsClient) GetSubscriptionLevelAlertPreparer(ctx context.Context return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetSubscriptionLevelAlertSender sends the GetSubscriptionLevelAlert request. The method will close the +// GetSubscriptionLevelSender sends the GetSubscriptionLevel request. The method will close the // http.Response Body if it receives an error. -func (client AlertsClient) GetSubscriptionLevelAlertSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) GetSubscriptionLevelSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// GetSubscriptionLevelAlertResponder handles the response to the GetSubscriptionLevelAlert request. The method always +// GetSubscriptionLevelResponder handles the response to the GetSubscriptionLevel request. The method always // closes the http.Response Body. -func (client AlertsClient) GetSubscriptionLevelAlertResponder(resp *http.Response) (result Alert, err error) { +func (client AlertsClient) GetSubscriptionLevelResponder(resp *http.Response) (result Alert, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -251,7 +251,7 @@ func (client AlertsClient) ListPreparer(ctx context.Context) (*http.Request, err "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-01-01" + const APIVersion = "2021-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -378,7 +378,7 @@ func (client AlertsClient) ListByResourceGroupPreparer(ctx context.Context, reso "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-01-01" + const APIVersion = "2021-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -446,14 +446,14 @@ func (client AlertsClient) ListByResourceGroupComplete(ctx context.Context, reso return } -// ListResourceGroupLevelAlertsByRegion list all the alerts that are associated with the resource group that are stored -// in a specific location +// ListResourceGroupLevelByRegion list all the alerts that are associated with the resource group that are stored in a +// specific location // Parameters: // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -func (client AlertsClient) ListResourceGroupLevelAlertsByRegion(ctx context.Context, resourceGroupName string) (result AlertListPage, err error) { +func (client AlertsClient) ListResourceGroupLevelByRegion(ctx context.Context, resourceGroupName string) (result AlertListPage, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListResourceGroupLevelAlertsByRegion") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListResourceGroupLevelByRegion") defer func() { sc := -1 if result.al.Response.Response != nil { @@ -469,26 +469,26 @@ func (client AlertsClient) ListResourceGroupLevelAlertsByRegion(ctx context.Cont 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("security.AlertsClient", "ListResourceGroupLevelAlertsByRegion", err.Error()) + return result, validation.NewError("security.AlertsClient", "ListResourceGroupLevelByRegion", err.Error()) } - result.fn = client.listResourceGroupLevelAlertsByRegionNextResults - req, err := client.ListResourceGroupLevelAlertsByRegionPreparer(ctx, resourceGroupName) + result.fn = client.listResourceGroupLevelByRegionNextResults + req, err := client.ListResourceGroupLevelByRegionPreparer(ctx, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListResourceGroupLevelAlertsByRegion", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListResourceGroupLevelByRegion", nil, "Failure preparing request") return } - resp, err := client.ListResourceGroupLevelAlertsByRegionSender(req) + resp, err := client.ListResourceGroupLevelByRegionSender(req) if err != nil { result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListResourceGroupLevelAlertsByRegion", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListResourceGroupLevelByRegion", resp, "Failure sending request") return } - result.al, err = client.ListResourceGroupLevelAlertsByRegionResponder(resp) + result.al, err = client.ListResourceGroupLevelByRegionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListResourceGroupLevelAlertsByRegion", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListResourceGroupLevelByRegion", resp, "Failure responding to request") return } if result.al.hasNextLink() && result.al.IsEmpty() { @@ -499,15 +499,15 @@ func (client AlertsClient) ListResourceGroupLevelAlertsByRegion(ctx context.Cont return } -// ListResourceGroupLevelAlertsByRegionPreparer prepares the ListResourceGroupLevelAlertsByRegion request. -func (client AlertsClient) ListResourceGroupLevelAlertsByRegionPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { +// ListResourceGroupLevelByRegionPreparer prepares the ListResourceGroupLevelByRegion request. +func (client AlertsClient) ListResourceGroupLevelByRegionPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "ascLocation": autorest.Encode("path", client.AscLocation), "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-01-01" + const APIVersion = "2021-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -520,15 +520,15 @@ func (client AlertsClient) ListResourceGroupLevelAlertsByRegionPreparer(ctx cont return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// ListResourceGroupLevelAlertsByRegionSender sends the ListResourceGroupLevelAlertsByRegion request. The method will close the +// ListResourceGroupLevelByRegionSender sends the ListResourceGroupLevelByRegion request. The method will close the // http.Response Body if it receives an error. -func (client AlertsClient) ListResourceGroupLevelAlertsByRegionSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) ListResourceGroupLevelByRegionSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// ListResourceGroupLevelAlertsByRegionResponder handles the response to the ListResourceGroupLevelAlertsByRegion request. The method always +// ListResourceGroupLevelByRegionResponder handles the response to the ListResourceGroupLevelByRegion request. The method always // closes the http.Response Body. -func (client AlertsClient) ListResourceGroupLevelAlertsByRegionResponder(resp *http.Response) (result AlertList, err error) { +func (client AlertsClient) ListResourceGroupLevelByRegionResponder(resp *http.Response) (result AlertList, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -538,31 +538,31 @@ func (client AlertsClient) ListResourceGroupLevelAlertsByRegionResponder(resp *h return } -// listResourceGroupLevelAlertsByRegionNextResults retrieves the next set of results, if any. -func (client AlertsClient) listResourceGroupLevelAlertsByRegionNextResults(ctx context.Context, lastResults AlertList) (result AlertList, err error) { +// listResourceGroupLevelByRegionNextResults retrieves the next set of results, if any. +func (client AlertsClient) listResourceGroupLevelByRegionNextResults(ctx context.Context, lastResults AlertList) (result AlertList, err error) { req, err := lastResults.alertListPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "security.AlertsClient", "listResourceGroupLevelAlertsByRegionNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "security.AlertsClient", "listResourceGroupLevelByRegionNextResults", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.ListResourceGroupLevelAlertsByRegionSender(req) + resp, err := client.ListResourceGroupLevelByRegionSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "security.AlertsClient", "listResourceGroupLevelAlertsByRegionNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "security.AlertsClient", "listResourceGroupLevelByRegionNextResults", resp, "Failure sending next results request") } - result, err = client.ListResourceGroupLevelAlertsByRegionResponder(resp) + result, err = client.ListResourceGroupLevelByRegionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "listResourceGroupLevelAlertsByRegionNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "listResourceGroupLevelByRegionNextResults", resp, "Failure responding to next results request") } return } -// ListResourceGroupLevelAlertsByRegionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AlertsClient) ListResourceGroupLevelAlertsByRegionComplete(ctx context.Context, resourceGroupName string) (result AlertListIterator, err error) { +// ListResourceGroupLevelByRegionComplete enumerates all values, automatically crossing page boundaries as required. +func (client AlertsClient) ListResourceGroupLevelByRegionComplete(ctx context.Context, resourceGroupName string) (result AlertListIterator, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListResourceGroupLevelAlertsByRegion") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListResourceGroupLevelByRegion") defer func() { sc := -1 if result.Response().Response.Response != nil { @@ -571,15 +571,15 @@ func (client AlertsClient) ListResourceGroupLevelAlertsByRegionComplete(ctx cont tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.ListResourceGroupLevelAlertsByRegion(ctx, resourceGroupName) + result.page, err = client.ListResourceGroupLevelByRegion(ctx, resourceGroupName) return } -// ListSubscriptionLevelAlertsByRegion list all the alerts that are associated with the subscription that are stored in -// a specific location -func (client AlertsClient) ListSubscriptionLevelAlertsByRegion(ctx context.Context) (result AlertListPage, err error) { +// ListSubscriptionLevelByRegion list all the alerts that are associated with the subscription that are stored in a +// specific location +func (client AlertsClient) ListSubscriptionLevelByRegion(ctx context.Context) (result AlertListPage, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListSubscriptionLevelAlertsByRegion") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListSubscriptionLevelByRegion") defer func() { sc := -1 if result.al.Response.Response != nil { @@ -591,26 +591,26 @@ func (client AlertsClient) ListSubscriptionLevelAlertsByRegion(ctx context.Conte if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.AlertsClient", "ListSubscriptionLevelAlertsByRegion", err.Error()) + return result, validation.NewError("security.AlertsClient", "ListSubscriptionLevelByRegion", err.Error()) } - result.fn = client.listSubscriptionLevelAlertsByRegionNextResults - req, err := client.ListSubscriptionLevelAlertsByRegionPreparer(ctx) + result.fn = client.listSubscriptionLevelByRegionNextResults + req, err := client.ListSubscriptionLevelByRegionPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListSubscriptionLevelAlertsByRegion", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListSubscriptionLevelByRegion", nil, "Failure preparing request") return } - resp, err := client.ListSubscriptionLevelAlertsByRegionSender(req) + resp, err := client.ListSubscriptionLevelByRegionSender(req) if err != nil { result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListSubscriptionLevelAlertsByRegion", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListSubscriptionLevelByRegion", resp, "Failure sending request") return } - result.al, err = client.ListSubscriptionLevelAlertsByRegionResponder(resp) + result.al, err = client.ListSubscriptionLevelByRegionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListSubscriptionLevelAlertsByRegion", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "ListSubscriptionLevelByRegion", resp, "Failure responding to request") return } if result.al.hasNextLink() && result.al.IsEmpty() { @@ -621,14 +621,14 @@ func (client AlertsClient) ListSubscriptionLevelAlertsByRegion(ctx context.Conte return } -// ListSubscriptionLevelAlertsByRegionPreparer prepares the ListSubscriptionLevelAlertsByRegion request. -func (client AlertsClient) ListSubscriptionLevelAlertsByRegionPreparer(ctx context.Context) (*http.Request, error) { +// ListSubscriptionLevelByRegionPreparer prepares the ListSubscriptionLevelByRegion request. +func (client AlertsClient) ListSubscriptionLevelByRegionPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ "ascLocation": autorest.Encode("path", client.AscLocation), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-01-01" + const APIVersion = "2021-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -641,15 +641,15 @@ func (client AlertsClient) ListSubscriptionLevelAlertsByRegionPreparer(ctx conte return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// ListSubscriptionLevelAlertsByRegionSender sends the ListSubscriptionLevelAlertsByRegion request. The method will close the +// ListSubscriptionLevelByRegionSender sends the ListSubscriptionLevelByRegion request. The method will close the // http.Response Body if it receives an error. -func (client AlertsClient) ListSubscriptionLevelAlertsByRegionSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) ListSubscriptionLevelByRegionSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// ListSubscriptionLevelAlertsByRegionResponder handles the response to the ListSubscriptionLevelAlertsByRegion request. The method always +// ListSubscriptionLevelByRegionResponder handles the response to the ListSubscriptionLevelByRegion request. The method always // closes the http.Response Body. -func (client AlertsClient) ListSubscriptionLevelAlertsByRegionResponder(resp *http.Response) (result AlertList, err error) { +func (client AlertsClient) ListSubscriptionLevelByRegionResponder(resp *http.Response) (result AlertList, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -659,31 +659,31 @@ func (client AlertsClient) ListSubscriptionLevelAlertsByRegionResponder(resp *ht return } -// listSubscriptionLevelAlertsByRegionNextResults retrieves the next set of results, if any. -func (client AlertsClient) listSubscriptionLevelAlertsByRegionNextResults(ctx context.Context, lastResults AlertList) (result AlertList, err error) { +// listSubscriptionLevelByRegionNextResults retrieves the next set of results, if any. +func (client AlertsClient) listSubscriptionLevelByRegionNextResults(ctx context.Context, lastResults AlertList) (result AlertList, err error) { req, err := lastResults.alertListPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "security.AlertsClient", "listSubscriptionLevelAlertsByRegionNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "security.AlertsClient", "listSubscriptionLevelByRegionNextResults", nil, "Failure preparing next results request") } if req == nil { return } - resp, err := client.ListSubscriptionLevelAlertsByRegionSender(req) + resp, err := client.ListSubscriptionLevelByRegionSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "security.AlertsClient", "listSubscriptionLevelAlertsByRegionNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "security.AlertsClient", "listSubscriptionLevelByRegionNextResults", resp, "Failure sending next results request") } - result, err = client.ListSubscriptionLevelAlertsByRegionResponder(resp) + result, err = client.ListSubscriptionLevelByRegionResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "listSubscriptionLevelAlertsByRegionNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "listSubscriptionLevelByRegionNextResults", resp, "Failure responding to next results request") } return } -// ListSubscriptionLevelAlertsByRegionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AlertsClient) ListSubscriptionLevelAlertsByRegionComplete(ctx context.Context) (result AlertListIterator, err error) { +// ListSubscriptionLevelByRegionComplete enumerates all values, automatically crossing page boundaries as required. +func (client AlertsClient) ListSubscriptionLevelByRegionComplete(ctx context.Context) (result AlertListIterator, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListSubscriptionLevelAlertsByRegion") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListSubscriptionLevelByRegion") defer func() { sc := -1 if result.Response().Response.Response != nil { @@ -692,18 +692,101 @@ func (client AlertsClient) ListSubscriptionLevelAlertsByRegionComplete(ctx conte tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.ListSubscriptionLevelAlertsByRegion(ctx) + result.page, err = client.ListSubscriptionLevelByRegion(ctx) return } -// UpdateResourceGroupLevelAlertStateToDismiss update the alert's state +// Simulate simulate security alerts +// Parameters: +// alertSimulatorRequestBody - alert Simulator Request Properties +func (client AlertsClient) Simulate(ctx context.Context, alertSimulatorRequestBody AlertSimulatorRequestBody) (result AlertsSimulateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.Simulate") + 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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AlertsClient", "Simulate", err.Error()) + } + + req, err := client.SimulatePreparer(ctx, alertSimulatorRequestBody) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AlertsClient", "Simulate", nil, "Failure preparing request") + return + } + + result, err = client.SimulateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AlertsClient", "Simulate", nil, "Failure sending request") + return + } + + return +} + +// SimulatePreparer prepares the Simulate request. +func (client AlertsClient) SimulatePreparer(ctx context.Context, alertSimulatorRequestBody AlertSimulatorRequestBody) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ascLocation": autorest.Encode("path", client.AscLocation), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-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.Security/locations/{ascLocation}/alerts/default/simulate", pathParameters), + autorest.WithJSON(alertSimulatorRequestBody), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SimulateSender sends the Simulate request. The method will close the +// http.Response Body if it receives an error. +func (client AlertsClient) SimulateSender(req *http.Request) (future AlertsSimulateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// SimulateResponder handles the response to the Simulate request. The method always +// closes the http.Response Body. +func (client AlertsClient) SimulateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateResourceGroupLevelStateToActivate update the alert's state // Parameters: // alertName - name of the alert object // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -func (client AlertsClient) UpdateResourceGroupLevelAlertStateToDismiss(ctx context.Context, alertName string, resourceGroupName string) (result autorest.Response, err error) { +func (client AlertsClient) UpdateResourceGroupLevelStateToActivate(ctx context.Context, alertName string, resourceGroupName string) (result autorest.Response, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.UpdateResourceGroupLevelAlertStateToDismiss") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.UpdateResourceGroupLevelStateToActivate") defer func() { sc := -1 if result.Response != nil { @@ -719,33 +802,33 @@ func (client AlertsClient) UpdateResourceGroupLevelAlertStateToDismiss(ctx conte 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("security.AlertsClient", "UpdateResourceGroupLevelAlertStateToDismiss", err.Error()) + return result, validation.NewError("security.AlertsClient", "UpdateResourceGroupLevelStateToActivate", err.Error()) } - req, err := client.UpdateResourceGroupLevelAlertStateToDismissPreparer(ctx, alertName, resourceGroupName) + req, err := client.UpdateResourceGroupLevelStateToActivatePreparer(ctx, alertName, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateResourceGroupLevelAlertStateToDismiss", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateResourceGroupLevelStateToActivate", nil, "Failure preparing request") return } - resp, err := client.UpdateResourceGroupLevelAlertStateToDismissSender(req) + resp, err := client.UpdateResourceGroupLevelStateToActivateSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateResourceGroupLevelAlertStateToDismiss", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateResourceGroupLevelStateToActivate", resp, "Failure sending request") return } - result, err = client.UpdateResourceGroupLevelAlertStateToDismissResponder(resp) + result, err = client.UpdateResourceGroupLevelStateToActivateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateResourceGroupLevelAlertStateToDismiss", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateResourceGroupLevelStateToActivate", resp, "Failure responding to request") return } return } -// UpdateResourceGroupLevelAlertStateToDismissPreparer prepares the UpdateResourceGroupLevelAlertStateToDismiss request. -func (client AlertsClient) UpdateResourceGroupLevelAlertStateToDismissPreparer(ctx context.Context, alertName string, resourceGroupName string) (*http.Request, error) { +// UpdateResourceGroupLevelStateToActivatePreparer prepares the UpdateResourceGroupLevelStateToActivate request. +func (client AlertsClient) UpdateResourceGroupLevelStateToActivatePreparer(ctx context.Context, alertName string, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "alertName": autorest.Encode("path", alertName), "ascLocation": autorest.Encode("path", client.AscLocation), @@ -753,7 +836,7 @@ func (client AlertsClient) UpdateResourceGroupLevelAlertStateToDismissPreparer(c "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-01-01" + const APIVersion = "2021-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -761,20 +844,20 @@ func (client AlertsClient) UpdateResourceGroupLevelAlertStateToDismissPreparer(c preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// UpdateResourceGroupLevelAlertStateToDismissSender sends the UpdateResourceGroupLevelAlertStateToDismiss request. The method will close the +// UpdateResourceGroupLevelStateToActivateSender sends the UpdateResourceGroupLevelStateToActivate request. The method will close the // http.Response Body if it receives an error. -func (client AlertsClient) UpdateResourceGroupLevelAlertStateToDismissSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) UpdateResourceGroupLevelStateToActivateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// UpdateResourceGroupLevelAlertStateToDismissResponder handles the response to the UpdateResourceGroupLevelAlertStateToDismiss request. The method always +// UpdateResourceGroupLevelStateToActivateResponder handles the response to the UpdateResourceGroupLevelStateToActivate request. The method always // closes the http.Response Body. -func (client AlertsClient) UpdateResourceGroupLevelAlertStateToDismissResponder(resp *http.Response) (result autorest.Response, err error) { +func (client AlertsClient) UpdateResourceGroupLevelStateToActivateResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), @@ -783,14 +866,14 @@ func (client AlertsClient) UpdateResourceGroupLevelAlertStateToDismissResponder( return } -// UpdateResourceGroupLevelAlertStateToReactivate update the alert's state +// UpdateResourceGroupLevelStateToDismiss update the alert's state // Parameters: // alertName - name of the alert object // resourceGroupName - the name of the resource group within the user's subscription. The name is case // insensitive. -func (client AlertsClient) UpdateResourceGroupLevelAlertStateToReactivate(ctx context.Context, alertName string, resourceGroupName string) (result autorest.Response, err error) { +func (client AlertsClient) UpdateResourceGroupLevelStateToDismiss(ctx context.Context, alertName string, resourceGroupName string) (result autorest.Response, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.UpdateResourceGroupLevelAlertStateToReactivate") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.UpdateResourceGroupLevelStateToDismiss") defer func() { sc := -1 if result.Response != nil { @@ -806,33 +889,33 @@ func (client AlertsClient) UpdateResourceGroupLevelAlertStateToReactivate(ctx co 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("security.AlertsClient", "UpdateResourceGroupLevelAlertStateToReactivate", err.Error()) + return result, validation.NewError("security.AlertsClient", "UpdateResourceGroupLevelStateToDismiss", err.Error()) } - req, err := client.UpdateResourceGroupLevelAlertStateToReactivatePreparer(ctx, alertName, resourceGroupName) + req, err := client.UpdateResourceGroupLevelStateToDismissPreparer(ctx, alertName, resourceGroupName) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateResourceGroupLevelAlertStateToReactivate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateResourceGroupLevelStateToDismiss", nil, "Failure preparing request") return } - resp, err := client.UpdateResourceGroupLevelAlertStateToReactivateSender(req) + resp, err := client.UpdateResourceGroupLevelStateToDismissSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateResourceGroupLevelAlertStateToReactivate", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateResourceGroupLevelStateToDismiss", resp, "Failure sending request") return } - result, err = client.UpdateResourceGroupLevelAlertStateToReactivateResponder(resp) + result, err = client.UpdateResourceGroupLevelStateToDismissResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateResourceGroupLevelAlertStateToReactivate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateResourceGroupLevelStateToDismiss", resp, "Failure responding to request") return } return } -// UpdateResourceGroupLevelAlertStateToReactivatePreparer prepares the UpdateResourceGroupLevelAlertStateToReactivate request. -func (client AlertsClient) UpdateResourceGroupLevelAlertStateToReactivatePreparer(ctx context.Context, alertName string, resourceGroupName string) (*http.Request, error) { +// UpdateResourceGroupLevelStateToDismissPreparer prepares the UpdateResourceGroupLevelStateToDismiss request. +func (client AlertsClient) UpdateResourceGroupLevelStateToDismissPreparer(ctx context.Context, alertName string, resourceGroupName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "alertName": autorest.Encode("path", alertName), "ascLocation": autorest.Encode("path", client.AscLocation), @@ -840,7 +923,7 @@ func (client AlertsClient) UpdateResourceGroupLevelAlertStateToReactivatePrepare "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-01-01" + const APIVersion = "2021-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -848,20 +931,20 @@ func (client AlertsClient) UpdateResourceGroupLevelAlertStateToReactivatePrepare preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// UpdateResourceGroupLevelAlertStateToReactivateSender sends the UpdateResourceGroupLevelAlertStateToReactivate request. The method will close the +// UpdateResourceGroupLevelStateToDismissSender sends the UpdateResourceGroupLevelStateToDismiss request. The method will close the // http.Response Body if it receives an error. -func (client AlertsClient) UpdateResourceGroupLevelAlertStateToReactivateSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) UpdateResourceGroupLevelStateToDismissSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// UpdateResourceGroupLevelAlertStateToReactivateResponder handles the response to the UpdateResourceGroupLevelAlertStateToReactivate request. The method always +// UpdateResourceGroupLevelStateToDismissResponder handles the response to the UpdateResourceGroupLevelStateToDismiss request. The method always // closes the http.Response Body. -func (client AlertsClient) UpdateResourceGroupLevelAlertStateToReactivateResponder(resp *http.Response) (result autorest.Response, err error) { +func (client AlertsClient) UpdateResourceGroupLevelStateToDismissResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), @@ -927,7 +1010,7 @@ func (client AlertsClient) UpdateResourceGroupLevelStateToResolvePreparer(ctx co "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-01-01" + const APIVersion = "2021-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -957,12 +1040,12 @@ func (client AlertsClient) UpdateResourceGroupLevelStateToResolveResponder(resp return } -// UpdateSubscriptionLevelAlertStateToDismiss update the alert's state +// UpdateSubscriptionLevelStateToActivate update the alert's state // Parameters: // alertName - name of the alert object -func (client AlertsClient) UpdateSubscriptionLevelAlertStateToDismiss(ctx context.Context, alertName string) (result autorest.Response, err error) { +func (client AlertsClient) UpdateSubscriptionLevelStateToActivate(ctx context.Context, alertName string) (result autorest.Response, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.UpdateSubscriptionLevelAlertStateToDismiss") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.UpdateSubscriptionLevelStateToActivate") defer func() { sc := -1 if result.Response != nil { @@ -974,40 +1057,40 @@ func (client AlertsClient) UpdateSubscriptionLevelAlertStateToDismiss(ctx contex if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.AlertsClient", "UpdateSubscriptionLevelAlertStateToDismiss", err.Error()) + return result, validation.NewError("security.AlertsClient", "UpdateSubscriptionLevelStateToActivate", err.Error()) } - req, err := client.UpdateSubscriptionLevelAlertStateToDismissPreparer(ctx, alertName) + req, err := client.UpdateSubscriptionLevelStateToActivatePreparer(ctx, alertName) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateSubscriptionLevelAlertStateToDismiss", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateSubscriptionLevelStateToActivate", nil, "Failure preparing request") return } - resp, err := client.UpdateSubscriptionLevelAlertStateToDismissSender(req) + resp, err := client.UpdateSubscriptionLevelStateToActivateSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateSubscriptionLevelAlertStateToDismiss", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateSubscriptionLevelStateToActivate", resp, "Failure sending request") return } - result, err = client.UpdateSubscriptionLevelAlertStateToDismissResponder(resp) + result, err = client.UpdateSubscriptionLevelStateToActivateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateSubscriptionLevelAlertStateToDismiss", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateSubscriptionLevelStateToActivate", resp, "Failure responding to request") return } return } -// UpdateSubscriptionLevelAlertStateToDismissPreparer prepares the UpdateSubscriptionLevelAlertStateToDismiss request. -func (client AlertsClient) UpdateSubscriptionLevelAlertStateToDismissPreparer(ctx context.Context, alertName string) (*http.Request, error) { +// UpdateSubscriptionLevelStateToActivatePreparer prepares the UpdateSubscriptionLevelStateToActivate request. +func (client AlertsClient) UpdateSubscriptionLevelStateToActivatePreparer(ctx context.Context, alertName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "alertName": autorest.Encode("path", alertName), "ascLocation": autorest.Encode("path", client.AscLocation), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-01-01" + const APIVersion = "2021-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1015,20 +1098,20 @@ func (client AlertsClient) UpdateSubscriptionLevelAlertStateToDismissPreparer(ct preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// UpdateSubscriptionLevelAlertStateToDismissSender sends the UpdateSubscriptionLevelAlertStateToDismiss request. The method will close the +// UpdateSubscriptionLevelStateToActivateSender sends the UpdateSubscriptionLevelStateToActivate request. The method will close the // http.Response Body if it receives an error. -func (client AlertsClient) UpdateSubscriptionLevelAlertStateToDismissSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) UpdateSubscriptionLevelStateToActivateSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// UpdateSubscriptionLevelAlertStateToDismissResponder handles the response to the UpdateSubscriptionLevelAlertStateToDismiss request. The method always +// UpdateSubscriptionLevelStateToActivateResponder handles the response to the UpdateSubscriptionLevelStateToActivate request. The method always // closes the http.Response Body. -func (client AlertsClient) UpdateSubscriptionLevelAlertStateToDismissResponder(resp *http.Response) (result autorest.Response, err error) { +func (client AlertsClient) UpdateSubscriptionLevelStateToActivateResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), @@ -1037,12 +1120,12 @@ func (client AlertsClient) UpdateSubscriptionLevelAlertStateToDismissResponder(r return } -// UpdateSubscriptionLevelAlertStateToReactivate update the alert's state +// UpdateSubscriptionLevelStateToDismiss update the alert's state // Parameters: // alertName - name of the alert object -func (client AlertsClient) UpdateSubscriptionLevelAlertStateToReactivate(ctx context.Context, alertName string) (result autorest.Response, err error) { +func (client AlertsClient) UpdateSubscriptionLevelStateToDismiss(ctx context.Context, alertName string) (result autorest.Response, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.UpdateSubscriptionLevelAlertStateToReactivate") + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.UpdateSubscriptionLevelStateToDismiss") defer func() { sc := -1 if result.Response != nil { @@ -1054,40 +1137,40 @@ func (client AlertsClient) UpdateSubscriptionLevelAlertStateToReactivate(ctx con if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.AlertsClient", "UpdateSubscriptionLevelAlertStateToReactivate", err.Error()) + return result, validation.NewError("security.AlertsClient", "UpdateSubscriptionLevelStateToDismiss", err.Error()) } - req, err := client.UpdateSubscriptionLevelAlertStateToReactivatePreparer(ctx, alertName) + req, err := client.UpdateSubscriptionLevelStateToDismissPreparer(ctx, alertName) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateSubscriptionLevelAlertStateToReactivate", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateSubscriptionLevelStateToDismiss", nil, "Failure preparing request") return } - resp, err := client.UpdateSubscriptionLevelAlertStateToReactivateSender(req) + resp, err := client.UpdateSubscriptionLevelStateToDismissSender(req) if err != nil { result.Response = resp - err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateSubscriptionLevelAlertStateToReactivate", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateSubscriptionLevelStateToDismiss", resp, "Failure sending request") return } - result, err = client.UpdateSubscriptionLevelAlertStateToReactivateResponder(resp) + result, err = client.UpdateSubscriptionLevelStateToDismissResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateSubscriptionLevelAlertStateToReactivate", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.AlertsClient", "UpdateSubscriptionLevelStateToDismiss", resp, "Failure responding to request") return } return } -// UpdateSubscriptionLevelAlertStateToReactivatePreparer prepares the UpdateSubscriptionLevelAlertStateToReactivate request. -func (client AlertsClient) UpdateSubscriptionLevelAlertStateToReactivatePreparer(ctx context.Context, alertName string) (*http.Request, error) { +// UpdateSubscriptionLevelStateToDismissPreparer prepares the UpdateSubscriptionLevelStateToDismiss request. +func (client AlertsClient) UpdateSubscriptionLevelStateToDismissPreparer(ctx context.Context, alertName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "alertName": autorest.Encode("path", alertName), "ascLocation": autorest.Encode("path", client.AscLocation), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-01-01" + const APIVersion = "2021-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -1095,20 +1178,20 @@ func (client AlertsClient) UpdateSubscriptionLevelAlertStateToReactivatePreparer preparer := autorest.CreatePreparer( autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// UpdateSubscriptionLevelAlertStateToReactivateSender sends the UpdateSubscriptionLevelAlertStateToReactivate request. The method will close the +// UpdateSubscriptionLevelStateToDismissSender sends the UpdateSubscriptionLevelStateToDismiss request. The method will close the // http.Response Body if it receives an error. -func (client AlertsClient) UpdateSubscriptionLevelAlertStateToReactivateSender(req *http.Request) (*http.Response, error) { +func (client AlertsClient) UpdateSubscriptionLevelStateToDismissSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// UpdateSubscriptionLevelAlertStateToReactivateResponder handles the response to the UpdateSubscriptionLevelAlertStateToReactivate request. The method always +// UpdateSubscriptionLevelStateToDismissResponder handles the response to the UpdateSubscriptionLevelStateToDismiss request. The method always // closes the http.Response Body. -func (client AlertsClient) UpdateSubscriptionLevelAlertStateToReactivateResponder(resp *http.Response) (result autorest.Response, err error) { +func (client AlertsClient) UpdateSubscriptionLevelStateToDismissResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), @@ -1167,7 +1250,7 @@ func (client AlertsClient) UpdateSubscriptionLevelStateToResolvePreparer(ctx con "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2020-01-01" + const APIVersion = "2021-01-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } diff --git a/services/preview/security/mgmt/v3.0/security/enums.go b/services/preview/security/mgmt/v3.0/security/enums.go index 80490b32ca5b..25b9c2e5e721 100644 --- a/services/preview/security/mgmt/v3.0/security/enums.go +++ b/services/preview/security/mgmt/v3.0/security/enums.go @@ -59,6 +59,34 @@ func PossibleActionTypeValues() []ActionType { return []ActionType{ActionTypeAutomationAction, ActionTypeEventHub, ActionTypeLogicApp, ActionTypeWorkspace} } +// AdditionalWorkspaceDataType enumerates the values for additional workspace data type. +type AdditionalWorkspaceDataType string + +const ( + // Alerts ... + Alerts AdditionalWorkspaceDataType = "Alerts" + // RawEvents ... + RawEvents AdditionalWorkspaceDataType = "RawEvents" +) + +// PossibleAdditionalWorkspaceDataTypeValues returns an array of possible values for the AdditionalWorkspaceDataType const type. +func PossibleAdditionalWorkspaceDataTypeValues() []AdditionalWorkspaceDataType { + return []AdditionalWorkspaceDataType{Alerts, RawEvents} +} + +// AdditionalWorkspaceType enumerates the values for additional workspace type. +type AdditionalWorkspaceType string + +const ( + // Sentinel ... + Sentinel AdditionalWorkspaceType = "Sentinel" +) + +// PossibleAdditionalWorkspaceTypeValues returns an array of possible values for the AdditionalWorkspaceType const type. +func PossibleAdditionalWorkspaceTypeValues() []AdditionalWorkspaceType { + return []AdditionalWorkspaceType{Sentinel} +} + // AlertIntent enumerates the values for alert intent. type AlertIntent string @@ -293,25 +321,52 @@ func PossibleAutoProvisionValues() []AutoProvision { return []AutoProvision{AutoProvisionOff, AutoProvisionOn} } -// Category enumerates the values for category. -type Category string +// BundleType enumerates the values for bundle type. +type BundleType string + +const ( + // AppServices ... + AppServices BundleType = "AppServices" + // DNS ... + DNS BundleType = "DNS" + // KeyVaults ... + KeyVaults BundleType = "KeyVaults" + // KubernetesService ... + KubernetesService BundleType = "KubernetesService" + // ResourceManager ... + ResourceManager BundleType = "ResourceManager" + // SQLServers ... + SQLServers BundleType = "SqlServers" + // StorageAccounts ... + StorageAccounts BundleType = "StorageAccounts" + // VirtualMachines ... + VirtualMachines BundleType = "VirtualMachines" +) + +// PossibleBundleTypeValues returns an array of possible values for the BundleType const type. +func PossibleBundleTypeValues() []BundleType { + return []BundleType{AppServices, DNS, KeyVaults, KubernetesService, ResourceManager, SQLServers, StorageAccounts, VirtualMachines} +} + +// Categories enumerates the values for categories. +type Categories string const ( // Compute ... - Compute Category = "Compute" + Compute Categories = "Compute" // Data ... - Data Category = "Data" + Data Categories = "Data" // IdentityAndAccess ... - IdentityAndAccess Category = "IdentityAndAccess" + IdentityAndAccess Categories = "IdentityAndAccess" // IoT ... - IoT Category = "IoT" + IoT Categories = "IoT" // Networking ... - Networking Category = "Networking" + Networking Categories = "Networking" ) -// PossibleCategoryValues returns an array of possible values for the Category const type. -func PossibleCategoryValues() []Category { - return []Category{Compute, Data, IdentityAndAccess, IoT, Networking} +// PossibleCategoriesValues returns an array of possible values for the Categories const type. +func PossibleCategoriesValues() []Categories { + return []Categories{Compute, Data, IdentityAndAccess, IoT, Networking} } // ConfigurationStatus enumerates the values for configuration status. @@ -407,6 +462,25 @@ func PossibleControlTypeValues() []ControlType { return []ControlType{ControlTypeBuiltIn, ControlTypeCustom} } +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + // DataSource enumerates the values for data source. type DataSource string @@ -465,21 +539,42 @@ func PossibleDirectionValues() []Direction { return []Direction{Inbound, Outbound} } +// EndOfSupportStatus enumerates the values for end of support status. +type EndOfSupportStatus string + +const ( + // NoLongerSupported ... + NoLongerSupported EndOfSupportStatus = "noLongerSupported" + // None ... + None EndOfSupportStatus = "None" + // UpcomingNoLongerSupported ... + UpcomingNoLongerSupported EndOfSupportStatus = "upcomingNoLongerSupported" + // UpcomingVersionNoLongerSupported ... + UpcomingVersionNoLongerSupported EndOfSupportStatus = "upcomingVersionNoLongerSupported" + // VersionNoLongerSupported ... + VersionNoLongerSupported EndOfSupportStatus = "versionNoLongerSupported" +) + +// PossibleEndOfSupportStatusValues returns an array of possible values for the EndOfSupportStatus const type. +func PossibleEndOfSupportStatusValues() []EndOfSupportStatus { + return []EndOfSupportStatus{NoLongerSupported, None, UpcomingNoLongerSupported, UpcomingVersionNoLongerSupported, VersionNoLongerSupported} +} + // EnforcementMode enumerates the values for enforcement mode. type EnforcementMode string const ( - // Audit ... - Audit EnforcementMode = "Audit" - // Enforce ... - Enforce EnforcementMode = "Enforce" - // None ... - None EnforcementMode = "None" + // EnforcementModeAudit ... + EnforcementModeAudit EnforcementMode = "Audit" + // EnforcementModeEnforce ... + EnforcementModeEnforce EnforcementMode = "Enforce" + // EnforcementModeNone ... + EnforcementModeNone EnforcementMode = "None" ) // PossibleEnforcementModeValues returns an array of possible values for the EnforcementMode const type. func PossibleEnforcementModeValues() []EnforcementMode { - return []EnforcementMode{Audit, Enforce, None} + return []EnforcementMode{EnforcementModeAudit, EnforcementModeEnforce, EnforcementModeNone} } // EnforcementSupport enumerates the values for enforcement support. @@ -503,21 +598,29 @@ func PossibleEnforcementSupportValues() []EnforcementSupport { type EventSource string const ( - // Alerts ... - Alerts EventSource = "Alerts" - // Assessments ... - Assessments EventSource = "Assessments" - // SecureScoreControls ... - SecureScoreControls EventSource = "SecureScoreControls" - // SecureScores ... - SecureScores EventSource = "SecureScores" - // SubAssessments ... - SubAssessments EventSource = "SubAssessments" + // EventSourceAlerts ... + EventSourceAlerts EventSource = "Alerts" + // EventSourceAssessments ... + EventSourceAssessments EventSource = "Assessments" + // EventSourceRegulatoryComplianceAssessment ... + EventSourceRegulatoryComplianceAssessment EventSource = "RegulatoryComplianceAssessment" + // EventSourceRegulatoryComplianceAssessmentSnapshot ... + EventSourceRegulatoryComplianceAssessmentSnapshot EventSource = "RegulatoryComplianceAssessmentSnapshot" + // EventSourceSecureScoreControls ... + EventSourceSecureScoreControls EventSource = "SecureScoreControls" + // EventSourceSecureScoreControlsSnapshot ... + EventSourceSecureScoreControlsSnapshot EventSource = "SecureScoreControlsSnapshot" + // EventSourceSecureScores ... + EventSourceSecureScores EventSource = "SecureScores" + // EventSourceSecureScoresSnapshot ... + EventSourceSecureScoresSnapshot EventSource = "SecureScoresSnapshot" + // EventSourceSubAssessments ... + EventSourceSubAssessments EventSource = "SubAssessments" ) // PossibleEventSourceValues returns an array of possible values for the EventSource const type. func PossibleEventSourceValues() []EventSource { - return []EventSource{Alerts, Assessments, SecureScoreControls, SecureScores, SubAssessments} + return []EventSource{EventSourceAlerts, EventSourceAssessments, EventSourceRegulatoryComplianceAssessment, EventSourceRegulatoryComplianceAssessmentSnapshot, EventSourceSecureScoreControls, EventSourceSecureScoreControlsSnapshot, EventSourceSecureScores, EventSourceSecureScoresSnapshot, EventSourceSubAssessments} } // Exe enumerates the values for exe. @@ -586,13 +689,13 @@ func PossibleExpandEnumValues() []ExpandEnum { type ExportData string const ( - // RawEvents Agent raw events - RawEvents ExportData = "RawEvents" + // ExportDataRawEvents Agent raw events + ExportDataRawEvents ExportData = "RawEvents" ) // PossibleExportDataValues returns an array of possible values for the ExportData const type. func PossibleExportDataValues() []ExportData { - return []ExportData{RawEvents} + return []ExportData{ExportDataRawEvents} } // ExternalSecuritySolutionKind enumerates the values for external security solution kind. @@ -809,6 +912,21 @@ func PossibleKindEnum1Values() []KindEnum1 { return []KindEnum1{KindAAD, KindATA, KindCEF, KindExternalSecuritySolution} } +// KindEnum2 enumerates the values for kind enum 2. +type KindEnum2 string + +const ( + // KindAlertSimulatorRequestProperties ... + KindAlertSimulatorRequestProperties KindEnum2 = "AlertSimulatorRequestProperties" + // KindBundles ... + KindBundles KindEnum2 = "Bundles" +) + +// PossibleKindEnum2Values returns an array of possible values for the KindEnum2 const type. +func PossibleKindEnum2Values() []KindEnum2 { + return []KindEnum2{KindAlertSimulatorRequestProperties, KindBundles} +} + // MacSignificance enumerates the values for mac significance. type MacSignificance string @@ -856,27 +974,42 @@ func PossibleMsiValues() []Msi { return []Msi{MsiAudit, MsiEnforce, MsiNone} } +// OnboardingKind enumerates the values for onboarding kind. +type OnboardingKind string + +const ( + // Default ... + Default OnboardingKind = "Default" + // MigratedToAzure ... + MigratedToAzure OnboardingKind = "MigratedToAzure" +) + +// PossibleOnboardingKindValues returns an array of possible values for the OnboardingKind const type. +func PossibleOnboardingKindValues() []OnboardingKind { + return []OnboardingKind{Default, MigratedToAzure} +} + // Operator enumerates the values for operator. type Operator string const ( - // Contains ... + // Contains Applies only for non-decimal operands Contains Operator = "Contains" - // EndsWith ... + // EndsWith Applies only for non-decimal operands EndsWith Operator = "EndsWith" - // Equals ... + // Equals Applies for decimal and non-decimal operands Equals Operator = "Equals" - // GreaterThan ... + // GreaterThan Applies only for decimal operands GreaterThan Operator = "GreaterThan" - // GreaterThanOrEqualTo ... + // GreaterThanOrEqualTo Applies only for decimal operands GreaterThanOrEqualTo Operator = "GreaterThanOrEqualTo" - // LesserThan ... + // LesserThan Applies only for decimal operands LesserThan Operator = "LesserThan" - // LesserThanOrEqualTo ... + // LesserThanOrEqualTo Applies only for decimal operands LesserThanOrEqualTo Operator = "LesserThanOrEqualTo" - // NotEquals ... + // NotEquals Applies for decimal and non-decimal operands NotEquals Operator = "NotEquals" - // StartsWith ... + // StartsWith Applies only for non-decimal operands StartsWith Operator = "StartsWith" ) @@ -1336,6 +1469,8 @@ const ( RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange RuleTypeBasicCustomAlertRule = "AmqpC2DRejectedMessagesNotInAllowedRange" // RuleTypeAmqpD2CMessagesNotInAllowedRange ... RuleTypeAmqpD2CMessagesNotInAllowedRange RuleTypeBasicCustomAlertRule = "AmqpD2CMessagesNotInAllowedRange" + // RuleTypeConnectionFromIPNotAllowed ... + RuleTypeConnectionFromIPNotAllowed RuleTypeBasicCustomAlertRule = "ConnectionFromIpNotAllowed" // RuleTypeConnectionToIPNotAllowed ... RuleTypeConnectionToIPNotAllowed RuleTypeBasicCustomAlertRule = "ConnectionToIpNotAllowed" // RuleTypeCustomAlertRule ... @@ -1380,7 +1515,7 @@ const ( // PossibleRuleTypeBasicCustomAlertRuleValues returns an array of possible values for the RuleTypeBasicCustomAlertRule const type. func PossibleRuleTypeBasicCustomAlertRuleValues() []RuleTypeBasicCustomAlertRule { - return []RuleTypeBasicCustomAlertRule{RuleTypeActiveConnectionsNotInAllowedRange, RuleTypeAllowlistCustomAlertRule, RuleTypeAmqpC2DMessagesNotInAllowedRange, RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange, RuleTypeAmqpD2CMessagesNotInAllowedRange, RuleTypeConnectionToIPNotAllowed, RuleTypeCustomAlertRule, RuleTypeDenylistCustomAlertRule, RuleTypeDirectMethodInvokesNotInAllowedRange, RuleTypeFailedLocalLoginsNotInAllowedRange, RuleTypeFileUploadsNotInAllowedRange, RuleTypeHTTPC2DMessagesNotInAllowedRange, RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange, RuleTypeHTTPD2CMessagesNotInAllowedRange, RuleTypeListCustomAlertRule, RuleTypeLocalUserNotAllowed, RuleTypeMqttC2DMessagesNotInAllowedRange, RuleTypeMqttC2DRejectedMessagesNotInAllowedRange, RuleTypeMqttD2CMessagesNotInAllowedRange, RuleTypeProcessNotAllowed, RuleTypeQueuePurgesNotInAllowedRange, RuleTypeThresholdCustomAlertRule, RuleTypeTimeWindowCustomAlertRule, RuleTypeTwinUpdatesNotInAllowedRange, RuleTypeUnauthorizedOperationsNotInAllowedRange} + return []RuleTypeBasicCustomAlertRule{RuleTypeActiveConnectionsNotInAllowedRange, RuleTypeAllowlistCustomAlertRule, RuleTypeAmqpC2DMessagesNotInAllowedRange, RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange, RuleTypeAmqpD2CMessagesNotInAllowedRange, RuleTypeConnectionFromIPNotAllowed, RuleTypeConnectionToIPNotAllowed, RuleTypeCustomAlertRule, RuleTypeDenylistCustomAlertRule, RuleTypeDirectMethodInvokesNotInAllowedRange, RuleTypeFailedLocalLoginsNotInAllowedRange, RuleTypeFileUploadsNotInAllowedRange, RuleTypeHTTPC2DMessagesNotInAllowedRange, RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange, RuleTypeHTTPD2CMessagesNotInAllowedRange, RuleTypeListCustomAlertRule, RuleTypeLocalUserNotAllowed, RuleTypeMqttC2DMessagesNotInAllowedRange, RuleTypeMqttC2DRejectedMessagesNotInAllowedRange, RuleTypeMqttD2CMessagesNotInAllowedRange, RuleTypeProcessNotAllowed, RuleTypeQueuePurgesNotInAllowedRange, RuleTypeThresholdCustomAlertRule, RuleTypeTimeWindowCustomAlertRule, RuleTypeTwinUpdatesNotInAllowedRange, RuleTypeUnauthorizedOperationsNotInAllowedRange} } // ScanningFunctionality enumerates the values for scanning functionality. @@ -1466,6 +1601,21 @@ func PossibleSensorStatusValues() []SensorStatus { return []SensorStatus{Disconnected, Ok, Unavailable} } +// SensorType enumerates the values for sensor type. +type SensorType string + +const ( + // SensorTypeEnterprise ... + SensorTypeEnterprise SensorType = "Enterprise" + // SensorTypeOt ... + SensorTypeOt SensorType = "Ot" +) + +// PossibleSensorTypeValues returns an array of possible values for the SensorType const type. +func PossibleSensorTypeValues() []SensorType { + return []SensorType{SensorTypeEnterprise, SensorTypeOt} +} + // Severity enumerates the values for severity. type Severity string diff --git a/services/preview/security/mgmt/v3.0/security/ingestionsettings.go b/services/preview/security/mgmt/v3.0/security/ingestionsettings.go new file mode 100644 index 000000000000..b5f7ce03a686 --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/ingestionsettings.go @@ -0,0 +1,555 @@ +package security + +// 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" +) + +// IngestionSettingsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type IngestionSettingsClient struct { + BaseClient +} + +// NewIngestionSettingsClient creates an instance of the IngestionSettingsClient client. +func NewIngestionSettingsClient(subscriptionID string, ascLocation string) IngestionSettingsClient { + return NewIngestionSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIngestionSettingsClientWithBaseURI creates an instance of the IngestionSettingsClient 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 NewIngestionSettingsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IngestionSettingsClient { + return IngestionSettingsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Create create setting for ingesting security data and logs to correlate with resources associated with the +// subscription. +// Parameters: +// ingestionSettingName - name of the ingestion setting +// ingestionSetting - ingestion setting object +func (client IngestionSettingsClient) Create(ctx context.Context, ingestionSettingName string, ingestionSetting IngestionSetting) (result IngestionSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, ingestionSettingName, ingestionSetting) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client IngestionSettingsClient) CreatePreparer(ctx context.Context, ingestionSettingName string, ingestionSetting IngestionSetting) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-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}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", pathParameters), + autorest.WithJSON(ingestionSetting), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client IngestionSettingsClient) 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 IngestionSettingsClient) CreateResponder(resp *http.Response) (result IngestionSetting, 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 ingestion settings for this subscription. +// Parameters: +// ingestionSettingName - name of the ingestion setting +func (client IngestionSettingsClient) Delete(ctx context.Context, ingestionSettingName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, ingestionSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IngestionSettingsClient) DeletePreparer(ctx context.Context, ingestionSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", 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 IngestionSettingsClient) 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 IngestionSettingsClient) 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 settings for ingesting security data and logs to correlate with resources associated with the subscription. +// Parameters: +// ingestionSettingName - name of the ingestion setting +func (client IngestionSettingsClient) Get(ctx context.Context, ingestionSettingName string) (result IngestionSetting, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, ingestionSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client IngestionSettingsClient) GetPreparer(ctx context.Context, ingestionSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}", 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 IngestionSettingsClient) 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 IngestionSettingsClient) GetResponder(resp *http.Response) (result IngestionSetting, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List settings for ingesting security data and logs to correlate with resources associated with the subscription. +func (client IngestionSettingsClient) List(ctx context.Context) (result IngestionSettingListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.List") + defer func() { + sc := -1 + if result.isl.Response.Response != nil { + sc = result.isl.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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.isl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "List", resp, "Failure sending request") + return + } + + result.isl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "List", resp, "Failure responding to request") + return + } + if result.isl.hasNextLink() && result.isl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client IngestionSettingsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings", 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 IngestionSettingsClient) 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 IngestionSettingsClient) ListResponder(resp *http.Response) (result IngestionSettingList, 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 IngestionSettingsClient) listNextResults(ctx context.Context, lastResults IngestionSettingList) (result IngestionSettingList, err error) { + req, err := lastResults.ingestionSettingListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "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, "security.IngestionSettingsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IngestionSettingsClient) ListComplete(ctx context.Context) (result IngestionSettingListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.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 +} + +// ListConnectionStrings connection strings for ingesting security scan logs and data. +// Parameters: +// ingestionSettingName - name of the ingestion setting +func (client IngestionSettingsClient) ListConnectionStrings(ctx context.Context, ingestionSettingName string) (result ConnectionStrings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.ListConnectionStrings") + 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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "ListConnectionStrings", err.Error()) + } + + req, err := client.ListConnectionStringsPreparer(ctx, ingestionSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListConnectionStrings", nil, "Failure preparing request") + return + } + + resp, err := client.ListConnectionStringsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListConnectionStrings", resp, "Failure sending request") + return + } + + result, err = client.ListConnectionStringsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListConnectionStrings", resp, "Failure responding to request") + return + } + + return +} + +// ListConnectionStringsPreparer prepares the ListConnectionStrings request. +func (client IngestionSettingsClient) ListConnectionStringsPreparer(ctx context.Context, ingestionSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListConnectionStringsSender sends the ListConnectionStrings request. The method will close the +// http.Response Body if it receives an error. +func (client IngestionSettingsClient) ListConnectionStringsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListConnectionStringsResponder handles the response to the ListConnectionStrings request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) ListConnectionStringsResponder(resp *http.Response) (result ConnectionStrings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListTokens returns the token that is used for correlating ingested telemetry with the resources in the subscription. +// Parameters: +// ingestionSettingName - name of the ingestion setting +func (client IngestionSettingsClient) ListTokens(ctx context.Context, ingestionSettingName string) (result IngestionSettingToken, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingsClient.ListTokens") + 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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.IngestionSettingsClient", "ListTokens", err.Error()) + } + + req, err := client.ListTokensPreparer(ctx, ingestionSettingName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListTokens", nil, "Failure preparing request") + return + } + + resp, err := client.ListTokensSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListTokens", resp, "Failure sending request") + return + } + + result, err = client.ListTokensResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IngestionSettingsClient", "ListTokens", resp, "Failure responding to request") + return + } + + return +} + +// ListTokensPreparer prepares the ListTokens request. +func (client IngestionSettingsClient) ListTokensPreparer(ctx context.Context, ingestionSettingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ingestionSettingName": autorest.Encode("path", ingestionSettingName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListTokensSender sends the ListTokens request. The method will close the +// http.Response Body if it receives an error. +func (client IngestionSettingsClient) ListTokensSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListTokensResponder handles the response to the ListTokens request. The method always +// closes the http.Response Body. +func (client IngestionSettingsClient) ListTokensResponder(resp *http.Response) (result IngestionSettingToken, 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/security/mgmt/v3.0/security/iotalerts.go b/services/preview/security/mgmt/v3.0/security/iotalerts.go index 63eb375e0aef..0db7982efdb0 100644 --- a/services/preview/security/mgmt/v3.0/security/iotalerts.go +++ b/services/preview/security/mgmt/v3.0/security/iotalerts.go @@ -10,7 +10,6 @@ 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" ) @@ -33,11 +32,10 @@ func NewIotAlertsClientWithBaseURI(baseURI string, subscriptionID string, ascLoc // Get get IoT alert // Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// solutionName - the name of the IoT Security solution. +// scope - scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. +// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}) // iotAlertID - id of the alert -func (client IotAlertsClient) Get(ctx context.Context, resourceGroupName string, solutionName string, iotAlertID string) (result IotAlert, err error) { +func (client IotAlertsClient) Get(ctx context.Context, scope string, iotAlertID string) (result IotAlertModel, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/IotAlertsClient.Get") defer func() { @@ -48,17 +46,7 @@ func (client IotAlertsClient) Get(ctx context.Context, resourceGroupName string, tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, 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("security.IotAlertsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, solutionName, iotAlertID) + req, err := client.GetPreparer(ctx, scope, iotAlertID) if err != nil { err = autorest.NewErrorWithError(err, "security.IotAlertsClient", "Get", nil, "Failure preparing request") return @@ -81,85 +69,7 @@ func (client IotAlertsClient) Get(ctx context.Context, resourceGroupName string, } // GetPreparer prepares the Get request. -func (client IotAlertsClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string, iotAlertID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "iotAlertId": autorest.Encode("path", iotAlertID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "solutionName": autorest.Encode("path", solutionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.Security/iotSecuritySolutions/{solutionName}/iotAlerts/{iotAlertId}", 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 IotAlertsClient) 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 IotAlertsClient) GetResponder(resp *http.Response) (result IotAlert, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get1 get IoT alert -// Parameters: -// scope - scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. -// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}) -// iotAlertID - id of the alert -func (client IotAlertsClient) Get1(ctx context.Context, scope string, iotAlertID string) (result IotAlertModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotAlertsClient.Get1") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.Get1Preparer(ctx, scope, iotAlertID) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotAlertsClient", "Get1", nil, "Failure preparing request") - return - } - - resp, err := client.Get1Sender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IotAlertsClient", "Get1", resp, "Failure sending request") - return - } - - result, err = client.Get1Responder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotAlertsClient", "Get1", resp, "Failure responding to request") - return - } - - return -} - -// Get1Preparer prepares the Get1 request. -func (client IotAlertsClient) Get1Preparer(ctx context.Context, scope string, iotAlertID string) (*http.Request, error) { +func (client IotAlertsClient) GetPreparer(ctx context.Context, scope string, iotAlertID string) (*http.Request, error) { pathParameters := map[string]interface{}{ "iotAlertId": autorest.Encode("path", iotAlertID), "scope": scope, @@ -178,15 +88,15 @@ func (client IotAlertsClient) Get1Preparer(ctx context.Context, scope string, io return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Get1Sender sends the Get1 request. The method will close the +// GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client IotAlertsClient) Get1Sender(req *http.Request) (*http.Response, error) { +func (client IotAlertsClient) GetSender(req *http.Request) (*http.Response, error) { return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Get1Responder handles the response to the Get1 request. The method always +// GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client IotAlertsClient) Get1Responder(resp *http.Response) (result IotAlertModel, err error) { +func (client IotAlertsClient) GetResponder(resp *http.Response) (result IotAlertModel, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -198,38 +108,28 @@ func (client IotAlertsClient) Get1Responder(resp *http.Response) (result IotAler // List list IoT alerts // Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// solutionName - the name of the IoT Security solution. +// scope - scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. +// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}) // minStartTimeUtc - filter by minimum startTimeUtc (ISO 8601 format) // maxStartTimeUtc - filter by maximum startTimeUtc (ISO 8601 format) // alertType - filter by alert type +// deviceManagementType - get devices only from specific type, Managed or Unmanaged. // compromisedEntity - filter by compromised device // limit - limit the number of items returned in a single page // skipToken - skip token used for pagination -func (client IotAlertsClient) List(ctx context.Context, resourceGroupName string, solutionName string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, compromisedEntity string, limit *int32, skipToken string) (result IotAlertListPage, err error) { +func (client IotAlertsClient) List(ctx context.Context, scope string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, deviceManagementType ManagementState, compromisedEntity string, limit *int32, skipToken string) (result IotAlertListModelPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/IotAlertsClient.List") defer func() { sc := -1 - if result.ial.Response.Response != nil { - sc = result.ial.Response.Response.StatusCode + if result.ialm.Response.Response != nil { + sc = result.ialm.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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, 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("security.IotAlertsClient", "List", err.Error()) - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, solutionName, minStartTimeUtc, maxStartTimeUtc, alertType, compromisedEntity, limit, skipToken) + req, err := client.ListPreparer(ctx, scope, minStartTimeUtc, maxStartTimeUtc, alertType, deviceManagementType, compromisedEntity, limit, skipToken) if err != nil { err = autorest.NewErrorWithError(err, "security.IotAlertsClient", "List", nil, "Failure preparing request") return @@ -237,17 +137,17 @@ func (client IotAlertsClient) List(ctx context.Context, resourceGroupName string resp, err := client.ListSender(req) if err != nil { - result.ial.Response = autorest.Response{Response: resp} + result.ialm.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "security.IotAlertsClient", "List", resp, "Failure sending request") return } - result.ial, err = client.ListResponder(resp) + result.ialm, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "security.IotAlertsClient", "List", resp, "Failure responding to request") return } - if result.ial.hasNextLink() && result.ial.IsEmpty() { + if result.ialm.hasNextLink() && result.ialm.IsEmpty() { err = result.NextWithContext(ctx) return } @@ -256,14 +156,12 @@ func (client IotAlertsClient) List(ctx context.Context, resourceGroupName string } // ListPreparer prepares the List request. -func (client IotAlertsClient) ListPreparer(ctx context.Context, resourceGroupName string, solutionName string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, compromisedEntity string, limit *int32, skipToken string) (*http.Request, error) { +func (client IotAlertsClient) ListPreparer(ctx context.Context, scope string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, deviceManagementType ManagementState, compromisedEntity string, limit *int32, skipToken string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "solutionName": autorest.Encode("path", solutionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "scope": scope, } - const APIVersion = "2019-08-01" + const APIVersion = "2020-08-06-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -276,6 +174,9 @@ func (client IotAlertsClient) ListPreparer(ctx context.Context, resourceGroupNam if len(alertType) > 0 { queryParameters["alertType"] = autorest.Encode("query", alertType) } + if len(string(deviceManagementType)) > 0 { + queryParameters["deviceManagementType"] = autorest.Encode("query", deviceManagementType) + } if len(compromisedEntity) > 0 { queryParameters["compromisedEntity"] = autorest.Encode("query", compromisedEntity) } @@ -289,7 +190,7 @@ func (client IotAlertsClient) ListPreparer(ctx context.Context, resourceGroupNam preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/iotAlerts", pathParameters), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/iotAlerts", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -297,12 +198,12 @@ func (client IotAlertsClient) ListPreparer(ctx context.Context, resourceGroupNam // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client IotAlertsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + 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 IotAlertsClient) ListResponder(resp *http.Response) (result IotAlertList, err error) { +func (client IotAlertsClient) ListResponder(resp *http.Response) (result IotAlertListModel, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -313,8 +214,8 @@ func (client IotAlertsClient) ListResponder(resp *http.Response) (result IotAler } // listNextResults retrieves the next set of results, if any. -func (client IotAlertsClient) listNextResults(ctx context.Context, lastResults IotAlertList) (result IotAlertList, err error) { - req, err := lastResults.iotAlertListPreparer(ctx) +func (client IotAlertsClient) listNextResults(ctx context.Context, lastResults IotAlertListModel) (result IotAlertListModel, err error) { + req, err := lastResults.iotAlertListModelPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "security.IotAlertsClient", "listNextResults", nil, "Failure preparing next results request") } @@ -334,7 +235,7 @@ func (client IotAlertsClient) listNextResults(ctx context.Context, lastResults I } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IotAlertsClient) ListComplete(ctx context.Context, resourceGroupName string, solutionName string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, compromisedEntity string, limit *int32, skipToken string) (result IotAlertListIterator, err error) { +func (client IotAlertsClient) ListComplete(ctx context.Context, scope string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, deviceManagementType ManagementState, compromisedEntity string, limit *int32, skipToken string) (result IotAlertListModelIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/IotAlertsClient.List") defer func() { @@ -345,150 +246,6 @@ func (client IotAlertsClient) ListComplete(ctx context.Context, resourceGroupNam tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.List(ctx, resourceGroupName, solutionName, minStartTimeUtc, maxStartTimeUtc, alertType, compromisedEntity, limit, skipToken) - return -} - -// List1 list IoT alerts -// Parameters: -// scope - scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. -// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}) -// minStartTimeUtc - filter by minimum startTimeUtc (ISO 8601 format) -// maxStartTimeUtc - filter by maximum startTimeUtc (ISO 8601 format) -// alertType - filter by alert type -// deviceManagementType - get devices only from specific type, Managed or Unmanaged. -// compromisedEntity - filter by compromised device -// limit - limit the number of items returned in a single page -// skipToken - skip token used for pagination -func (client IotAlertsClient) List1(ctx context.Context, scope string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, deviceManagementType ManagementState, compromisedEntity string, limit *int32, skipToken string) (result IotAlertListModelPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotAlertsClient.List1") - defer func() { - sc := -1 - if result.ialm.Response.Response != nil { - sc = result.ialm.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.list1NextResults - req, err := client.List1Preparer(ctx, scope, minStartTimeUtc, maxStartTimeUtc, alertType, deviceManagementType, compromisedEntity, limit, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotAlertsClient", "List1", nil, "Failure preparing request") - return - } - - resp, err := client.List1Sender(req) - if err != nil { - result.ialm.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IotAlertsClient", "List1", resp, "Failure sending request") - return - } - - result.ialm, err = client.List1Responder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotAlertsClient", "List1", resp, "Failure responding to request") - return - } - if result.ialm.hasNextLink() && result.ialm.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// List1Preparer prepares the List1 request. -func (client IotAlertsClient) List1Preparer(ctx context.Context, scope string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, deviceManagementType ManagementState, compromisedEntity string, limit *int32, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2020-08-06-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(minStartTimeUtc) > 0 { - queryParameters["startTimeUtc>"] = autorest.Encode("query", minStartTimeUtc) - } - if len(maxStartTimeUtc) > 0 { - queryParameters["startTimeUtc<"] = autorest.Encode("query", maxStartTimeUtc) - } - if len(alertType) > 0 { - queryParameters["alertType"] = autorest.Encode("query", alertType) - } - if len(string(deviceManagementType)) > 0 { - queryParameters["deviceManagementType"] = autorest.Encode("query", deviceManagementType) - } - if len(compromisedEntity) > 0 { - queryParameters["compromisedEntity"] = autorest.Encode("query", compromisedEntity) - } - if limit != nil { - queryParameters["$limit"] = autorest.Encode("query", *limit) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/iotAlerts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// List1Sender sends the List1 request. The method will close the -// http.Response Body if it receives an error. -func (client IotAlertsClient) List1Sender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// List1Responder handles the response to the List1 request. The method always -// closes the http.Response Body. -func (client IotAlertsClient) List1Responder(resp *http.Response) (result IotAlertListModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// list1NextResults retrieves the next set of results, if any. -func (client IotAlertsClient) list1NextResults(ctx context.Context, lastResults IotAlertListModel) (result IotAlertListModel, err error) { - req, err := lastResults.iotAlertListModelPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "security.IotAlertsClient", "list1NextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.List1Sender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "security.IotAlertsClient", "list1NextResults", resp, "Failure sending next results request") - } - result, err = client.List1Responder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotAlertsClient", "list1NextResults", resp, "Failure responding to next results request") - } - return -} - -// List1Complete enumerates all values, automatically crossing page boundaries as required. -func (client IotAlertsClient) List1Complete(ctx context.Context, scope string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, deviceManagementType ManagementState, compromisedEntity string, limit *int32, skipToken string) (result IotAlertListModelIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotAlertsClient.List1") - 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.List1(ctx, scope, minStartTimeUtc, maxStartTimeUtc, alertType, deviceManagementType, compromisedEntity, limit, skipToken) + result.page, err = client.List(ctx, scope, minStartTimeUtc, maxStartTimeUtc, alertType, deviceManagementType, compromisedEntity, limit, skipToken) return } diff --git a/services/preview/security/mgmt/v3.0/security/iotalerttypes.go b/services/preview/security/mgmt/v3.0/security/iotalerttypes.go index 5c736cd98d90..08f297dde0c6 100644 --- a/services/preview/security/mgmt/v3.0/security/iotalerttypes.go +++ b/services/preview/security/mgmt/v3.0/security/iotalerttypes.go @@ -33,11 +33,8 @@ func NewIotAlertTypesClientWithBaseURI(baseURI string, subscriptionID string, as // Get get IoT alert type // Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// solutionName - the name of the IoT Security solution. // iotAlertTypeName - name of the alert type -func (client IotAlertTypesClient) Get(ctx context.Context, resourceGroupName string, solutionName string, iotAlertTypeName string) (result IotAlertType, err error) { +func (client IotAlertTypesClient) Get(ctx context.Context, iotAlertTypeName string) (result IotAlertType, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/IotAlertTypesClient.Get") defer func() { @@ -50,15 +47,11 @@ func (client IotAlertTypesClient) Get(ctx context.Context, resourceGroupName str } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, 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 { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("security.IotAlertTypesClient", "Get", err.Error()) } - req, err := client.GetPreparer(ctx, resourceGroupName, solutionName, iotAlertTypeName) + req, err := client.GetPreparer(ctx, iotAlertTypeName) if err != nil { err = autorest.NewErrorWithError(err, "security.IotAlertTypesClient", "Get", nil, "Failure preparing request") return @@ -81,89 +74,7 @@ func (client IotAlertTypesClient) Get(ctx context.Context, resourceGroupName str } // GetPreparer prepares the Get request. -func (client IotAlertTypesClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string, iotAlertTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "iotAlertTypeName": autorest.Encode("path", iotAlertTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "solutionName": autorest.Encode("path", solutionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.Security/iotSecuritySolutions/{solutionName}/iotAlertTypes/{iotAlertTypeName}", 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 IotAlertTypesClient) 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 IotAlertTypesClient) GetResponder(resp *http.Response) (result IotAlertType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get1 get IoT alert type -// Parameters: -// iotAlertTypeName - name of the alert type -func (client IotAlertTypesClient) Get1(ctx context.Context, iotAlertTypeName string) (result IotAlertType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotAlertTypesClient.Get1") - 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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IotAlertTypesClient", "Get1", err.Error()) - } - - req, err := client.Get1Preparer(ctx, iotAlertTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotAlertTypesClient", "Get1", nil, "Failure preparing request") - return - } - - resp, err := client.Get1Sender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IotAlertTypesClient", "Get1", resp, "Failure sending request") - return - } - - result, err = client.Get1Responder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotAlertTypesClient", "Get1", resp, "Failure responding to request") - return - } - - return -} - -// Get1Preparer prepares the Get1 request. -func (client IotAlertTypesClient) Get1Preparer(ctx context.Context, iotAlertTypeName string) (*http.Request, error) { +func (client IotAlertTypesClient) GetPreparer(ctx context.Context, iotAlertTypeName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "iotAlertTypeName": autorest.Encode("path", iotAlertTypeName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -182,15 +93,15 @@ func (client IotAlertTypesClient) Get1Preparer(ctx context.Context, iotAlertType return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Get1Sender sends the Get1 request. The method will close the +// GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client IotAlertTypesClient) Get1Sender(req *http.Request) (*http.Response, error) { +func (client IotAlertTypesClient) GetSender(req *http.Request) (*http.Response, error) { return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } -// Get1Responder handles the response to the Get1 request. The method always +// GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client IotAlertTypesClient) Get1Responder(resp *http.Response) (result IotAlertType, err error) { +func (client IotAlertTypesClient) GetResponder(resp *http.Response) (result IotAlertType, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -201,11 +112,7 @@ func (client IotAlertTypesClient) Get1Responder(resp *http.Response) (result Iot } // List list IoT alert types -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// solutionName - the name of the IoT Security solution. -func (client IotAlertTypesClient) List(ctx context.Context, resourceGroupName string, solutionName string) (result IotAlertTypeList, err error) { +func (client IotAlertTypesClient) List(ctx context.Context) (result IotAlertTypeList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/IotAlertTypesClient.List") defer func() { @@ -218,15 +125,11 @@ func (client IotAlertTypesClient) List(ctx context.Context, resourceGroupName st } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, 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 { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("security.IotAlertTypesClient", "List", err.Error()) } - req, err := client.ListPreparer(ctx, resourceGroupName, solutionName) + req, err := client.ListPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "security.IotAlertTypesClient", "List", nil, "Failure preparing request") return @@ -249,14 +152,12 @@ func (client IotAlertTypesClient) List(ctx context.Context, resourceGroupName st } // ListPreparer prepares the List request. -func (client IotAlertTypesClient) ListPreparer(ctx context.Context, resourceGroupName string, solutionName string) (*http.Request, error) { +func (client IotAlertTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "solutionName": autorest.Encode("path", solutionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-08-01" + const APIVersion = "2020-08-06-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -264,7 +165,7 @@ func (client IotAlertTypesClient) ListPreparer(ctx context.Context, resourceGrou preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/iotAlertTypes", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotAlertTypes", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -286,80 +187,3 @@ func (client IotAlertTypesClient) ListResponder(resp *http.Response) (result Iot result.Response = autorest.Response{Response: resp} return } - -// List1 list IoT alert types -func (client IotAlertTypesClient) List1(ctx context.Context) (result IotAlertTypeList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotAlertTypesClient.List1") - 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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IotAlertTypesClient", "List1", err.Error()) - } - - req, err := client.List1Preparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotAlertTypesClient", "List1", nil, "Failure preparing request") - return - } - - resp, err := client.List1Sender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IotAlertTypesClient", "List1", resp, "Failure sending request") - return - } - - result, err = client.List1Responder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotAlertTypesClient", "List1", resp, "Failure responding to request") - return - } - - return -} - -// List1Preparer prepares the List1 request. -func (client IotAlertTypesClient) List1Preparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-06-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotAlertTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// List1Sender sends the List1 request. The method will close the -// http.Response Body if it receives an error. -func (client IotAlertTypesClient) List1Sender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// List1Responder handles the response to the List1 request. The method always -// closes the http.Response Body. -func (client IotAlertTypesClient) List1Responder(resp *http.Response) (result IotAlertTypeList, 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/security/mgmt/v3.0/security/iotrecommendations.go b/services/preview/security/mgmt/v3.0/security/iotrecommendations.go index 9a54ec23a6fa..d65c06b1cb94 100644 --- a/services/preview/security/mgmt/v3.0/security/iotrecommendations.go +++ b/services/preview/security/mgmt/v3.0/security/iotrecommendations.go @@ -10,7 +10,6 @@ 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" ) @@ -34,11 +33,10 @@ func NewIotRecommendationsClientWithBaseURI(baseURI string, subscriptionID strin // Get get IoT recommendation // Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// solutionName - the name of the IoT Security solution. +// scope - scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. +// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}) // iotRecommendationID - id of the recommendation -func (client IotRecommendationsClient) Get(ctx context.Context, resourceGroupName string, solutionName string, iotRecommendationID string) (result IotRecommendation, err error) { +func (client IotRecommendationsClient) Get(ctx context.Context, scope string, iotRecommendationID string) (result IotRecommendationModel, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/IotRecommendationsClient.Get") defer func() { @@ -49,17 +47,7 @@ func (client IotRecommendationsClient) Get(ctx context.Context, resourceGroupNam tracing.EndSpan(ctx, sc, err) }() } - if err := validation.Validate([]validation.Validation{ - {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, 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("security.IotRecommendationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, solutionName, iotRecommendationID) + req, err := client.GetPreparer(ctx, scope, iotRecommendationID) if err != nil { err = autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "Get", nil, "Failure preparing request") return @@ -82,85 +70,7 @@ func (client IotRecommendationsClient) Get(ctx context.Context, resourceGroupNam } // GetPreparer prepares the Get request. -func (client IotRecommendationsClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string, iotRecommendationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "iotRecommendationId": autorest.Encode("path", iotRecommendationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "solutionName": autorest.Encode("path", solutionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2019-08-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.Security/iotSecuritySolutions/{solutionName}/iotRecommendations/{iotRecommendationId}", 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 IotRecommendationsClient) 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 IotRecommendationsClient) GetResponder(resp *http.Response) (result IotRecommendation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get1 get IoT recommendation -// Parameters: -// scope - scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. -// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}) -// iotRecommendationID - id of the recommendation -func (client IotRecommendationsClient) Get1(ctx context.Context, scope string, iotRecommendationID string) (result IotRecommendationModel, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotRecommendationsClient.Get1") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.Get1Preparer(ctx, scope, iotRecommendationID) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "Get1", nil, "Failure preparing request") - return - } - - resp, err := client.Get1Sender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "Get1", resp, "Failure sending request") - return - } - - result, err = client.Get1Responder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "Get1", resp, "Failure responding to request") - return - } - - return -} - -// Get1Preparer prepares the Get1 request. -func (client IotRecommendationsClient) Get1Preparer(ctx context.Context, scope string, iotRecommendationID string) (*http.Request, error) { +func (client IotRecommendationsClient) GetPreparer(ctx context.Context, scope string, iotRecommendationID string) (*http.Request, error) { pathParameters := map[string]interface{}{ "iotRecommendationId": autorest.Encode("path", iotRecommendationID), "scope": scope, @@ -179,15 +89,15 @@ func (client IotRecommendationsClient) Get1Preparer(ctx context.Context, scope s return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// Get1Sender sends the Get1 request. The method will close the +// GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. -func (client IotRecommendationsClient) Get1Sender(req *http.Request) (*http.Response, error) { +func (client IotRecommendationsClient) GetSender(req *http.Request) (*http.Response, error) { return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// Get1Responder handles the response to the Get1 request. The method always +// GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client IotRecommendationsClient) Get1Responder(resp *http.Response) (result IotRecommendationModel, err error) { +func (client IotRecommendationsClient) GetResponder(resp *http.Response) (result IotRecommendationModel, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -199,36 +109,25 @@ func (client IotRecommendationsClient) Get1Responder(resp *http.Response) (resul // List list IoT recommendations // Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// solutionName - the name of the IoT Security solution. +// scope - scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. +// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}) // recommendationType - filter by recommendation type // deviceID - filter by device id // limit - limit the number of items returned in a single page // skipToken - skip token used for pagination -func (client IotRecommendationsClient) List(ctx context.Context, resourceGroupName string, solutionName string, recommendationType string, deviceID string, limit *int32, skipToken string) (result IotRecommendationListPage, err error) { +func (client IotRecommendationsClient) List(ctx context.Context, scope string, recommendationType string, deviceID string, limit *int32, skipToken string) (result IotRecommendationListModelPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/IotRecommendationsClient.List") defer func() { sc := -1 - if result.irl.Response.Response != nil { - sc = result.irl.Response.Response.StatusCode + if result.irlm.Response.Response != nil { + sc = result.irlm.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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, 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("security.IotRecommendationsClient", "List", err.Error()) - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, solutionName, recommendationType, deviceID, limit, skipToken) + req, err := client.ListPreparer(ctx, scope, recommendationType, deviceID, limit, skipToken) if err != nil { err = autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "List", nil, "Failure preparing request") return @@ -236,17 +135,17 @@ func (client IotRecommendationsClient) List(ctx context.Context, resourceGroupNa resp, err := client.ListSender(req) if err != nil { - result.irl.Response = autorest.Response{Response: resp} + result.irlm.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "List", resp, "Failure sending request") return } - result.irl, err = client.ListResponder(resp) + result.irlm, err = client.ListResponder(resp) if err != nil { err = autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "List", resp, "Failure responding to request") return } - if result.irl.hasNextLink() && result.irl.IsEmpty() { + if result.irlm.hasNextLink() && result.irlm.IsEmpty() { err = result.NextWithContext(ctx) return } @@ -255,14 +154,12 @@ func (client IotRecommendationsClient) List(ctx context.Context, resourceGroupNa } // ListPreparer prepares the List request. -func (client IotRecommendationsClient) ListPreparer(ctx context.Context, resourceGroupName string, solutionName string, recommendationType string, deviceID string, limit *int32, skipToken string) (*http.Request, error) { +func (client IotRecommendationsClient) ListPreparer(ctx context.Context, scope string, recommendationType string, deviceID string, limit *int32, skipToken string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "solutionName": autorest.Encode("path", solutionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "scope": scope, } - const APIVersion = "2019-08-01" + const APIVersion = "2020-08-06-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -282,7 +179,7 @@ func (client IotRecommendationsClient) ListPreparer(ctx context.Context, resourc preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/iotRecommendations", pathParameters), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/iotRecommendations", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -290,12 +187,12 @@ func (client IotRecommendationsClient) ListPreparer(ctx context.Context, resourc // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client IotRecommendationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) + 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 IotRecommendationsClient) ListResponder(resp *http.Response) (result IotRecommendationList, err error) { +func (client IotRecommendationsClient) ListResponder(resp *http.Response) (result IotRecommendationListModel, err error) { err = autorest.Respond( resp, azure.WithErrorUnlessStatusCode(http.StatusOK), @@ -306,8 +203,8 @@ func (client IotRecommendationsClient) ListResponder(resp *http.Response) (resul } // listNextResults retrieves the next set of results, if any. -func (client IotRecommendationsClient) listNextResults(ctx context.Context, lastResults IotRecommendationList) (result IotRecommendationList, err error) { - req, err := lastResults.iotRecommendationListPreparer(ctx) +func (client IotRecommendationsClient) listNextResults(ctx context.Context, lastResults IotRecommendationListModel) (result IotRecommendationListModel, err error) { + req, err := lastResults.iotRecommendationListModelPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "listNextResults", nil, "Failure preparing next results request") } @@ -327,7 +224,7 @@ func (client IotRecommendationsClient) listNextResults(ctx context.Context, last } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client IotRecommendationsClient) ListComplete(ctx context.Context, resourceGroupName string, solutionName string, recommendationType string, deviceID string, limit *int32, skipToken string) (result IotRecommendationListIterator, err error) { +func (client IotRecommendationsClient) ListComplete(ctx context.Context, scope string, recommendationType string, deviceID string, limit *int32, skipToken string) (result IotRecommendationListModelIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/IotRecommendationsClient.List") defer func() { @@ -338,138 +235,6 @@ func (client IotRecommendationsClient) ListComplete(ctx context.Context, resourc tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.List(ctx, resourceGroupName, solutionName, recommendationType, deviceID, limit, skipToken) - return -} - -// List1 list IoT recommendations -// Parameters: -// scope - scope of the query: Subscription (i.e. /subscriptions/{subscriptionId}) or IoT Hub (i.e. -// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Devices/iotHubs/{iotHubName}) -// recommendationType - filter by recommendation type -// deviceID - filter by device id -// limit - limit the number of items returned in a single page -// skipToken - skip token used for pagination -func (client IotRecommendationsClient) List1(ctx context.Context, scope string, recommendationType string, deviceID string, limit *int32, skipToken string) (result IotRecommendationListModelPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotRecommendationsClient.List1") - defer func() { - sc := -1 - if result.irlm.Response.Response != nil { - sc = result.irlm.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.list1NextResults - req, err := client.List1Preparer(ctx, scope, recommendationType, deviceID, limit, skipToken) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "List1", nil, "Failure preparing request") - return - } - - resp, err := client.List1Sender(req) - if err != nil { - result.irlm.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "List1", resp, "Failure sending request") - return - } - - result.irlm, err = client.List1Responder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "List1", resp, "Failure responding to request") - return - } - if result.irlm.hasNextLink() && result.irlm.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// List1Preparer prepares the List1 request. -func (client IotRecommendationsClient) List1Preparer(ctx context.Context, scope string, recommendationType string, deviceID string, limit *int32, skipToken string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "scope": scope, - } - - const APIVersion = "2020-08-06-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(recommendationType) > 0 { - queryParameters["recommendationType"] = autorest.Encode("query", recommendationType) - } - if len(deviceID) > 0 { - queryParameters["deviceId"] = autorest.Encode("query", deviceID) - } - if limit != nil { - queryParameters["$limit"] = autorest.Encode("query", *limit) - } - if len(skipToken) > 0 { - queryParameters["$skipToken"] = autorest.Encode("query", skipToken) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/iotRecommendations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// List1Sender sends the List1 request. The method will close the -// http.Response Body if it receives an error. -func (client IotRecommendationsClient) List1Sender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// List1Responder handles the response to the List1 request. The method always -// closes the http.Response Body. -func (client IotRecommendationsClient) List1Responder(resp *http.Response) (result IotRecommendationListModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// list1NextResults retrieves the next set of results, if any. -func (client IotRecommendationsClient) list1NextResults(ctx context.Context, lastResults IotRecommendationListModel) (result IotRecommendationListModel, err error) { - req, err := lastResults.iotRecommendationListModelPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "list1NextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.List1Sender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "list1NextResults", resp, "Failure sending next results request") - } - result, err = client.List1Responder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotRecommendationsClient", "list1NextResults", resp, "Failure responding to next results request") - } - return -} - -// List1Complete enumerates all values, automatically crossing page boundaries as required. -func (client IotRecommendationsClient) List1Complete(ctx context.Context, scope string, recommendationType string, deviceID string, limit *int32, skipToken string) (result IotRecommendationListModelIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotRecommendationsClient.List1") - 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.List1(ctx, scope, recommendationType, deviceID, limit, skipToken) + result.page, err = client.List(ctx, scope, recommendationType, deviceID, limit, skipToken) return } diff --git a/services/preview/security/mgmt/v3.0/security/iotrecommendationtypes.go b/services/preview/security/mgmt/v3.0/security/iotrecommendationtypes.go index f43cc065d725..23f77b0dfd7b 100644 --- a/services/preview/security/mgmt/v3.0/security/iotrecommendationtypes.go +++ b/services/preview/security/mgmt/v3.0/security/iotrecommendationtypes.go @@ -34,11 +34,8 @@ func NewIotRecommendationTypesClientWithBaseURI(baseURI string, subscriptionID s // Get get IoT recommendation type // Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// solutionName - the name of the IoT Security solution. // iotRecommendationTypeName - name of the recommendation type -func (client IotRecommendationTypesClient) Get(ctx context.Context, resourceGroupName string, solutionName string, iotRecommendationTypeName string) (result IotRecommendationType, err error) { +func (client IotRecommendationTypesClient) Get(ctx context.Context, iotRecommendationTypeName string) (result IotRecommendationType, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/IotRecommendationTypesClient.Get") defer func() { @@ -51,15 +48,11 @@ func (client IotRecommendationTypesClient) Get(ctx context.Context, resourceGrou } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, 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 { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("security.IotRecommendationTypesClient", "Get", err.Error()) } - req, err := client.GetPreparer(ctx, resourceGroupName, solutionName, iotRecommendationTypeName) + req, err := client.GetPreparer(ctx, iotRecommendationTypeName) if err != nil { err = autorest.NewErrorWithError(err, "security.IotRecommendationTypesClient", "Get", nil, "Failure preparing request") return @@ -82,15 +75,13 @@ func (client IotRecommendationTypesClient) Get(ctx context.Context, resourceGrou } // GetPreparer prepares the Get request. -func (client IotRecommendationTypesClient) GetPreparer(ctx context.Context, resourceGroupName string, solutionName string, iotRecommendationTypeName string) (*http.Request, error) { +func (client IotRecommendationTypesClient) GetPreparer(ctx context.Context, iotRecommendationTypeName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "iotRecommendationTypeName": autorest.Encode("path", iotRecommendationTypeName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "solutionName": autorest.Encode("path", solutionName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-08-01" + const APIVersion = "2020-08-06-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -98,7 +89,7 @@ func (client IotRecommendationTypesClient) GetPreparer(ctx context.Context, reso preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/iotRecommendationTypes/{iotRecommendationTypeName}", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotRecommendationTypes/{iotRecommendationTypeName}", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -121,92 +112,8 @@ func (client IotRecommendationTypesClient) GetResponder(resp *http.Response) (re return } -// Get1 get IoT recommendation type -// Parameters: -// iotRecommendationTypeName - name of the recommendation type -func (client IotRecommendationTypesClient) Get1(ctx context.Context, iotRecommendationTypeName string) (result IotRecommendationType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotRecommendationTypesClient.Get1") - 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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IotRecommendationTypesClient", "Get1", err.Error()) - } - - req, err := client.Get1Preparer(ctx, iotRecommendationTypeName) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotRecommendationTypesClient", "Get1", nil, "Failure preparing request") - return - } - - resp, err := client.Get1Sender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IotRecommendationTypesClient", "Get1", resp, "Failure sending request") - return - } - - result, err = client.Get1Responder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotRecommendationTypesClient", "Get1", resp, "Failure responding to request") - return - } - - return -} - -// Get1Preparer prepares the Get1 request. -func (client IotRecommendationTypesClient) Get1Preparer(ctx context.Context, iotRecommendationTypeName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "iotRecommendationTypeName": autorest.Encode("path", iotRecommendationTypeName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-06-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotRecommendationTypes/{iotRecommendationTypeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// Get1Sender sends the Get1 request. The method will close the -// http.Response Body if it receives an error. -func (client IotRecommendationTypesClient) Get1Sender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// Get1Responder handles the response to the Get1 request. The method always -// closes the http.Response Body. -func (client IotRecommendationTypesClient) Get1Responder(resp *http.Response) (result IotRecommendationType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - // List list IoT recommendation types -// Parameters: -// resourceGroupName - the name of the resource group within the user's subscription. The name is case -// insensitive. -// solutionName - the name of the IoT Security solution. -func (client IotRecommendationTypesClient) List(ctx context.Context, resourceGroupName string, solutionName string) (result IotRecommendationTypeList, err error) { +func (client IotRecommendationTypesClient) List(ctx context.Context) (result IotRecommendationTypeList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/IotRecommendationTypesClient.List") defer func() { @@ -219,15 +126,11 @@ func (client IotRecommendationTypesClient) List(ctx context.Context, resourceGro } if err := validation.Validate([]validation.Validation{ {TargetValue: client.SubscriptionID, - Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, 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 { + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { return result, validation.NewError("security.IotRecommendationTypesClient", "List", err.Error()) } - req, err := client.ListPreparer(ctx, resourceGroupName, solutionName) + req, err := client.ListPreparer(ctx) if err != nil { err = autorest.NewErrorWithError(err, "security.IotRecommendationTypesClient", "List", nil, "Failure preparing request") return @@ -250,14 +153,12 @@ func (client IotRecommendationTypesClient) List(ctx context.Context, resourceGro } // ListPreparer prepares the List request. -func (client IotRecommendationTypesClient) ListPreparer(ctx context.Context, resourceGroupName string, solutionName string) (*http.Request, error) { +func (client IotRecommendationTypesClient) ListPreparer(ctx context.Context) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "solutionName": autorest.Encode("path", solutionName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), } - const APIVersion = "2019-08-01" + const APIVersion = "2020-08-06-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -265,7 +166,7 @@ func (client IotRecommendationTypesClient) ListPreparer(ctx context.Context, res preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/iotRecommendationTypes", pathParameters), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotRecommendationTypes", pathParameters), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -287,80 +188,3 @@ func (client IotRecommendationTypesClient) ListResponder(resp *http.Response) (r result.Response = autorest.Response{Response: resp} return } - -// List1 list IoT recommendation types -func (client IotRecommendationTypesClient) List1(ctx context.Context) (result IotRecommendationTypeList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotRecommendationTypesClient.List1") - 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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("security.IotRecommendationTypesClient", "List1", err.Error()) - } - - req, err := client.List1Preparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotRecommendationTypesClient", "List1", nil, "Failure preparing request") - return - } - - resp, err := client.List1Sender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "security.IotRecommendationTypesClient", "List1", resp, "Failure sending request") - return - } - - result, err = client.List1Responder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.IotRecommendationTypesClient", "List1", resp, "Failure responding to request") - return - } - - return -} - -// List1Preparer prepares the List1 request. -func (client IotRecommendationTypesClient) List1Preparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-08-06-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotRecommendationTypes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// List1Sender sends the List1 request. The method will close the -// http.Response Body if it receives an error. -func (client IotRecommendationTypesClient) List1Sender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// List1Responder handles the response to the List1 request. The method always -// closes the http.Response Body. -func (client IotRecommendationTypesClient) List1Responder(resp *http.Response) (result IotRecommendationTypeList, 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/security/mgmt/v3.0/security/iotsecuritysolution.go b/services/preview/security/mgmt/v3.0/security/iotsecuritysolution.go index 572dc3a15492..453312504f18 100644 --- a/services/preview/security/mgmt/v3.0/security/iotsecuritysolution.go +++ b/services/preview/security/mgmt/v3.0/security/iotsecuritysolution.go @@ -106,6 +106,7 @@ func (client IotSecuritySolutionClient) CreateOrUpdatePreparer(ctx context.Conte iotSecuritySolutionData.ID = nil iotSecuritySolutionData.Name = nil iotSecuritySolutionData.Type = nil + iotSecuritySolutionData.SystemData = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), diff --git a/services/preview/security/mgmt/v3.0/security/models.go b/services/preview/security/mgmt/v3.0/security/models.go index 420ba8ad3050..0d33397018d3 100644 --- a/services/preview/security/mgmt/v3.0/security/models.go +++ b/services/preview/security/mgmt/v3.0/security/models.go @@ -105,7 +105,7 @@ type ActiveConnectionsNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -181,6 +181,11 @@ func (acniar ActiveConnectionsNotInAllowedRange) AsConnectionToIPNotAllowed() (* return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for ActiveConnectionsNotInAllowedRange. +func (acniar ActiveConnectionsNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for ActiveConnectionsNotInAllowedRange. func (acniar ActiveConnectionsNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -367,7 +372,7 @@ func (aacg *AdaptiveApplicationControlGroup) UnmarshalJSON(body []byte) error { // AdaptiveApplicationControlGroupData represents a machines group and set of rules to be allowed running // on a machine type AdaptiveApplicationControlGroupData struct { - // EnforcementMode - Possible values include: 'Audit', 'Enforce', 'None' + // EnforcementMode - Possible values include: 'EnforcementModeAudit', 'EnforcementModeEnforce', 'EnforcementModeNone' EnforcementMode EnforcementMode `json:"enforcementMode,omitempty"` ProtectionMode *ProtectionMode `json:"protectionMode,omitempty"` // ConfigurationStatus - READ-ONLY; Possible values include: 'ConfigurationStatus2Configured', 'ConfigurationStatus2NotConfigured', 'ConfigurationStatus2InProgress', 'ConfigurationStatus2Failed', 'ConfigurationStatus2NoStatus' @@ -798,6 +803,16 @@ func (ad AdditionalData) AsBasicAdditionalData() (BasicAdditionalData, bool) { return &ad, true } +// AdditionalWorkspacesProperties properties of the additional workspaces. +type AdditionalWorkspacesProperties struct { + // Workspace - Workspace resource id + Workspace *string `json:"workspace,omitempty"` + // Type - Workspace type. Possible values include: 'Sentinel' + Type AdditionalWorkspaceType `json:"type,omitempty"` + // DataTypes - List of data types sent to workspace + DataTypes *[]AdditionalWorkspaceDataType `json:"dataTypes,omitempty"` +} + // AdvancedThreatProtectionProperties the Advanced Threat Protection settings. type AdvancedThreatProtectionProperties struct { // IsEnabled - Indicates whether Advanced Threat Protection is enabled. @@ -1450,6 +1465,273 @@ func (ap *AlertProperties) UnmarshalJSON(body []byte) error { return nil } +// AlertSimulatorBundlesRequestProperties simulate alerts according to this bundles. +type AlertSimulatorBundlesRequestProperties struct { + // Bundles - Bundles list. + Bundles *[]BundleType `json:"bundles,omitempty"` + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Kind - Possible values include: 'KindAlertSimulatorRequestProperties', 'KindBundles' + Kind KindEnum2 `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for AlertSimulatorBundlesRequestProperties. +func (asbrp AlertSimulatorBundlesRequestProperties) MarshalJSON() ([]byte, error) { + asbrp.Kind = KindBundles + objectMap := make(map[string]interface{}) + if asbrp.Bundles != nil { + objectMap["bundles"] = asbrp.Bundles + } + if asbrp.Kind != "" { + objectMap["kind"] = asbrp.Kind + } + for k, v := range asbrp.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsAlertSimulatorBundlesRequestProperties is the BasicAlertSimulatorRequestProperties implementation for AlertSimulatorBundlesRequestProperties. +func (asbrp AlertSimulatorBundlesRequestProperties) AsAlertSimulatorBundlesRequestProperties() (*AlertSimulatorBundlesRequestProperties, bool) { + return &asbrp, true +} + +// AsAlertSimulatorRequestProperties is the BasicAlertSimulatorRequestProperties implementation for AlertSimulatorBundlesRequestProperties. +func (asbrp AlertSimulatorBundlesRequestProperties) AsAlertSimulatorRequestProperties() (*AlertSimulatorRequestProperties, bool) { + return nil, false +} + +// AsBasicAlertSimulatorRequestProperties is the BasicAlertSimulatorRequestProperties implementation for AlertSimulatorBundlesRequestProperties. +func (asbrp AlertSimulatorBundlesRequestProperties) AsBasicAlertSimulatorRequestProperties() (BasicAlertSimulatorRequestProperties, bool) { + return &asbrp, true +} + +// UnmarshalJSON is the custom unmarshaler for AlertSimulatorBundlesRequestProperties struct. +func (asbrp *AlertSimulatorBundlesRequestProperties) 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 "bundles": + if v != nil { + var bundles []BundleType + err = json.Unmarshal(*v, &bundles) + if err != nil { + return err + } + asbrp.Bundles = &bundles + } + default: + if v != nil { + var additionalProperties interface{} + err = json.Unmarshal(*v, &additionalProperties) + if err != nil { + return err + } + if asbrp.AdditionalProperties == nil { + asbrp.AdditionalProperties = make(map[string]interface{}) + } + asbrp.AdditionalProperties[k] = additionalProperties + } + case "kind": + if v != nil { + var kind KindEnum2 + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asbrp.Kind = kind + } + } + } + + return nil +} + +// AlertSimulatorRequestBody alert Simulator request body. +type AlertSimulatorRequestBody struct { + // Properties - Alert Simulator request body data. + Properties BasicAlertSimulatorRequestProperties `json:"properties,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for AlertSimulatorRequestBody struct. +func (asrb *AlertSimulatorRequestBody) 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 := unmarshalBasicAlertSimulatorRequestProperties(*v) + if err != nil { + return err + } + asrb.Properties = properties + } + } + } + + return nil +} + +// BasicAlertSimulatorRequestProperties describes properties of an alert simulation request +type BasicAlertSimulatorRequestProperties interface { + AsAlertSimulatorBundlesRequestProperties() (*AlertSimulatorBundlesRequestProperties, bool) + AsAlertSimulatorRequestProperties() (*AlertSimulatorRequestProperties, bool) +} + +// AlertSimulatorRequestProperties describes properties of an alert simulation request +type AlertSimulatorRequestProperties struct { + // AdditionalProperties - Unmatched properties from the message are deserialized this collection + AdditionalProperties map[string]interface{} `json:""` + // Kind - Possible values include: 'KindAlertSimulatorRequestProperties', 'KindBundles' + Kind KindEnum2 `json:"kind,omitempty"` +} + +func unmarshalBasicAlertSimulatorRequestProperties(body []byte) (BasicAlertSimulatorRequestProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindBundles): + var asbrp AlertSimulatorBundlesRequestProperties + err := json.Unmarshal(body, &asbrp) + return asbrp, err + default: + var asrp AlertSimulatorRequestProperties + err := json.Unmarshal(body, &asrp) + return asrp, err + } +} +func unmarshalBasicAlertSimulatorRequestPropertiesArray(body []byte) ([]BasicAlertSimulatorRequestProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + asrpArray := make([]BasicAlertSimulatorRequestProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + asrp, err := unmarshalBasicAlertSimulatorRequestProperties(*rawMessage) + if err != nil { + return nil, err + } + asrpArray[index] = asrp + } + return asrpArray, nil +} + +// MarshalJSON is the custom marshaler for AlertSimulatorRequestProperties. +func (asrp AlertSimulatorRequestProperties) MarshalJSON() ([]byte, error) { + asrp.Kind = KindAlertSimulatorRequestProperties + objectMap := make(map[string]interface{}) + if asrp.Kind != "" { + objectMap["kind"] = asrp.Kind + } + for k, v := range asrp.AdditionalProperties { + objectMap[k] = v + } + return json.Marshal(objectMap) +} + +// AsAlertSimulatorBundlesRequestProperties is the BasicAlertSimulatorRequestProperties implementation for AlertSimulatorRequestProperties. +func (asrp AlertSimulatorRequestProperties) AsAlertSimulatorBundlesRequestProperties() (*AlertSimulatorBundlesRequestProperties, bool) { + return nil, false +} + +// AsAlertSimulatorRequestProperties is the BasicAlertSimulatorRequestProperties implementation for AlertSimulatorRequestProperties. +func (asrp AlertSimulatorRequestProperties) AsAlertSimulatorRequestProperties() (*AlertSimulatorRequestProperties, bool) { + return &asrp, true +} + +// AsBasicAlertSimulatorRequestProperties is the BasicAlertSimulatorRequestProperties implementation for AlertSimulatorRequestProperties. +func (asrp AlertSimulatorRequestProperties) AsBasicAlertSimulatorRequestProperties() (BasicAlertSimulatorRequestProperties, bool) { + return &asrp, true +} + +// UnmarshalJSON is the custom unmarshaler for AlertSimulatorRequestProperties struct. +func (asrp *AlertSimulatorRequestProperties) 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 asrp.AdditionalProperties == nil { + asrp.AdditionalProperties = make(map[string]interface{}) + } + asrp.AdditionalProperties[k] = additionalProperties + } + case "kind": + if v != nil { + var kind KindEnum2 + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + asrp.Kind = kind + } + } + } + + return nil +} + +// AlertsSimulateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AlertsSimulateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AlertsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AlertsSimulateFuture) 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 AlertsSimulateFuture.Result. +func (future *AlertsSimulateFuture) result(client AlertsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AlertsSimulateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("security.AlertsSimulateFuture") + return + } + ar.Response = future.Response() + return +} + // AlertsSuppressionRule describes the suppression rule type AlertsSuppressionRule struct { autorest.Response `json:"-"` @@ -1998,6 +2280,7 @@ func (acrp AllowedConnectionsResourceProperties) MarshalJSON() ([]byte, error) { // allowed. type BasicAllowlistCustomAlertRule interface { AsConnectionToIPNotAllowed() (*ConnectionToIPNotAllowed, bool) + AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) AsProcessNotAllowed() (*ProcessNotAllowed, bool) AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) @@ -2016,7 +2299,7 @@ type AllowlistCustomAlertRule struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -2032,6 +2315,10 @@ func unmarshalBasicAllowlistCustomAlertRule(body []byte) (BasicAllowlistCustomAl var ctina ConnectionToIPNotAllowed err := json.Unmarshal(body, &ctina) return ctina, err + case string(RuleTypeConnectionFromIPNotAllowed): + var cfina ConnectionFromIPNotAllowed + err := json.Unmarshal(body, &cfina) + return cfina, err case string(RuleTypeLocalUserNotAllowed): var luna LocalUserNotAllowed err := json.Unmarshal(body, &luna) @@ -2131,6 +2418,11 @@ func (acar AllowlistCustomAlertRule) AsConnectionToIPNotAllowed() (*ConnectionTo return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for AllowlistCustomAlertRule. +func (acar AllowlistCustomAlertRule) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for AllowlistCustomAlertRule. func (acar AllowlistCustomAlertRule) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -2246,7 +2538,7 @@ type AmqpC2DMessagesNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -2322,6 +2614,11 @@ func (acmniar AmqpC2DMessagesNotInAllowedRange) AsConnectionToIPNotAllowed() (*C return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for AmqpC2DMessagesNotInAllowedRange. +func (acmniar AmqpC2DMessagesNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for AmqpC2DMessagesNotInAllowedRange. func (acmniar AmqpC2DMessagesNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -2437,7 +2734,7 @@ type AmqpC2DRejectedMessagesNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -2513,6 +2810,11 @@ func (acrmniar AmqpC2DRejectedMessagesNotInAllowedRange) AsConnectionToIPNotAllo return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for AmqpC2DRejectedMessagesNotInAllowedRange. +func (acrmniar AmqpC2DRejectedMessagesNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for AmqpC2DRejectedMessagesNotInAllowedRange. func (acrmniar AmqpC2DRejectedMessagesNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -2628,7 +2930,7 @@ type AmqpD2CMessagesNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -2704,6 +3006,11 @@ func (admniar AmqpD2CMessagesNotInAllowedRange) AsConnectionToIPNotAllowed() (*C return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for AmqpD2CMessagesNotInAllowedRange. +func (admniar AmqpD2CMessagesNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for AmqpD2CMessagesNotInAllowedRange. func (admniar AmqpD2CMessagesNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -3495,8 +3802,8 @@ type AssessmentMetadataProperties struct { // Description - Human readable description of the assessment Description *string `json:"description,omitempty"` // RemediationDescription - Human readable description of what you should do to mitigate this security issue - RemediationDescription *string `json:"remediationDescription,omitempty"` - Category *[]Category `json:"category,omitempty"` + RemediationDescription *string `json:"remediationDescription,omitempty"` + Categories *[]Categories `json:"categories,omitempty"` // Severity - The severity level of the assessment. Possible values include: 'SeverityLow', 'SeverityMedium', 'SeverityHigh' Severity Severity `json:"severity,omitempty"` // UserImpact - The user impact of the assessment. Possible values include: 'UserImpactLow', 'UserImpactModerate', 'UserImpactHigh' @@ -3523,8 +3830,8 @@ func (amp AssessmentMetadataProperties) MarshalJSON() ([]byte, error) { if amp.RemediationDescription != nil { objectMap["remediationDescription"] = amp.RemediationDescription } - if amp.Category != nil { - objectMap["category"] = amp.Category + if amp.Categories != nil { + objectMap["categories"] = amp.Categories } if amp.Severity != "" { objectMap["severity"] = amp.Severity @@ -4566,7 +4873,7 @@ type AutomationScope struct { // - security alerts and security assessments. To learn more about the supported security events data // models schemas - please visit https://aka.ms/ASCAutomationSchemas. type AutomationSource struct { - // EventSource - A valid event source type. Possible values include: 'Assessments', 'SubAssessments', 'Alerts', 'SecureScores', 'SecureScoreControls' + // EventSource - A valid event source type. Possible values include: 'EventSourceAssessments', 'EventSourceSubAssessments', 'EventSourceAlerts', 'EventSourceSecureScores', 'EventSourceSecureScoresSnapshot', 'EventSourceSecureScoreControls', 'EventSourceSecureScoreControlsSnapshot', 'EventSourceRegulatoryComplianceAssessment', 'EventSourceRegulatoryComplianceAssessmentSnapshot' EventSource EventSource `json:"eventSource,omitempty"` // RuleSets - A set of rules which evaluate upon event interception. A logical disjunction is applied between defined rule sets (logical 'or'). RuleSets *[]AutomationRuleSet `json:"ruleSets,omitempty"` @@ -5268,9 +5575,10 @@ func (csp *CefSolutionProperties) UnmarshalJSON(body []byte) error { return nil } -// CloudError error response structure. +// CloudError 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 CloudError struct { - // CloudErrorBody - Error data + // CloudErrorBody - The error object. *CloudErrorBody `json:"error,omitempty"` } @@ -5307,12 +5615,18 @@ func (ce *CloudError) UnmarshalJSON(body []byte) error { return nil } -// CloudErrorBody error details. +// CloudErrorBody the error detail. type CloudErrorBody struct { - // Code - READ-ONLY; An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + // Code - READ-ONLY; The error code. Code *string `json:"code,omitempty"` - // Message - READ-ONLY; A message describing the error, intended to be suitable for display in a user interface. + // 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 *[]CloudErrorBody `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` } // MarshalJSON is the custom marshaler for CloudErrorBody. @@ -5885,9 +6199,9 @@ type ConnectedWorkspace struct { ID *string `json:"id,omitempty"` } -// ConnectionToIPNotAllowed outbound connection to an ip that isn't allowed. Allow list consists of ipv4 or -// ipv6 range in CIDR notation. -type ConnectionToIPNotAllowed struct { +// ConnectionFromIPNotAllowed inbound connection from an ip that isn't allowed. Allow list consists of ipv4 +// or ipv6 range in CIDR notation. +type ConnectionFromIPNotAllowed struct { // AllowlistValues - The values to allow. The format of the values depends on the rule type. AllowlistValues *[]string `json:"allowlistValues,omitempty"` // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' @@ -5898,138 +6212,338 @@ type ConnectionToIPNotAllowed struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } -// MarshalJSON is the custom marshaler for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) MarshalJSON() ([]byte, error) { - ctina.RuleType = RuleTypeConnectionToIPNotAllowed +// MarshalJSON is the custom marshaler for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) MarshalJSON() ([]byte, error) { + cfina.RuleType = RuleTypeConnectionFromIPNotAllowed objectMap := make(map[string]interface{}) - if ctina.AllowlistValues != nil { - objectMap["allowlistValues"] = ctina.AllowlistValues + if cfina.AllowlistValues != nil { + objectMap["allowlistValues"] = cfina.AllowlistValues } - if ctina.IsEnabled != nil { - objectMap["isEnabled"] = ctina.IsEnabled + if cfina.IsEnabled != nil { + objectMap["isEnabled"] = cfina.IsEnabled } - if ctina.RuleType != "" { - objectMap["ruleType"] = ctina.RuleType + if cfina.RuleType != "" { + objectMap["ruleType"] = cfina.RuleType } return json.Marshal(objectMap) } -// AsThresholdCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsThresholdCustomAlertRule() (*ThresholdCustomAlertRule, bool) { +// AsThresholdCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsThresholdCustomAlertRule() (*ThresholdCustomAlertRule, bool) { return nil, false } -// AsBasicThresholdCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsBasicThresholdCustomAlertRule() (BasicThresholdCustomAlertRule, bool) { +// AsBasicThresholdCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsBasicThresholdCustomAlertRule() (BasicThresholdCustomAlertRule, bool) { return nil, false } -// AsTimeWindowCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsTimeWindowCustomAlertRule() (*TimeWindowCustomAlertRule, bool) { +// AsTimeWindowCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsTimeWindowCustomAlertRule() (*TimeWindowCustomAlertRule, bool) { return nil, false } -// AsBasicTimeWindowCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsBasicTimeWindowCustomAlertRule() (BasicTimeWindowCustomAlertRule, bool) { +// AsBasicTimeWindowCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsBasicTimeWindowCustomAlertRule() (BasicTimeWindowCustomAlertRule, bool) { return nil, false } -// AsAllowlistCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) { +// AsAllowlistCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) { return nil, false } -// AsBasicAllowlistCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsBasicAllowlistCustomAlertRule() (BasicAllowlistCustomAlertRule, bool) { - return &ctina, true +// AsBasicAllowlistCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsBasicAllowlistCustomAlertRule() (BasicAllowlistCustomAlertRule, bool) { + return &cfina, true } -// AsDenylistCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsDenylistCustomAlertRule() (*DenylistCustomAlertRule, bool) { +// AsDenylistCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsDenylistCustomAlertRule() (*DenylistCustomAlertRule, bool) { return nil, false } -// AsListCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsListCustomAlertRule() (*ListCustomAlertRule, bool) { +// AsListCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsListCustomAlertRule() (*ListCustomAlertRule, bool) { return nil, false } -// AsBasicListCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsBasicListCustomAlertRule() (BasicListCustomAlertRule, bool) { - return &ctina, true +// AsBasicListCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsBasicListCustomAlertRule() (BasicListCustomAlertRule, bool) { + return &cfina, true } -// AsConnectionToIPNotAllowed is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsConnectionToIPNotAllowed() (*ConnectionToIPNotAllowed, bool) { - return &ctina, true +// AsConnectionToIPNotAllowed is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsConnectionToIPNotAllowed() (*ConnectionToIPNotAllowed, bool) { + return nil, false } -// AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { - return nil, false +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return &cfina, true } -// AsProcessNotAllowed is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsProcessNotAllowed() (*ProcessNotAllowed, bool) { +// AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false } -// AsActiveConnectionsNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsActiveConnectionsNotInAllowedRange() (*ActiveConnectionsNotInAllowedRange, bool) { +// AsProcessNotAllowed is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsProcessNotAllowed() (*ProcessNotAllowed, bool) { return nil, false } -// AsAmqpC2DMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsAmqpC2DMessagesNotInAllowedRange() (*AmqpC2DMessagesNotInAllowedRange, bool) { +// AsActiveConnectionsNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsActiveConnectionsNotInAllowedRange() (*ActiveConnectionsNotInAllowedRange, bool) { return nil, false } -// AsMqttC2DMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsMqttC2DMessagesNotInAllowedRange() (*MqttC2DMessagesNotInAllowedRange, bool) { +// AsAmqpC2DMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsAmqpC2DMessagesNotInAllowedRange() (*AmqpC2DMessagesNotInAllowedRange, bool) { return nil, false } -// AsHTTPC2DMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsHTTPC2DMessagesNotInAllowedRange() (*HTTPC2DMessagesNotInAllowedRange, bool) { +// AsMqttC2DMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsMqttC2DMessagesNotInAllowedRange() (*MqttC2DMessagesNotInAllowedRange, bool) { return nil, false } -// AsAmqpC2DRejectedMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsAmqpC2DRejectedMessagesNotInAllowedRange() (*AmqpC2DRejectedMessagesNotInAllowedRange, bool) { +// AsHTTPC2DMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsHTTPC2DMessagesNotInAllowedRange() (*HTTPC2DMessagesNotInAllowedRange, bool) { return nil, false } -// AsMqttC2DRejectedMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsMqttC2DRejectedMessagesNotInAllowedRange() (*MqttC2DRejectedMessagesNotInAllowedRange, bool) { +// AsAmqpC2DRejectedMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsAmqpC2DRejectedMessagesNotInAllowedRange() (*AmqpC2DRejectedMessagesNotInAllowedRange, bool) { return nil, false } -// AsHTTPC2DRejectedMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsHTTPC2DRejectedMessagesNotInAllowedRange() (*HTTPC2DRejectedMessagesNotInAllowedRange, bool) { +// AsMqttC2DRejectedMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsMqttC2DRejectedMessagesNotInAllowedRange() (*MqttC2DRejectedMessagesNotInAllowedRange, bool) { return nil, false } -// AsAmqpD2CMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsAmqpD2CMessagesNotInAllowedRange() (*AmqpD2CMessagesNotInAllowedRange, bool) { +// AsHTTPC2DRejectedMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsHTTPC2DRejectedMessagesNotInAllowedRange() (*HTTPC2DRejectedMessagesNotInAllowedRange, bool) { return nil, false } -// AsMqttD2CMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsMqttD2CMessagesNotInAllowedRange() (*MqttD2CMessagesNotInAllowedRange, bool) { +// AsAmqpD2CMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsAmqpD2CMessagesNotInAllowedRange() (*AmqpD2CMessagesNotInAllowedRange, bool) { return nil, false } -// AsHTTPD2CMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsHTTPD2CMessagesNotInAllowedRange() (*HTTPD2CMessagesNotInAllowedRange, bool) { +// AsMqttD2CMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsMqttD2CMessagesNotInAllowedRange() (*MqttD2CMessagesNotInAllowedRange, bool) { return nil, false } -// AsDirectMethodInvokesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. -func (ctina ConnectionToIPNotAllowed) AsDirectMethodInvokesNotInAllowedRange() (*DirectMethodInvokesNotInAllowedRange, bool) { +// AsHTTPD2CMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsHTTPD2CMessagesNotInAllowedRange() (*HTTPD2CMessagesNotInAllowedRange, bool) { + return nil, false +} + +// AsDirectMethodInvokesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsDirectMethodInvokesNotInAllowedRange() (*DirectMethodInvokesNotInAllowedRange, bool) { + return nil, false +} + +// AsFailedLocalLoginsNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsFailedLocalLoginsNotInAllowedRange() (*FailedLocalLoginsNotInAllowedRange, bool) { + return nil, false +} + +// AsFileUploadsNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsFileUploadsNotInAllowedRange() (*FileUploadsNotInAllowedRange, bool) { + return nil, false +} + +// AsQueuePurgesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsQueuePurgesNotInAllowedRange() (*QueuePurgesNotInAllowedRange, bool) { + return nil, false +} + +// AsTwinUpdatesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsTwinUpdatesNotInAllowedRange() (*TwinUpdatesNotInAllowedRange, bool) { + return nil, false +} + +// AsUnauthorizedOperationsNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsUnauthorizedOperationsNotInAllowedRange() (*UnauthorizedOperationsNotInAllowedRange, bool) { + return nil, false +} + +// AsCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsCustomAlertRule() (*CustomAlertRule, bool) { + return nil, false +} + +// AsBasicCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionFromIPNotAllowed. +func (cfina ConnectionFromIPNotAllowed) AsBasicCustomAlertRule() (BasicCustomAlertRule, bool) { + return &cfina, true +} + +// ConnectionStrings connection string for ingesting security data and logs +type ConnectionStrings struct { + autorest.Response `json:"-"` + // Value - Connection strings + Value *[]IngestionConnectionString `json:"value,omitempty"` +} + +// ConnectionToIPNotAllowed outbound connection to an ip that isn't allowed. Allow list consists of ipv4 or +// ipv6 range in CIDR notation. +type ConnectionToIPNotAllowed struct { + // AllowlistValues - The values to allow. The format of the values depends on the rule type. + AllowlistValues *[]string `json:"allowlistValues,omitempty"` + // ValueType - READ-ONLY; The value type of the items in the list. Possible values include: 'ValueTypeIPCidr', 'ValueTypeString' + ValueType ValueType `json:"valueType,omitempty"` + // DisplayName - READ-ONLY; The display name of the custom alert. + DisplayName *string `json:"displayName,omitempty"` + // Description - READ-ONLY; The description of the custom alert. + Description *string `json:"description,omitempty"` + // IsEnabled - Status of the custom alert. + IsEnabled *bool `json:"isEnabled,omitempty"` + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) MarshalJSON() ([]byte, error) { + ctina.RuleType = RuleTypeConnectionToIPNotAllowed + objectMap := make(map[string]interface{}) + if ctina.AllowlistValues != nil { + objectMap["allowlistValues"] = ctina.AllowlistValues + } + if ctina.IsEnabled != nil { + objectMap["isEnabled"] = ctina.IsEnabled + } + if ctina.RuleType != "" { + objectMap["ruleType"] = ctina.RuleType + } + return json.Marshal(objectMap) +} + +// AsThresholdCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsThresholdCustomAlertRule() (*ThresholdCustomAlertRule, bool) { + return nil, false +} + +// AsBasicThresholdCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsBasicThresholdCustomAlertRule() (BasicThresholdCustomAlertRule, bool) { + return nil, false +} + +// AsTimeWindowCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsTimeWindowCustomAlertRule() (*TimeWindowCustomAlertRule, bool) { + return nil, false +} + +// AsBasicTimeWindowCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsBasicTimeWindowCustomAlertRule() (BasicTimeWindowCustomAlertRule, bool) { + return nil, false +} + +// AsAllowlistCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsAllowlistCustomAlertRule() (*AllowlistCustomAlertRule, bool) { + return nil, false +} + +// AsBasicAllowlistCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsBasicAllowlistCustomAlertRule() (BasicAllowlistCustomAlertRule, bool) { + return &ctina, true +} + +// AsDenylistCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsDenylistCustomAlertRule() (*DenylistCustomAlertRule, bool) { + return nil, false +} + +// AsListCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsListCustomAlertRule() (*ListCustomAlertRule, bool) { + return nil, false +} + +// AsBasicListCustomAlertRule is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsBasicListCustomAlertRule() (BasicListCustomAlertRule, bool) { + return &ctina, true +} + +// AsConnectionToIPNotAllowed is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsConnectionToIPNotAllowed() (*ConnectionToIPNotAllowed, bool) { + return &ctina, true +} + +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + +// AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { + return nil, false +} + +// AsProcessNotAllowed is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsProcessNotAllowed() (*ProcessNotAllowed, bool) { + return nil, false +} + +// AsActiveConnectionsNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsActiveConnectionsNotInAllowedRange() (*ActiveConnectionsNotInAllowedRange, bool) { + return nil, false +} + +// AsAmqpC2DMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsAmqpC2DMessagesNotInAllowedRange() (*AmqpC2DMessagesNotInAllowedRange, bool) { + return nil, false +} + +// AsMqttC2DMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsMqttC2DMessagesNotInAllowedRange() (*MqttC2DMessagesNotInAllowedRange, bool) { + return nil, false +} + +// AsHTTPC2DMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsHTTPC2DMessagesNotInAllowedRange() (*HTTPC2DMessagesNotInAllowedRange, bool) { + return nil, false +} + +// AsAmqpC2DRejectedMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsAmqpC2DRejectedMessagesNotInAllowedRange() (*AmqpC2DRejectedMessagesNotInAllowedRange, bool) { + return nil, false +} + +// AsMqttC2DRejectedMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsMqttC2DRejectedMessagesNotInAllowedRange() (*MqttC2DRejectedMessagesNotInAllowedRange, bool) { + return nil, false +} + +// AsHTTPC2DRejectedMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsHTTPC2DRejectedMessagesNotInAllowedRange() (*HTTPC2DRejectedMessagesNotInAllowedRange, bool) { + return nil, false +} + +// AsAmqpD2CMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsAmqpD2CMessagesNotInAllowedRange() (*AmqpD2CMessagesNotInAllowedRange, bool) { + return nil, false +} + +// AsMqttD2CMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsMqttD2CMessagesNotInAllowedRange() (*MqttD2CMessagesNotInAllowedRange, bool) { + return nil, false +} + +// AsHTTPD2CMessagesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsHTTPD2CMessagesNotInAllowedRange() (*HTTPD2CMessagesNotInAllowedRange, bool) { + return nil, false +} + +// AsDirectMethodInvokesNotInAllowedRange is the BasicCustomAlertRule implementation for ConnectionToIPNotAllowed. +func (ctina ConnectionToIPNotAllowed) AsDirectMethodInvokesNotInAllowedRange() (*DirectMethodInvokesNotInAllowedRange, bool) { return nil, false } @@ -6669,6 +7183,7 @@ type BasicCustomAlertRule interface { AsListCustomAlertRule() (*ListCustomAlertRule, bool) AsBasicListCustomAlertRule() (BasicListCustomAlertRule, bool) AsConnectionToIPNotAllowed() (*ConnectionToIPNotAllowed, bool) + AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) AsProcessNotAllowed() (*ProcessNotAllowed, bool) AsActiveConnectionsNotInAllowedRange() (*ActiveConnectionsNotInAllowedRange, bool) @@ -6698,7 +7213,7 @@ type CustomAlertRule struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -6734,6 +7249,10 @@ func unmarshalBasicCustomAlertRule(body []byte) (BasicCustomAlertRule, error) { var ctina ConnectionToIPNotAllowed err := json.Unmarshal(body, &ctina) return ctina, err + case string(RuleTypeConnectionFromIPNotAllowed): + var cfina ConnectionFromIPNotAllowed + err := json.Unmarshal(body, &cfina) + return cfina, err case string(RuleTypeLocalUserNotAllowed): var luna LocalUserNotAllowed err := json.Unmarshal(body, &luna) @@ -6894,6 +7413,11 @@ func (car CustomAlertRule) AsConnectionToIPNotAllowed() (*ConnectionToIPNotAllow return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for CustomAlertRule. +func (car CustomAlertRule) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for CustomAlertRule. func (car CustomAlertRule) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -7141,7 +7665,7 @@ type DenylistCustomAlertRule struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -7211,6 +7735,11 @@ func (dcar DenylistCustomAlertRule) AsConnectionToIPNotAllowed() (*ConnectionToI return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for DenylistCustomAlertRule. +func (dcar DenylistCustomAlertRule) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for DenylistCustomAlertRule. func (dcar DenylistCustomAlertRule) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -7946,7 +8475,7 @@ type DirectMethodInvokesNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -8022,6 +8551,11 @@ func (dminiar DirectMethodInvokesNotInAllowedRange) AsConnectionToIPNotAllowed() return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for DirectMethodInvokesNotInAllowedRange. +func (dminiar DirectMethodInvokesNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for DirectMethodInvokesNotInAllowedRange. func (dminiar DirectMethodInvokesNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -8393,6 +8927,20 @@ type EffectiveNetworkSecurityGroups struct { NetworkSecurityGroups *[]string `json:"networkSecurityGroups,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) +} + // ETag entity tag is used for comparing two or more entities from the same requested resource. type ETag struct { // Etag - Entity tag is used for comparing two or more entities from the same requested resource. @@ -8822,7 +9370,7 @@ type FailedLocalLoginsNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -8898,6 +9446,11 @@ func (fllniar FailedLocalLoginsNotInAllowedRange) AsConnectionToIPNotAllowed() ( return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for FailedLocalLoginsNotInAllowedRange. +func (fllniar FailedLocalLoginsNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for FailedLocalLoginsNotInAllowedRange. func (fllniar FailedLocalLoginsNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -9012,7 +9565,7 @@ type FileUploadsNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -9088,6 +9641,11 @@ func (funiar FileUploadsNotInAllowedRange) AsConnectionToIPNotAllowed() (*Connec return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for FileUploadsNotInAllowedRange. +func (funiar FileUploadsNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for FileUploadsNotInAllowedRange. func (funiar FileUploadsNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -9328,7 +9886,7 @@ type HTTPC2DMessagesNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -9404,6 +9962,11 @@ func (hcmniar HTTPC2DMessagesNotInAllowedRange) AsConnectionToIPNotAllowed() (*C return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for HTTPC2DMessagesNotInAllowedRange. +func (hcmniar HTTPC2DMessagesNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for HTTPC2DMessagesNotInAllowedRange. func (hcmniar HTTPC2DMessagesNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -9519,7 +10082,7 @@ type HTTPC2DRejectedMessagesNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -9595,6 +10158,11 @@ func (hcrmniar HTTPC2DRejectedMessagesNotInAllowedRange) AsConnectionToIPNotAllo return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for HTTPC2DRejectedMessagesNotInAllowedRange. +func (hcrmniar HTTPC2DRejectedMessagesNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for HTTPC2DRejectedMessagesNotInAllowedRange. func (hcrmniar HTTPC2DRejectedMessagesNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -9710,7 +10278,7 @@ type HTTPD2CMessagesNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -9786,6 +10354,11 @@ func (hdmniar HTTPD2CMessagesNotInAllowedRange) AsConnectionToIPNotAllowed() (*C return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for HTTPD2CMessagesNotInAllowedRange. +func (hdmniar HTTPD2CMessagesNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for HTTPD2CMessagesNotInAllowedRange. func (hdmniar HTTPD2CMessagesNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -10219,74 +10792,69 @@ type InformationType struct { Keywords *[]InformationProtectionKeyword `json:"keywords,omitempty"` } -// IotAlert ioT alert -type IotAlert struct { - autorest.Response `json:"-"` - // IotAlertProperties - Alert properties - *IotAlertProperties `json:"properties,omitempty"` +// IngestionConnectionString connection string for ingesting security data and logs +type IngestionConnectionString struct { + // Location - READ-ONLY; The region where ingested logs and data resides + Location *string `json:"location,omitempty"` + // Value - READ-ONLY; Connection string value + Value *string `json:"value,omitempty"` } -// MarshalJSON is the custom marshaler for IotAlert. -func (ia IotAlert) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for IngestionConnectionString. +func (ics IngestionConnectionString) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if ia.IotAlertProperties != nil { - objectMap["properties"] = ia.IotAlertProperties - } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for IotAlert struct. -func (ia *IotAlert) 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 iotAlertProperties IotAlertProperties - err = json.Unmarshal(*v, &iotAlertProperties) - if err != nil { - return err - } - ia.IotAlertProperties = &iotAlertProperties - } - } - } +// IngestionSetting configures how to correlate scan data and logs with resources associated with the +// subscription. +type IngestionSetting struct { + autorest.Response `json:"-"` + // Properties - Ingestion setting data + Properties interface{} `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} - return nil +// MarshalJSON is the custom marshaler for IngestionSetting. +func (is IngestionSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if is.Properties != nil { + objectMap["properties"] = is.Properties + } + return json.Marshal(objectMap) } -// IotAlertList list of IoT alerts -type IotAlertList struct { +// IngestionSettingList list of ingestion settings +type IngestionSettingList struct { autorest.Response `json:"-"` - // Value - READ-ONLY; List data - Value *[]IotAlert `json:"value,omitempty"` - // NextLink - READ-ONLY; When available, follow the URI to get the next page of data + // Value - READ-ONLY; List of ingestion settings + Value *[]IngestionSetting `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. NextLink *string `json:"nextLink,omitempty"` - // TotalCount - READ-ONLY; Total count of alerts that conforms with the given filter options (not affected by page size) - TotalCount *int32 `json:"totalCount,omitempty"` } -// MarshalJSON is the custom marshaler for IotAlertList. -func (ial IotAlertList) MarshalJSON() ([]byte, error) { +// MarshalJSON is the custom marshaler for IngestionSettingList. +func (isl IngestionSettingList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } -// IotAlertListIterator provides access to a complete listing of IotAlert values. -type IotAlertListIterator struct { +// IngestionSettingListIterator provides access to a complete listing of IngestionSetting values. +type IngestionSettingListIterator struct { i int - page IotAlertListPage + page IngestionSettingListPage } // 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 *IotAlertListIterator) NextWithContext(ctx context.Context) (err error) { +func (iter *IngestionSettingListIterator) NextWithContext(ctx context.Context) (err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotAlertListIterator.NextWithContext") + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingListIterator.NextWithContext") defer func() { sc := -1 if iter.Response().Response.Response != nil { @@ -10311,51 +10879,152 @@ func (iter *IotAlertListIterator) NextWithContext(ctx context.Context) (err erro // 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 *IotAlertListIterator) Next() error { +func (iter *IngestionSettingListIterator) Next() error { return iter.NextWithContext(context.Background()) } // NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IotAlertListIterator) NotDone() bool { +func (iter IngestionSettingListIterator) 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 IotAlertListIterator) Response() IotAlertList { +func (iter IngestionSettingListIterator) Response() IngestionSettingList { 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 IotAlertListIterator) Value() IotAlert { +func (iter IngestionSettingListIterator) Value() IngestionSetting { if !iter.page.NotDone() { - return IotAlert{} + return IngestionSetting{} } return iter.page.Values()[iter.i] } -// Creates a new instance of the IotAlertListIterator type. -func NewIotAlertListIterator(page IotAlertListPage) IotAlertListIterator { - return IotAlertListIterator{page: page} +// Creates a new instance of the IngestionSettingListIterator type. +func NewIngestionSettingListIterator(page IngestionSettingListPage) IngestionSettingListIterator { + return IngestionSettingListIterator{page: page} } -// IotAlertListModel list of IoT alerts -type IotAlertListModel struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List data - Value *[]IotAlertModel `json:"value,omitempty"` - // NextLink - READ-ONLY; When available, follow the URI to get the next page of data - NextLink *string `json:"nextLink,omitempty"` +// IsEmpty returns true if the ListResult contains no values. +func (isl IngestionSettingList) IsEmpty() bool { + return isl.Value == nil || len(*isl.Value) == 0 } -// MarshalJSON is the custom marshaler for IotAlertListModel. -func (ialm IotAlertListModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) +// hasNextLink returns true if the NextLink is not empty. +func (isl IngestionSettingList) hasNextLink() bool { + return isl.NextLink != nil && len(*isl.NextLink) != 0 } -// IotAlertListModelIterator provides access to a complete listing of IotAlertModel values. -type IotAlertListModelIterator struct { +// ingestionSettingListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (isl IngestionSettingList) ingestionSettingListPreparer(ctx context.Context) (*http.Request, error) { + if !isl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(isl.NextLink))) +} + +// IngestionSettingListPage contains a page of IngestionSetting values. +type IngestionSettingListPage struct { + fn func(context.Context, IngestionSettingList) (IngestionSettingList, error) + isl IngestionSettingList +} + +// 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 *IngestionSettingListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IngestionSettingListPage.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.isl) + if err != nil { + return err + } + page.isl = 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 *IngestionSettingListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IngestionSettingListPage) NotDone() bool { + return !page.isl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IngestionSettingListPage) Response() IngestionSettingList { + return page.isl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IngestionSettingListPage) Values() []IngestionSetting { + if page.isl.IsEmpty() { + return nil + } + return *page.isl.Value +} + +// Creates a new instance of the IngestionSettingListPage type. +func NewIngestionSettingListPage(cur IngestionSettingList, getNextPage func(context.Context, IngestionSettingList) (IngestionSettingList, error)) IngestionSettingListPage { + return IngestionSettingListPage{ + fn: getNextPage, + isl: cur, + } +} + +// IngestionSettingToken configures how to correlate scan data and logs with resources associated with the +// subscription. +type IngestionSettingToken struct { + autorest.Response `json:"-"` + // Token - READ-ONLY; The token is used for correlating security data and logs with the resources in the subscription. + Token *string `json:"token,omitempty"` +} + +// MarshalJSON is the custom marshaler for IngestionSettingToken. +func (ist IngestionSettingToken) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IotAlertListModel list of IoT alerts +type IotAlertListModel struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List data + Value *[]IotAlertModel `json:"value,omitempty"` + // NextLink - READ-ONLY; When available, follow the URI to get the next page of data + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for IotAlertListModel. +func (ialm IotAlertListModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// IotAlertListModelIterator provides access to a complete listing of IotAlertModel values. +type IotAlertListModelIterator struct { i int page IotAlertListModelPage } @@ -10504,98 +11173,17 @@ func NewIotAlertListModelPage(cur IotAlertListModel, getNextPage func(context.Co } } -// IsEmpty returns true if the ListResult contains no values. -func (ial IotAlertList) IsEmpty() bool { - return ial.Value == nil || len(*ial.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (ial IotAlertList) hasNextLink() bool { - return ial.NextLink != nil && len(*ial.NextLink) != 0 -} - -// iotAlertListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (ial IotAlertList) iotAlertListPreparer(ctx context.Context) (*http.Request, error) { - if !ial.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(ial.NextLink))) -} - -// IotAlertListPage contains a page of IotAlert values. -type IotAlertListPage struct { - fn func(context.Context, IotAlertList) (IotAlertList, error) - ial IotAlertList -} - -// 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 *IotAlertListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotAlertListPage.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.ial) - if err != nil { - return err - } - page.ial = 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 *IotAlertListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IotAlertListPage) NotDone() bool { - return !page.ial.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IotAlertListPage) Response() IotAlertList { - return page.ial -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IotAlertListPage) Values() []IotAlert { - if page.ial.IsEmpty() { - return nil - } - return *page.ial.Value -} - -// Creates a new instance of the IotAlertListPage type. -func NewIotAlertListPage(cur IotAlertList, getNextPage func(context.Context, IotAlertList) (IotAlertList, error)) IotAlertListPage { - return IotAlertListPage{ - fn: getNextPage, - ial: cur, - } -} - // IotAlertModel ioT alert type IotAlertModel struct { autorest.Response `json:"-"` // IotAlertPropertiesModel - Alert properties *IotAlertPropertiesModel `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` } // MarshalJSON is the custom marshaler for IotAlertModel. @@ -10625,42 +11213,39 @@ func (iam *IotAlertModel) UnmarshalJSON(body []byte) error { } iam.IotAlertPropertiesModel = &iotAlertPropertiesModel } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + iam.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + iam.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + iam.Type = &typeVar + } } } return nil } -// IotAlertProperties ioT alert properties -type IotAlertProperties struct { - // SystemAlertID - READ-ONLY; Holds the product canonical identifier of the alert within the scope of a product - SystemAlertID *string `json:"systemAlertId,omitempty"` - // CompromisedEntity - READ-ONLY; Display name of the main entity being reported on - CompromisedEntity *string `json:"compromisedEntity,omitempty"` - // AlertType - READ-ONLY; The type name of the alert - AlertType *string `json:"alertType,omitempty"` - // StartTimeUtc - READ-ONLY; The impact start time of the alert (the time of the first event or activity included in the alert) - StartTimeUtc *string `json:"startTimeUtc,omitempty"` - // EndTimeUtc - READ-ONLY; The impact end time of the alert (the time of the last event or activity included in the alert) - EndTimeUtc *string `json:"endTimeUtc,omitempty"` - // Entities - A list of entities related to the alert - Entities *[]interface{} `json:"entities,omitempty"` - // ExtendedProperties - A bag of fields which extends the alert information - ExtendedProperties interface{} `json:"extendedProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for IotAlertProperties. -func (iap IotAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if iap.Entities != nil { - objectMap["entities"] = iap.Entities - } - if iap.ExtendedProperties != nil { - objectMap["extendedProperties"] = iap.ExtendedProperties - } - return json.Marshal(objectMap) -} - // IotAlertPropertiesModel ioT alert properties type IotAlertPropertiesModel struct { // SystemAlertID - READ-ONLY; Holds the product canonical identifier of the alert within the scope of a product @@ -10891,159 +11476,8 @@ type IotDefenderSettingsProperties struct { DeviceQuota *int32 `json:"deviceQuota,omitempty"` // SentinelWorkspaceResourceIds - Sentinel Workspace Resource Ids SentinelWorkspaceResourceIds *[]string `json:"sentinelWorkspaceResourceIds,omitempty"` -} - -// IotRecommendation ioT recommendation -type IotRecommendation struct { - autorest.Response `json:"-"` - // IotRecommendationProperties - Recommendation properties - *IotRecommendationProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for IotRecommendation. -func (ir IotRecommendation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ir.IotRecommendationProperties != nil { - objectMap["properties"] = ir.IotRecommendationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for IotRecommendation struct. -func (ir *IotRecommendation) 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 iotRecommendationProperties IotRecommendationProperties - err = json.Unmarshal(*v, &iotRecommendationProperties) - if err != nil { - return err - } - ir.IotRecommendationProperties = &iotRecommendationProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ir.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ir.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ir.Type = &typeVar - } - } - } - - return nil -} - -// IotRecommendationList list of IoT recommendations -type IotRecommendationList struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; List data - Value *[]IotRecommendation `json:"value,omitempty"` - // NextLink - READ-ONLY; When available, follow the URI to get the next page of data - NextLink *string `json:"nextLink,omitempty"` - // TotalCount - READ-ONLY; Total count of recommendations that conforms with the given filter options (not affected by page size) - TotalCount *int32 `json:"totalCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for IotRecommendationList. -func (irl IotRecommendationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// IotRecommendationListIterator provides access to a complete listing of IotRecommendation values. -type IotRecommendationListIterator struct { - i int - page IotRecommendationListPage -} - -// 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 *IotRecommendationListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotRecommendationListIterator.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 *IotRecommendationListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter IotRecommendationListIterator) 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 IotRecommendationListIterator) Response() IotRecommendationList { - 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 IotRecommendationListIterator) Value() IotRecommendation { - if !iter.page.NotDone() { - return IotRecommendation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the IotRecommendationListIterator type. -func NewIotRecommendationListIterator(page IotRecommendationListPage) IotRecommendationListIterator { - return IotRecommendationListIterator{page: page} + // OnboardingKind - The kind of onboarding for the subscription. Possible values include: 'Default', 'MigratedToAzure' + OnboardingKind OnboardingKind `json:"onboardingKind,omitempty"` } // IotRecommendationListModel list of IoT recommendations @@ -11212,93 +11646,6 @@ func NewIotRecommendationListModelPage(cur IotRecommendationListModel, getNextPa } } -// IsEmpty returns true if the ListResult contains no values. -func (irl IotRecommendationList) IsEmpty() bool { - return irl.Value == nil || len(*irl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (irl IotRecommendationList) hasNextLink() bool { - return irl.NextLink != nil && len(*irl.NextLink) != 0 -} - -// iotRecommendationListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (irl IotRecommendationList) iotRecommendationListPreparer(ctx context.Context) (*http.Request, error) { - if !irl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(irl.NextLink))) -} - -// IotRecommendationListPage contains a page of IotRecommendation values. -type IotRecommendationListPage struct { - fn func(context.Context, IotRecommendationList) (IotRecommendationList, error) - irl IotRecommendationList -} - -// 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 *IotRecommendationListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/IotRecommendationListPage.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.irl) - if err != nil { - return err - } - page.irl = 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 *IotRecommendationListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page IotRecommendationListPage) NotDone() bool { - return !page.irl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page IotRecommendationListPage) Response() IotRecommendationList { - return page.irl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page IotRecommendationListPage) Values() []IotRecommendation { - if page.irl.IsEmpty() { - return nil - } - return *page.irl.Value -} - -// Creates a new instance of the IotRecommendationListPage type. -func NewIotRecommendationListPage(cur IotRecommendationList, getNextPage func(context.Context, IotRecommendationList) (IotRecommendationList, error)) IotRecommendationListPage { - return IotRecommendationListPage{ - fn: getNextPage, - irl: cur, - } -} - // IotRecommendationModel ioT recommendation type IotRecommendationModel struct { autorest.Response `json:"-"` @@ -11372,27 +11719,6 @@ func (irm *IotRecommendationModel) UnmarshalJSON(body []byte) error { return nil } -// IotRecommendationProperties ioT recommendation properties -type IotRecommendationProperties struct { - // DeviceID - READ-ONLY; Identifier of the device being reported on - DeviceID *string `json:"deviceId,omitempty"` - // RecommendationType - READ-ONLY; The type name of the recommendation - RecommendationType *string `json:"recommendationType,omitempty"` - // DiscoveredTimeUtc - READ-ONLY; The discovery time of the recommendation - DiscoveredTimeUtc *string `json:"discoveredTimeUtc,omitempty"` - // RecommendationAdditionalData - A bag of fields which extends the recommendation information - RecommendationAdditionalData interface{} `json:"recommendationAdditionalData,omitempty"` -} - -// MarshalJSON is the custom marshaler for IotRecommendationProperties. -func (irp IotRecommendationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if irp.RecommendationAdditionalData != nil { - objectMap["recommendationAdditionalData"] = irp.RecommendationAdditionalData - } - return json.Marshal(objectMap) -} - // IotRecommendationPropertiesModel ioT recommendation properties type IotRecommendationPropertiesModel struct { // DeviceID - READ-ONLY; Identifier of the device being reported on @@ -11795,7 +12121,7 @@ type IoTSecurityAggregatedAlertProperties struct { // Description - READ-ONLY; Description of the suspected vulnerability and meaning. Description *string `json:"description,omitempty"` // Count - READ-ONLY; Number of alerts occurrences within the aggregated time window. - Count *int32 `json:"count,omitempty"` + Count *int64 `json:"count,omitempty"` // EffectedResourceType - READ-ONLY; Azure resource ID of the resource that received the alerts. EffectedResourceType *string `json:"effectedResourceType,omitempty"` // SystemSource - READ-ONLY; The type of the alerted resource (Azure, Non-Azure). @@ -11819,7 +12145,7 @@ type IoTSecurityAggregatedAlertPropertiesTopDevicesListItem struct { // DeviceID - READ-ONLY; Name of the device. DeviceID *string `json:"deviceId,omitempty"` // AlertsCount - READ-ONLY; Number of alerts raised for this device. - AlertsCount *int32 `json:"alertsCount,omitempty"` + AlertsCount *int64 `json:"alertsCount,omitempty"` // LastOccurrence - READ-ONLY; Most recent time this alert was raised for this device, on this day. LastOccurrence *string `json:"lastOccurrence,omitempty"` } @@ -12105,9 +12431,9 @@ type IoTSecurityAggregatedRecommendationProperties struct { // ReportedSeverity - READ-ONLY; Assessed recommendation severity. Possible values include: 'ReportedSeverityInformational', 'ReportedSeverityLow', 'ReportedSeverityMedium', 'ReportedSeverityHigh' ReportedSeverity ReportedSeverity `json:"reportedSeverity,omitempty"` // HealthyDevices - READ-ONLY; Number of healthy devices within the IoT Security solution. - HealthyDevices *int32 `json:"healthyDevices,omitempty"` + HealthyDevices *int64 `json:"healthyDevices,omitempty"` // UnhealthyDeviceCount - READ-ONLY; Number of unhealthy devices within the IoT Security solution. - UnhealthyDeviceCount *int32 `json:"unhealthyDeviceCount,omitempty"` + UnhealthyDeviceCount *int64 `json:"unhealthyDeviceCount,omitempty"` // LogAnalyticsQuery - READ-ONLY; Log analytics query for getting the list of affected devices/alerts. LogAnalyticsQuery *string `json:"logAnalyticsQuery,omitempty"` } @@ -12127,7 +12453,7 @@ type IoTSecurityAlertedDevice struct { // DeviceID - READ-ONLY; Device identifier. DeviceID *string `json:"deviceId,omitempty"` // AlertsCount - READ-ONLY; Number of alerts raised for this device. - AlertsCount *int32 `json:"alertsCount,omitempty"` + AlertsCount *int64 `json:"alertsCount,omitempty"` } // MarshalJSON is the custom marshaler for IoTSecurityAlertedDevice. @@ -12144,7 +12470,7 @@ type IoTSecurityDeviceAlert struct { // ReportedSeverity - READ-ONLY; Assessed Alert severity. Possible values include: 'ReportedSeverityInformational', 'ReportedSeverityLow', 'ReportedSeverityMedium', 'ReportedSeverityHigh' ReportedSeverity ReportedSeverity `json:"reportedSeverity,omitempty"` // AlertsCount - READ-ONLY; Number of alerts raised for this alert type. - AlertsCount *int32 `json:"alertsCount,omitempty"` + AlertsCount *int64 `json:"alertsCount,omitempty"` } // MarshalJSON is the custom marshaler for IoTSecurityDeviceAlert. @@ -12161,7 +12487,7 @@ type IoTSecurityDeviceRecommendation struct { // ReportedSeverity - READ-ONLY; Assessed recommendation severity. Possible values include: 'ReportedSeverityInformational', 'ReportedSeverityLow', 'ReportedSeverityMedium', 'ReportedSeverityHigh' ReportedSeverity ReportedSeverity `json:"reportedSeverity,omitempty"` // DevicesCount - READ-ONLY; Number of devices with this recommendation. - DevicesCount *int32 `json:"devicesCount,omitempty"` + DevicesCount *int64 `json:"devicesCount,omitempty"` } // MarshalJSON is the custom marshaler for IoTSecurityDeviceRecommendation. @@ -12266,7 +12592,7 @@ type IoTSecuritySolutionAnalyticsModelProperties struct { // Metrics - READ-ONLY; Security analytics of your IoT Security solution. Metrics *IoTSeverityMetrics `json:"metrics,omitempty"` // UnhealthyDeviceCount - READ-ONLY; Number of unhealthy devices within your IoT Security solution. - UnhealthyDeviceCount *int32 `json:"unhealthyDeviceCount,omitempty"` + UnhealthyDeviceCount *int64 `json:"unhealthyDeviceCount,omitempty"` // DevicesMetrics - READ-ONLY; List of device metrics by the aggregation date. DevicesMetrics *[]IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem `json:"devicesMetrics,omitempty"` // TopAlertedDevices - List of the 3 devices with the most alerts. @@ -12315,6 +12641,8 @@ type IoTSecuritySolutionModel struct { Location *string `json:"location,omitempty"` // IoTSecuritySolutionProperties - Security Solution data *IoTSecuritySolutionProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` } // MarshalJSON is the custom marshaler for IoTSecuritySolutionModel. @@ -12395,6 +12723,15 @@ func (itssm *IoTSecuritySolutionModel) UnmarshalJSON(body []byte) error { } itssm.IoTSecuritySolutionProperties = &ioTSecuritySolutionProperties } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + itssm.SystemData = &systemData + } } } @@ -12421,6 +12758,8 @@ type IoTSecuritySolutionProperties struct { RecommendationsConfiguration *[]RecommendationConfigurationProperties `json:"recommendationsConfiguration,omitempty"` // UnmaskedIPLoggingStatus - Unmasked IP address logging status. Possible values include: 'UnmaskedIPLoggingStatusDisabled', 'UnmaskedIPLoggingStatusEnabled' UnmaskedIPLoggingStatus UnmaskedIPLoggingStatus `json:"unmaskedIpLoggingStatus,omitempty"` + // AdditionalWorkspaces - List of additional workspaces + AdditionalWorkspaces *[]AdditionalWorkspacesProperties `json:"additionalWorkspaces,omitempty"` } // MarshalJSON is the custom marshaler for IoTSecuritySolutionProperties. @@ -12453,6 +12792,9 @@ func (itssp IoTSecuritySolutionProperties) MarshalJSON() ([]byte, error) { if itssp.UnmaskedIPLoggingStatus != "" { objectMap["unmaskedIpLoggingStatus"] = itssp.UnmaskedIPLoggingStatus } + if itssp.AdditionalWorkspaces != nil { + objectMap["additionalWorkspaces"] = itssp.AdditionalWorkspaces + } return json.Marshal(objectMap) } @@ -12647,6 +12989,8 @@ type IotSensorProperties struct { TiVersion *string `json:"tiVersion,omitempty"` // Zone - Zone of the IoT sensor Zone *string `json:"zone,omitempty"` + // SensorType - Type of sensor. Possible values include: 'SensorTypeOt', 'SensorTypeEnterprise' + SensorType SensorType `json:"sensorType,omitempty"` } // MarshalJSON is the custom marshaler for IotSensorProperties. @@ -12658,6 +13002,9 @@ func (isp IotSensorProperties) MarshalJSON() ([]byte, error) { if isp.Zone != nil { objectMap["zone"] = isp.Zone } + if isp.SensorType != "" { + objectMap["sensorType"] = isp.SensorType + } return json.Marshal(objectMap) } @@ -12750,11 +13097,11 @@ func (ism *IotSensorsModel) UnmarshalJSON(body []byte) error { // IoTSeverityMetrics ioT Security solution analytics severity metrics. type IoTSeverityMetrics struct { // High - Count of high severity alerts/recommendations. - High *int32 `json:"high,omitempty"` + High *int64 `json:"high,omitempty"` // Medium - Count of medium severity alerts/recommendations. - Medium *int32 `json:"medium,omitempty"` + Medium *int64 `json:"medium,omitempty"` // Low - Count of low severity alerts/recommendations. - Low *int32 `json:"low,omitempty"` + Low *int64 `json:"low,omitempty"` } // IotSiteProperties ioT site properties @@ -13266,6 +13613,7 @@ type BasicListCustomAlertRule interface { AsBasicAllowlistCustomAlertRule() (BasicAllowlistCustomAlertRule, bool) AsDenylistCustomAlertRule() (*DenylistCustomAlertRule, bool) AsConnectionToIPNotAllowed() (*ConnectionToIPNotAllowed, bool) + AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) AsProcessNotAllowed() (*ProcessNotAllowed, bool) AsListCustomAlertRule() (*ListCustomAlertRule, bool) @@ -13281,7 +13629,7 @@ type ListCustomAlertRule struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -13305,6 +13653,10 @@ func unmarshalBasicListCustomAlertRule(body []byte) (BasicListCustomAlertRule, e var ctina ConnectionToIPNotAllowed err := json.Unmarshal(body, &ctina) return ctina, err + case string(RuleTypeConnectionFromIPNotAllowed): + var cfina ConnectionFromIPNotAllowed + err := json.Unmarshal(body, &cfina) + return cfina, err case string(RuleTypeLocalUserNotAllowed): var luna LocalUserNotAllowed err := json.Unmarshal(body, &luna) @@ -13401,6 +13753,11 @@ func (lcar ListCustomAlertRule) AsConnectionToIPNotAllowed() (*ConnectionToIPNot return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for ListCustomAlertRule. +func (lcar ListCustomAlertRule) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for ListCustomAlertRule. func (lcar ListCustomAlertRule) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -13514,7 +13871,7 @@ type LocalUserNotAllowed struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -13584,6 +13941,11 @@ func (luna LocalUserNotAllowed) AsConnectionToIPNotAllowed() (*ConnectionToIPNot return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for LocalUserNotAllowed. +func (luna LocalUserNotAllowed) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for LocalUserNotAllowed. func (luna LocalUserNotAllowed) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return &luna, true @@ -13773,7 +14135,7 @@ type MqttC2DMessagesNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -13849,6 +14211,11 @@ func (mcmniar MqttC2DMessagesNotInAllowedRange) AsConnectionToIPNotAllowed() (*C return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for MqttC2DMessagesNotInAllowedRange. +func (mcmniar MqttC2DMessagesNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for MqttC2DMessagesNotInAllowedRange. func (mcmniar MqttC2DMessagesNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -13964,7 +14331,7 @@ type MqttC2DRejectedMessagesNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -14040,6 +14407,11 @@ func (mcrmniar MqttC2DRejectedMessagesNotInAllowedRange) AsConnectionToIPNotAllo return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for MqttC2DRejectedMessagesNotInAllowedRange. +func (mcrmniar MqttC2DRejectedMessagesNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for MqttC2DRejectedMessagesNotInAllowedRange. func (mcrmniar MqttC2DRejectedMessagesNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -14155,7 +14527,7 @@ type MqttD2CMessagesNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -14231,6 +14603,11 @@ func (mdmniar MqttD2CMessagesNotInAllowedRange) AsConnectionToIPNotAllowed() (*C return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for MqttD2CMessagesNotInAllowedRange. +func (mdmniar MqttD2CMessagesNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for MqttD2CMessagesNotInAllowedRange. func (mdmniar MqttD2CMessagesNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -15047,7 +15424,7 @@ type ProcessNotAllowed struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -15117,6 +15494,11 @@ func (pna ProcessNotAllowed) AsConnectionToIPNotAllowed() (*ConnectionToIPNotAll return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for ProcessNotAllowed. +func (pna ProcessNotAllowed) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for ProcessNotAllowed. func (pna ProcessNotAllowed) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -15292,7 +15674,7 @@ type QueuePurgesNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -15368,6 +15750,11 @@ func (qpniar QueuePurgesNotInAllowedRange) AsConnectionToIPNotAllowed() (*Connec return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for QueuePurgesNotInAllowedRange. +func (qpniar QueuePurgesNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for QueuePurgesNotInAllowedRange. func (qpniar QueuePurgesNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -17786,6 +18173,43 @@ func (sva *ServerVulnerabilityAssessment) UnmarshalJSON(body []byte) error { return nil } +// ServerVulnerabilityAssessmentDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ServerVulnerabilityAssessmentDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServerVulnerabilityAssessmentClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServerVulnerabilityAssessmentDeleteFuture) 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 ServerVulnerabilityAssessmentDeleteFuture.Result. +func (future *ServerVulnerabilityAssessmentDeleteFuture) result(client ServerVulnerabilityAssessmentClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "security.ServerVulnerabilityAssessmentDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("security.ServerVulnerabilityAssessmentDeleteFuture") + return + } + ar.Response = future.Response() + return +} + // ServerVulnerabilityAssessmentProperties describes ServerVulnerabilityAssessment properties. type ServerVulnerabilityAssessmentProperties struct { // ProvisioningState - READ-ONLY; The provisioningState of the vulnerability assessment capability on the VM. Possible values include: 'ProvisioningState1Succeeded', 'ProvisioningState1Failed', 'ProvisioningState1Canceled', 'ProvisioningState1Provisioning', 'ProvisioningState1Deprovisioning' @@ -18177,6 +18601,268 @@ func (s Site) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// Software represents a software data +type Software struct { + autorest.Response `json:"-"` + // SoftwareProperties - Properties of the Software Inventory resource + *SoftwareProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Software. +func (s Software) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SoftwareProperties != nil { + objectMap["properties"] = s.SoftwareProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Software struct. +func (s *Software) 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 softwareProperties SoftwareProperties + err = json.Unmarshal(*v, &softwareProperties) + if err != nil { + return err + } + s.SoftwareProperties = &softwareProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + } + } + + return nil +} + +// SoftwareProperties software Inventory resource properties +type SoftwareProperties struct { + // DeviceID - Unique identifier for the virtual machine in the service. + DeviceID *string `json:"deviceId,omitempty"` + // OsPlatform - Platform of the operating system running on the device. + OsPlatform *string `json:"osPlatform,omitempty"` + // Vendor - Name of the software vendor. + Vendor *string `json:"vendor,omitempty"` + // SoftwareName - Name of the software product. + SoftwareName *string `json:"softwareName,omitempty"` + // Version - Version number of the software product. + Version *string `json:"version,omitempty"` + // EndOfSupportStatus - End of support status. Possible values include: 'None', 'NoLongerSupported', 'VersionNoLongerSupported', 'UpcomingNoLongerSupported', 'UpcomingVersionNoLongerSupported' + EndOfSupportStatus EndOfSupportStatus `json:"endOfSupportStatus,omitempty"` + // EndOfSupportDate - The end of support date in case the product is upcoming end of support. + EndOfSupportDate *string `json:"endOfSupportDate,omitempty"` + // NumberOfKnownVulnerabilities - Number of weaknesses. + NumberOfKnownVulnerabilities *int32 `json:"numberOfKnownVulnerabilities,omitempty"` + // FirstSeenAt - First time that the software was seen in the device. + FirstSeenAt *string `json:"firstSeenAt,omitempty"` +} + +// SoftwaresList represents the software inventory of the virtual machine. +type SoftwaresList struct { + autorest.Response `json:"-"` + Value *[]Software `json:"value,omitempty"` + // NextLink - READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SoftwaresList. +func (sl SoftwaresList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sl.Value != nil { + objectMap["value"] = sl.Value + } + return json.Marshal(objectMap) +} + +// SoftwaresListIterator provides access to a complete listing of Software values. +type SoftwaresListIterator struct { + i int + page SoftwaresListPage +} + +// 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 *SoftwaresListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwaresListIterator.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 *SoftwaresListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SoftwaresListIterator) 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 SoftwaresListIterator) Response() SoftwaresList { + 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 SoftwaresListIterator) Value() Software { + if !iter.page.NotDone() { + return Software{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SoftwaresListIterator type. +func NewSoftwaresListIterator(page SoftwaresListPage) SoftwaresListIterator { + return SoftwaresListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sl SoftwaresList) IsEmpty() bool { + return sl.Value == nil || len(*sl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sl SoftwaresList) hasNextLink() bool { + return sl.NextLink != nil && len(*sl.NextLink) != 0 +} + +// softwaresListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sl SoftwaresList) softwaresListPreparer(ctx context.Context) (*http.Request, error) { + if !sl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sl.NextLink))) +} + +// SoftwaresListPage contains a page of Software values. +type SoftwaresListPage struct { + fn func(context.Context, SoftwaresList) (SoftwaresList, error) + sl SoftwaresList +} + +// 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 *SoftwaresListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwaresListPage.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.sl) + if err != nil { + return err + } + page.sl = 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 *SoftwaresListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SoftwaresListPage) NotDone() bool { + return !page.sl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SoftwaresListPage) Response() SoftwaresList { + return page.sl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SoftwaresListPage) Values() []Software { + if page.sl.IsEmpty() { + return nil + } + return *page.sl.Value +} + +// Creates a new instance of the SoftwaresListPage type. +func NewSoftwaresListPage(cur SoftwaresList, getNextPage func(context.Context, SoftwaresList) (SoftwaresList, error)) SoftwaresListPage { + return SoftwaresListPage{ + fn: getNextPage, + sl: cur, + } +} + // Solution ... type Solution struct { autorest.Response `json:"-"` @@ -18986,6 +19672,22 @@ type SuppressionAlertsScope struct { AllOf *[]ScopeElement `json:"allOf,omitempty"` } +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + // Tags a list of key value pairs that describe the resource. type Tags struct { // Tags - A list of key value pairs that describe the resource. @@ -19366,7 +20068,7 @@ type ThresholdCustomAlertRule struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -19540,6 +20242,11 @@ func (tcar ThresholdCustomAlertRule) AsConnectionToIPNotAllowed() (*ConnectionTo return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for ThresholdCustomAlertRule. +func (tcar ThresholdCustomAlertRule) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for ThresholdCustomAlertRule. func (tcar ThresholdCustomAlertRule) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -19677,7 +20384,7 @@ type TimeWindowCustomAlertRule struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -19850,6 +20557,11 @@ func (twcar TimeWindowCustomAlertRule) AsConnectionToIPNotAllowed() (*Connection return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for TimeWindowCustomAlertRule. +func (twcar TimeWindowCustomAlertRule) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for TimeWindowCustomAlertRule. func (twcar TimeWindowCustomAlertRule) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -20310,7 +21022,7 @@ type TwinUpdatesNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -20386,6 +21098,11 @@ func (tuniar TwinUpdatesNotInAllowedRange) AsConnectionToIPNotAllowed() (*Connec return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for TwinUpdatesNotInAllowedRange. +func (tuniar TwinUpdatesNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for TwinUpdatesNotInAllowedRange. func (tuniar TwinUpdatesNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false @@ -20500,7 +21217,7 @@ type UnauthorizedOperationsNotInAllowedRange struct { Description *string `json:"description,omitempty"` // IsEnabled - Status of the custom alert. IsEnabled *bool `json:"isEnabled,omitempty"` - // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' + // RuleType - Possible values include: 'RuleTypeCustomAlertRule', 'RuleTypeThresholdCustomAlertRule', 'RuleTypeTimeWindowCustomAlertRule', 'RuleTypeAllowlistCustomAlertRule', 'RuleTypeDenylistCustomAlertRule', 'RuleTypeListCustomAlertRule', 'RuleTypeConnectionToIPNotAllowed', 'RuleTypeConnectionFromIPNotAllowed', 'RuleTypeLocalUserNotAllowed', 'RuleTypeProcessNotAllowed', 'RuleTypeActiveConnectionsNotInAllowedRange', 'RuleTypeAmqpC2DMessagesNotInAllowedRange', 'RuleTypeMqttC2DMessagesNotInAllowedRange', 'RuleTypeHTTPC2DMessagesNotInAllowedRange', 'RuleTypeAmqpC2DRejectedMessagesNotInAllowedRange', 'RuleTypeMqttC2DRejectedMessagesNotInAllowedRange', 'RuleTypeHTTPC2DRejectedMessagesNotInAllowedRange', 'RuleTypeAmqpD2CMessagesNotInAllowedRange', 'RuleTypeMqttD2CMessagesNotInAllowedRange', 'RuleTypeHTTPD2CMessagesNotInAllowedRange', 'RuleTypeDirectMethodInvokesNotInAllowedRange', 'RuleTypeFailedLocalLoginsNotInAllowedRange', 'RuleTypeFileUploadsNotInAllowedRange', 'RuleTypeQueuePurgesNotInAllowedRange', 'RuleTypeTwinUpdatesNotInAllowedRange', 'RuleTypeUnauthorizedOperationsNotInAllowedRange' RuleType RuleTypeBasicCustomAlertRule `json:"ruleType,omitempty"` } @@ -20576,6 +21293,11 @@ func (uoniar UnauthorizedOperationsNotInAllowedRange) AsConnectionToIPNotAllowed return nil, false } +// AsConnectionFromIPNotAllowed is the BasicCustomAlertRule implementation for UnauthorizedOperationsNotInAllowedRange. +func (uoniar UnauthorizedOperationsNotInAllowedRange) AsConnectionFromIPNotAllowed() (*ConnectionFromIPNotAllowed, bool) { + return nil, false +} + // AsLocalUserNotAllowed is the BasicCustomAlertRule implementation for UnauthorizedOperationsNotInAllowedRange. func (uoniar UnauthorizedOperationsNotInAllowedRange) AsLocalUserNotAllowed() (*LocalUserNotAllowed, bool) { return nil, false diff --git a/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go b/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go index cef02af8b7d1..cea80c9c6b1c 100644 --- a/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go @@ -100,50 +100,6 @@ type IotSecuritySolutionsAnalyticsRecommendationClientAPI interface { var _ IotSecuritySolutionsAnalyticsRecommendationClientAPI = (*security.IotSecuritySolutionsAnalyticsRecommendationClient)(nil) -// IotAlertTypesClientAPI contains the set of methods on the IotAlertTypesClient type. -type IotAlertTypesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, solutionName string, iotAlertTypeName string) (result security.IotAlertType, err error) - Get1(ctx context.Context, iotAlertTypeName string) (result security.IotAlertType, err error) - List(ctx context.Context, resourceGroupName string, solutionName string) (result security.IotAlertTypeList, err error) - List1(ctx context.Context) (result security.IotAlertTypeList, err error) -} - -var _ IotAlertTypesClientAPI = (*security.IotAlertTypesClient)(nil) - -// IotAlertsClientAPI contains the set of methods on the IotAlertsClient type. -type IotAlertsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, solutionName string, iotAlertID string) (result security.IotAlert, err error) - Get1(ctx context.Context, scope string, iotAlertID string) (result security.IotAlertModel, err error) - List(ctx context.Context, resourceGroupName string, solutionName string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, compromisedEntity string, limit *int32, skipToken string) (result security.IotAlertListPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, solutionName string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, compromisedEntity string, limit *int32, skipToken string) (result security.IotAlertListIterator, err error) - List1(ctx context.Context, scope string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, deviceManagementType security.ManagementState, compromisedEntity string, limit *int32, skipToken string) (result security.IotAlertListModelPage, err error) - List1Complete(ctx context.Context, scope string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, deviceManagementType security.ManagementState, compromisedEntity string, limit *int32, skipToken string) (result security.IotAlertListModelIterator, err error) -} - -var _ IotAlertsClientAPI = (*security.IotAlertsClient)(nil) - -// IotRecommendationTypesClientAPI contains the set of methods on the IotRecommendationTypesClient type. -type IotRecommendationTypesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, solutionName string, iotRecommendationTypeName string) (result security.IotRecommendationType, err error) - Get1(ctx context.Context, iotRecommendationTypeName string) (result security.IotRecommendationType, err error) - List(ctx context.Context, resourceGroupName string, solutionName string) (result security.IotRecommendationTypeList, err error) - List1(ctx context.Context) (result security.IotRecommendationTypeList, err error) -} - -var _ IotRecommendationTypesClientAPI = (*security.IotRecommendationTypesClient)(nil) - -// IotRecommendationsClientAPI contains the set of methods on the IotRecommendationsClient type. -type IotRecommendationsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, solutionName string, iotRecommendationID string) (result security.IotRecommendation, err error) - Get1(ctx context.Context, scope string, iotRecommendationID string) (result security.IotRecommendationModel, err error) - List(ctx context.Context, resourceGroupName string, solutionName string, recommendationType string, deviceID string, limit *int32, skipToken string) (result security.IotRecommendationListPage, err error) - ListComplete(ctx context.Context, resourceGroupName string, solutionName string, recommendationType string, deviceID string, limit *int32, skipToken string) (result security.IotRecommendationListIterator, err error) - List1(ctx context.Context, scope string, recommendationType string, deviceID string, limit *int32, skipToken string) (result security.IotRecommendationListModelPage, err error) - List1Complete(ctx context.Context, scope string, recommendationType string, deviceID string, limit *int32, skipToken string) (result security.IotRecommendationListModelIterator, err error) -} - -var _ IotRecommendationsClientAPI = (*security.IotRecommendationsClient)(nil) - // LocationsClientAPI contains the set of methods on the LocationsClient type. type LocationsClientAPI interface { Get(ctx context.Context) (result security.AscLocation, err error) @@ -296,7 +252,7 @@ var _ AlertsSuppressionRulesClientAPI = (*security.AlertsSuppressionRulesClient) // ServerVulnerabilityAssessmentClientAPI contains the set of methods on the ServerVulnerabilityAssessmentClient type. type ServerVulnerabilityAssessmentClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result security.ServerVulnerabilityAssessment, err error) - Delete(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result autorest.Response, err error) + Delete(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result security.ServerVulnerabilityAssessmentDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result security.ServerVulnerabilityAssessment, err error) ListByExtendedResource(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result security.ServerVulnerabilityAssessmentsList, err error) } @@ -370,28 +326,6 @@ type TopologyClientAPI interface { var _ TopologyClientAPI = (*security.TopologyClient)(nil) -// AlertsClientAPI contains the set of methods on the AlertsClient type. -type AlertsClientAPI interface { - GetResourceGroupLevelAlerts(ctx context.Context, alertName string, resourceGroupName string) (result security.Alert, err error) - GetSubscriptionLevelAlert(ctx context.Context, alertName string) (result security.Alert, err error) - List(ctx context.Context) (result security.AlertListPage, err error) - ListComplete(ctx context.Context) (result security.AlertListIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result security.AlertListPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result security.AlertListIterator, err error) - ListResourceGroupLevelAlertsByRegion(ctx context.Context, resourceGroupName string) (result security.AlertListPage, err error) - ListResourceGroupLevelAlertsByRegionComplete(ctx context.Context, resourceGroupName string) (result security.AlertListIterator, err error) - ListSubscriptionLevelAlertsByRegion(ctx context.Context) (result security.AlertListPage, err error) - ListSubscriptionLevelAlertsByRegionComplete(ctx context.Context) (result security.AlertListIterator, err error) - UpdateResourceGroupLevelAlertStateToDismiss(ctx context.Context, alertName string, resourceGroupName string) (result autorest.Response, err error) - UpdateResourceGroupLevelAlertStateToReactivate(ctx context.Context, alertName string, resourceGroupName string) (result autorest.Response, err error) - UpdateResourceGroupLevelStateToResolve(ctx context.Context, alertName string, resourceGroupName string) (result autorest.Response, err error) - UpdateSubscriptionLevelAlertStateToDismiss(ctx context.Context, alertName string) (result autorest.Response, err error) - UpdateSubscriptionLevelAlertStateToReactivate(ctx context.Context, alertName string) (result autorest.Response, err error) - UpdateSubscriptionLevelStateToResolve(ctx context.Context, alertName string) (result autorest.Response, err error) -} - -var _ AlertsClientAPI = (*security.AlertsClient)(nil) - // JitNetworkAccessPoliciesClientAPI contains the set of methods on the JitNetworkAccessPoliciesClient type. type JitNetworkAccessPoliciesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, jitNetworkAccessPolicyName string, body security.JitNetworkAccessPolicy) (result security.JitNetworkAccessPolicy, err error) @@ -585,3 +519,84 @@ type IotSitesClientAPI interface { } var _ IotSitesClientAPI = (*security.IotSitesClient)(nil) + +// IotAlertsClientAPI contains the set of methods on the IotAlertsClient type. +type IotAlertsClientAPI interface { + Get(ctx context.Context, scope string, iotAlertID string) (result security.IotAlertModel, err error) + List(ctx context.Context, scope string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, deviceManagementType security.ManagementState, compromisedEntity string, limit *int32, skipToken string) (result security.IotAlertListModelPage, err error) + ListComplete(ctx context.Context, scope string, minStartTimeUtc string, maxStartTimeUtc string, alertType string, deviceManagementType security.ManagementState, compromisedEntity string, limit *int32, skipToken string) (result security.IotAlertListModelIterator, err error) +} + +var _ IotAlertsClientAPI = (*security.IotAlertsClient)(nil) + +// IotAlertTypesClientAPI contains the set of methods on the IotAlertTypesClient type. +type IotAlertTypesClientAPI interface { + Get(ctx context.Context, iotAlertTypeName string) (result security.IotAlertType, err error) + List(ctx context.Context) (result security.IotAlertTypeList, err error) +} + +var _ IotAlertTypesClientAPI = (*security.IotAlertTypesClient)(nil) + +// IotRecommendationsClientAPI contains the set of methods on the IotRecommendationsClient type. +type IotRecommendationsClientAPI interface { + Get(ctx context.Context, scope string, iotRecommendationID string) (result security.IotRecommendationModel, err error) + List(ctx context.Context, scope string, recommendationType string, deviceID string, limit *int32, skipToken string) (result security.IotRecommendationListModelPage, err error) + ListComplete(ctx context.Context, scope string, recommendationType string, deviceID string, limit *int32, skipToken string) (result security.IotRecommendationListModelIterator, err error) +} + +var _ IotRecommendationsClientAPI = (*security.IotRecommendationsClient)(nil) + +// IotRecommendationTypesClientAPI contains the set of methods on the IotRecommendationTypesClient type. +type IotRecommendationTypesClientAPI interface { + Get(ctx context.Context, iotRecommendationTypeName string) (result security.IotRecommendationType, err error) + List(ctx context.Context) (result security.IotRecommendationTypeList, err error) +} + +var _ IotRecommendationTypesClientAPI = (*security.IotRecommendationTypesClient)(nil) + +// AlertsClientAPI contains the set of methods on the AlertsClient type. +type AlertsClientAPI interface { + GetResourceGroupLevel(ctx context.Context, alertName string, resourceGroupName string) (result security.Alert, err error) + GetSubscriptionLevel(ctx context.Context, alertName string) (result security.Alert, err error) + List(ctx context.Context) (result security.AlertListPage, err error) + ListComplete(ctx context.Context) (result security.AlertListIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result security.AlertListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result security.AlertListIterator, err error) + ListResourceGroupLevelByRegion(ctx context.Context, resourceGroupName string) (result security.AlertListPage, err error) + ListResourceGroupLevelByRegionComplete(ctx context.Context, resourceGroupName string) (result security.AlertListIterator, err error) + ListSubscriptionLevelByRegion(ctx context.Context) (result security.AlertListPage, err error) + ListSubscriptionLevelByRegionComplete(ctx context.Context) (result security.AlertListIterator, err error) + Simulate(ctx context.Context, alertSimulatorRequestBody security.AlertSimulatorRequestBody) (result security.AlertsSimulateFuture, err error) + UpdateResourceGroupLevelStateToActivate(ctx context.Context, alertName string, resourceGroupName string) (result autorest.Response, err error) + UpdateResourceGroupLevelStateToDismiss(ctx context.Context, alertName string, resourceGroupName string) (result autorest.Response, err error) + UpdateResourceGroupLevelStateToResolve(ctx context.Context, alertName string, resourceGroupName string) (result autorest.Response, err error) + UpdateSubscriptionLevelStateToActivate(ctx context.Context, alertName string) (result autorest.Response, err error) + UpdateSubscriptionLevelStateToDismiss(ctx context.Context, alertName string) (result autorest.Response, err error) + UpdateSubscriptionLevelStateToResolve(ctx context.Context, alertName string) (result autorest.Response, err error) +} + +var _ AlertsClientAPI = (*security.AlertsClient)(nil) + +// IngestionSettingsClientAPI contains the set of methods on the IngestionSettingsClient type. +type IngestionSettingsClientAPI interface { + Create(ctx context.Context, ingestionSettingName string, ingestionSetting security.IngestionSetting) (result security.IngestionSetting, err error) + Delete(ctx context.Context, ingestionSettingName string) (result autorest.Response, err error) + Get(ctx context.Context, ingestionSettingName string) (result security.IngestionSetting, err error) + List(ctx context.Context) (result security.IngestionSettingListPage, err error) + ListComplete(ctx context.Context) (result security.IngestionSettingListIterator, err error) + ListConnectionStrings(ctx context.Context, ingestionSettingName string) (result security.ConnectionStrings, err error) + ListTokens(ctx context.Context, ingestionSettingName string) (result security.IngestionSettingToken, err error) +} + +var _ IngestionSettingsClientAPI = (*security.IngestionSettingsClient)(nil) + +// SoftwareInventoriesClientAPI contains the set of methods on the SoftwareInventoriesClient type. +type SoftwareInventoriesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, softwareName string) (result security.Software, err error) + ListByExtendedResource(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result security.SoftwaresListPage, err error) + ListByExtendedResourceComplete(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result security.SoftwaresListIterator, err error) + ListBySubscription(ctx context.Context) (result security.SoftwaresListPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result security.SoftwaresListIterator, err error) +} + +var _ SoftwareInventoriesClientAPI = (*security.SoftwareInventoriesClient)(nil) diff --git a/services/preview/security/mgmt/v3.0/security/servervulnerabilityassessment.go b/services/preview/security/mgmt/v3.0/security/servervulnerabilityassessment.go index abcfc8710527..38b230997c03 100644 --- a/services/preview/security/mgmt/v3.0/security/servervulnerabilityassessment.go +++ b/services/preview/security/mgmt/v3.0/security/servervulnerabilityassessment.go @@ -132,13 +132,13 @@ func (client ServerVulnerabilityAssessmentClient) CreateOrUpdateResponder(resp * // resourceNamespace - the Namespace of the resource. // resourceType - the type of the resource. // resourceName - name of the resource. -func (client ServerVulnerabilityAssessmentClient) Delete(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result autorest.Response, err error) { +func (client ServerVulnerabilityAssessmentClient) Delete(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result ServerVulnerabilityAssessmentDeleteFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ServerVulnerabilityAssessmentClient.Delete") defer func() { sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -159,16 +159,9 @@ func (client ServerVulnerabilityAssessmentClient) Delete(ctx context.Context, re return } - resp, err := client.DeleteSender(req) + result, err = client.DeleteSender(req) if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "security.ServerVulnerabilityAssessmentClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "security.ServerVulnerabilityAssessmentClient", "Delete", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "security.ServerVulnerabilityAssessmentClient", "Delete", nil, "Failure sending request") return } @@ -201,8 +194,17 @@ func (client ServerVulnerabilityAssessmentClient) DeletePreparer(ctx context.Con // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. -func (client ServerVulnerabilityAssessmentClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +func (client ServerVulnerabilityAssessmentClient) DeleteSender(req *http.Request) (future ServerVulnerabilityAssessmentDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return } // DeleteResponder handles the response to the Delete request. The method always @@ -210,7 +212,7 @@ func (client ServerVulnerabilityAssessmentClient) DeleteSender(req *http.Request func (client ServerVulnerabilityAssessmentClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), autorest.ByClosing()) result.Response = resp return diff --git a/services/preview/security/mgmt/v3.0/security/softwareinventories.go b/services/preview/security/mgmt/v3.0/security/softwareinventories.go new file mode 100644 index 000000000000..d7e3b70fd39a --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/softwareinventories.go @@ -0,0 +1,378 @@ +package security + +// 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" +) + +// SoftwareInventoriesClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type SoftwareInventoriesClient struct { + BaseClient +} + +// NewSoftwareInventoriesClient creates an instance of the SoftwareInventoriesClient client. +func NewSoftwareInventoriesClient(subscriptionID string, ascLocation string) SoftwareInventoriesClient { + return NewSoftwareInventoriesClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewSoftwareInventoriesClientWithBaseURI creates an instance of the SoftwareInventoriesClient 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 NewSoftwareInventoriesClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) SoftwareInventoriesClient { + return SoftwareInventoriesClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// Get gets a single software data of the virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// resourceNamespace - the namespace of the resource. +// resourceType - the type of the resource. +// resourceName - name of the resource. +// softwareName - name of the installed software. +func (client SoftwareInventoriesClient) Get(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, softwareName string) (result Software, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, 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("security.SoftwareInventoriesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SoftwareInventoriesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, softwareName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceNamespace": autorest.Encode("path", resourceNamespace), + "resourceType": autorest.Encode("path", resourceType), + "softwareName": autorest.Encode("path", softwareName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}", 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 SoftwareInventoriesClient) 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 SoftwareInventoriesClient) GetResponder(resp *http.Response) (result Software, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByExtendedResource gets the software inventory of the virtual machine. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// resourceNamespace - the namespace of the resource. +// resourceType - the type of the resource. +// resourceName - name of the resource. +func (client SoftwareInventoriesClient) ListByExtendedResource(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result SoftwaresListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.ListByExtendedResource") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, 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("security.SoftwareInventoriesClient", "ListByExtendedResource", err.Error()) + } + + result.fn = client.listByExtendedResourceNextResults + req, err := client.ListByExtendedResourcePreparer(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListByExtendedResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListByExtendedResourceSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListByExtendedResource", resp, "Failure sending request") + return + } + + result.sl, err = client.ListByExtendedResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListByExtendedResource", resp, "Failure responding to request") + return + } + if result.sl.hasNextLink() && result.sl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByExtendedResourcePreparer prepares the ListByExtendedResource request. +func (client SoftwareInventoriesClient) ListByExtendedResourcePreparer(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceNamespace": autorest.Encode("path", resourceNamespace), + "resourceType": autorest.Encode("path", resourceType), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByExtendedResourceSender sends the ListByExtendedResource request. The method will close the +// http.Response Body if it receives an error. +func (client SoftwareInventoriesClient) ListByExtendedResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByExtendedResourceResponder handles the response to the ListByExtendedResource request. The method always +// closes the http.Response Body. +func (client SoftwareInventoriesClient) ListByExtendedResourceResponder(resp *http.Response) (result SoftwaresList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByExtendedResourceNextResults retrieves the next set of results, if any. +func (client SoftwareInventoriesClient) listByExtendedResourceNextResults(ctx context.Context, lastResults SoftwaresList) (result SoftwaresList, err error) { + req, err := lastResults.softwaresListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listByExtendedResourceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByExtendedResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listByExtendedResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByExtendedResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listByExtendedResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByExtendedResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client SoftwareInventoriesClient) ListByExtendedResourceComplete(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string) (result SoftwaresListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.ListByExtendedResource") + 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.ListByExtendedResource(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName) + return +} + +// ListBySubscription gets the software inventory of all virtual machines in the subscriptions. +func (client SoftwareInventoriesClient) ListBySubscription(ctx context.Context) (result SoftwaresListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.ListBySubscription") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.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.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.SoftwareInventoriesClient", "ListBySubscription", err.Error()) + } + + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.sl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.sl.hasNextLink() && result.sl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client SoftwareInventoriesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories", 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 SoftwareInventoriesClient) 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 SoftwareInventoriesClient) ListBySubscriptionResponder(resp *http.Response) (result SoftwaresList, 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 SoftwareInventoriesClient) listBySubscriptionNextResults(ctx context.Context, lastResults SoftwaresList) (result SoftwaresList, err error) { + req, err := lastResults.softwaresListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "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, "security.SoftwareInventoriesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.SoftwareInventoriesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client SoftwareInventoriesClient) ListBySubscriptionComplete(ctx context.Context) (result SoftwaresListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SoftwareInventoriesClient.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 +} diff --git a/services/trafficmanager/mgmt/2018-08-01/trafficmanager/CHANGELOG.md b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/trafficmanager/mgmt/2018-08-01/trafficmanager/_meta.json b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/_meta.json new file mode 100644 index 000000000000..4fd6cd414dec --- /dev/null +++ b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "2b0b50e3e5bd467aa039a51cafa2a071593eca28", + "readme": "/_/azure-rest-api-specs/specification/trafficmanager/resource-manager/readme.md", + "tag": "package-2018-08", + "use": "@microsoft.azure/autorest.go@2.1.183", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2018-08 --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/trafficmanager/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/trafficmanager/mgmt/2018-08-01/trafficmanager/client.go b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/client.go new file mode 100644 index 000000000000..7cb416a9615c --- /dev/null +++ b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/client.go @@ -0,0 +1,41 @@ +// Package trafficmanager implements the Azure ARM Trafficmanager service API version 2018-08-01. +// +// +package trafficmanager + +// 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 Trafficmanager + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Trafficmanager. +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/trafficmanager/mgmt/2018-08-01/trafficmanager/endpoints.go b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/endpoints.go new file mode 100644 index 000000000000..0543699ee93b --- /dev/null +++ b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/endpoints.go @@ -0,0 +1,358 @@ +package trafficmanager + +// 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" +) + +// EndpointsClient is the client for the Endpoints methods of the Trafficmanager service. +type EndpointsClient struct { + BaseClient +} + +// NewEndpointsClient creates an instance of the EndpointsClient client. +func NewEndpointsClient(subscriptionID string) EndpointsClient { + return NewEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEndpointsClientWithBaseURI creates an instance of the EndpointsClient 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 NewEndpointsClientWithBaseURI(baseURI string, subscriptionID string) EndpointsClient { + return EndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a Traffic Manager endpoint. +// Parameters: +// resourceGroupName - the name of the resource group containing the Traffic Manager endpoint to be created or +// updated. +// profileName - the name of the Traffic Manager profile. +// endpointType - the type of the Traffic Manager endpoint to be created or updated. +// endpointName - the name of the Traffic Manager endpoint to be created or updated. +// parameters - the Traffic Manager endpoint parameters supplied to the CreateOrUpdate operation. +func (client EndpointsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (result Endpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, profileName, endpointType, endpointName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EndpointsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "endpointType": autorest.Encode("path", endpointType), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-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.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", 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 EndpointsClient) 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 EndpointsClient) CreateOrUpdateResponder(resp *http.Response) (result Endpoint, 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 Traffic Manager endpoint. +// Parameters: +// resourceGroupName - the name of the resource group containing the Traffic Manager endpoint to be deleted. +// profileName - the name of the Traffic Manager profile. +// endpointType - the type of the Traffic Manager endpoint to be deleted. +// endpointName - the name of the Traffic Manager endpoint to be deleted. +func (client EndpointsClient) Delete(ctx context.Context, resourceGroupName string, profileName string, endpointType string, endpointName string) (result DeleteOperationResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName, endpointType, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointType string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "endpointType": autorest.Encode("path", endpointType), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-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.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", 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 EndpointsClient) 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 EndpointsClient) DeleteResponder(resp *http.Response) (result DeleteOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a Traffic Manager endpoint. +// Parameters: +// resourceGroupName - the name of the resource group containing the Traffic Manager endpoint. +// profileName - the name of the Traffic Manager profile. +// endpointType - the type of the Traffic Manager endpoint. +// endpointName - the name of the Traffic Manager endpoint. +func (client EndpointsClient) Get(ctx context.Context, resourceGroupName string, profileName string, endpointType string, endpointName string) (result Endpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, endpointType, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, endpointType string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "endpointType": autorest.Encode("path", endpointType), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-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.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", 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 EndpointsClient) 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 EndpointsClient) GetResponder(resp *http.Response) (result Endpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update a Traffic Manager endpoint. +// Parameters: +// resourceGroupName - the name of the resource group containing the Traffic Manager endpoint to be updated. +// profileName - the name of the Traffic Manager profile. +// endpointType - the type of the Traffic Manager endpoint to be updated. +// endpointName - the name of the Traffic Manager endpoint to be updated. +// parameters - the Traffic Manager endpoint parameters supplied to the Update operation. +func (client EndpointsClient) Update(ctx context.Context, resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (result Endpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, endpointType, endpointName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.EndpointsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client EndpointsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, endpointType string, endpointName string, parameters Endpoint) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "endpointType": autorest.Encode("path", endpointType), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-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.Network/trafficmanagerprofiles/{profileName}/{endpointType}/{endpointName}", 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 EndpointsClient) 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 EndpointsClient) UpdateResponder(resp *http.Response) (result Endpoint, 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/trafficmanager/mgmt/2018-08-01/trafficmanager/enums.go b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/enums.go new file mode 100644 index 000000000000..614883540207 --- /dev/null +++ b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/enums.go @@ -0,0 +1,155 @@ +package trafficmanager + +// 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. + +// AllowedEndpointRecordType enumerates the values for allowed endpoint record type. +type AllowedEndpointRecordType string + +const ( + // AllowedEndpointRecordTypeAny ... + AllowedEndpointRecordTypeAny AllowedEndpointRecordType = "Any" + // AllowedEndpointRecordTypeDomainName ... + AllowedEndpointRecordTypeDomainName AllowedEndpointRecordType = "DomainName" + // AllowedEndpointRecordTypeIPv4Address ... + AllowedEndpointRecordTypeIPv4Address AllowedEndpointRecordType = "IPv4Address" + // AllowedEndpointRecordTypeIPv6Address ... + AllowedEndpointRecordTypeIPv6Address AllowedEndpointRecordType = "IPv6Address" +) + +// PossibleAllowedEndpointRecordTypeValues returns an array of possible values for the AllowedEndpointRecordType const type. +func PossibleAllowedEndpointRecordTypeValues() []AllowedEndpointRecordType { + return []AllowedEndpointRecordType{AllowedEndpointRecordTypeAny, AllowedEndpointRecordTypeDomainName, AllowedEndpointRecordTypeIPv4Address, AllowedEndpointRecordTypeIPv6Address} +} + +// EndpointMonitorStatus enumerates the values for endpoint monitor status. +type EndpointMonitorStatus string + +const ( + // EndpointMonitorStatusCheckingEndpoint ... + EndpointMonitorStatusCheckingEndpoint EndpointMonitorStatus = "CheckingEndpoint" + // EndpointMonitorStatusDegraded ... + EndpointMonitorStatusDegraded EndpointMonitorStatus = "Degraded" + // EndpointMonitorStatusDisabled ... + EndpointMonitorStatusDisabled EndpointMonitorStatus = "Disabled" + // EndpointMonitorStatusInactive ... + EndpointMonitorStatusInactive EndpointMonitorStatus = "Inactive" + // EndpointMonitorStatusOnline ... + EndpointMonitorStatusOnline EndpointMonitorStatus = "Online" + // EndpointMonitorStatusStopped ... + EndpointMonitorStatusStopped EndpointMonitorStatus = "Stopped" +) + +// PossibleEndpointMonitorStatusValues returns an array of possible values for the EndpointMonitorStatus const type. +func PossibleEndpointMonitorStatusValues() []EndpointMonitorStatus { + return []EndpointMonitorStatus{EndpointMonitorStatusCheckingEndpoint, EndpointMonitorStatusDegraded, EndpointMonitorStatusDisabled, EndpointMonitorStatusInactive, EndpointMonitorStatusOnline, EndpointMonitorStatusStopped} +} + +// EndpointStatus enumerates the values for endpoint status. +type EndpointStatus string + +const ( + // EndpointStatusDisabled ... + EndpointStatusDisabled EndpointStatus = "Disabled" + // EndpointStatusEnabled ... + EndpointStatusEnabled EndpointStatus = "Enabled" +) + +// PossibleEndpointStatusValues returns an array of possible values for the EndpointStatus const type. +func PossibleEndpointStatusValues() []EndpointStatus { + return []EndpointStatus{EndpointStatusDisabled, EndpointStatusEnabled} +} + +// MonitorProtocol enumerates the values for monitor protocol. +type MonitorProtocol string + +const ( + // MonitorProtocolHTTP ... + MonitorProtocolHTTP MonitorProtocol = "HTTP" + // MonitorProtocolHTTPS ... + MonitorProtocolHTTPS MonitorProtocol = "HTTPS" + // MonitorProtocolTCP ... + MonitorProtocolTCP MonitorProtocol = "TCP" +) + +// PossibleMonitorProtocolValues returns an array of possible values for the MonitorProtocol const type. +func PossibleMonitorProtocolValues() []MonitorProtocol { + return []MonitorProtocol{MonitorProtocolHTTP, MonitorProtocolHTTPS, MonitorProtocolTCP} +} + +// ProfileMonitorStatus enumerates the values for profile monitor status. +type ProfileMonitorStatus string + +const ( + // ProfileMonitorStatusCheckingEndpoints ... + ProfileMonitorStatusCheckingEndpoints ProfileMonitorStatus = "CheckingEndpoints" + // ProfileMonitorStatusDegraded ... + ProfileMonitorStatusDegraded ProfileMonitorStatus = "Degraded" + // ProfileMonitorStatusDisabled ... + ProfileMonitorStatusDisabled ProfileMonitorStatus = "Disabled" + // ProfileMonitorStatusInactive ... + ProfileMonitorStatusInactive ProfileMonitorStatus = "Inactive" + // ProfileMonitorStatusOnline ... + ProfileMonitorStatusOnline ProfileMonitorStatus = "Online" +) + +// PossibleProfileMonitorStatusValues returns an array of possible values for the ProfileMonitorStatus const type. +func PossibleProfileMonitorStatusValues() []ProfileMonitorStatus { + return []ProfileMonitorStatus{ProfileMonitorStatusCheckingEndpoints, ProfileMonitorStatusDegraded, ProfileMonitorStatusDisabled, ProfileMonitorStatusInactive, ProfileMonitorStatusOnline} +} + +// ProfileStatus enumerates the values for profile status. +type ProfileStatus string + +const ( + // ProfileStatusDisabled ... + ProfileStatusDisabled ProfileStatus = "Disabled" + // ProfileStatusEnabled ... + ProfileStatusEnabled ProfileStatus = "Enabled" +) + +// PossibleProfileStatusValues returns an array of possible values for the ProfileStatus const type. +func PossibleProfileStatusValues() []ProfileStatus { + return []ProfileStatus{ProfileStatusDisabled, ProfileStatusEnabled} +} + +// TrafficRoutingMethod enumerates the values for traffic routing method. +type TrafficRoutingMethod string + +const ( + // TrafficRoutingMethodGeographic ... + TrafficRoutingMethodGeographic TrafficRoutingMethod = "Geographic" + // TrafficRoutingMethodMultiValue ... + TrafficRoutingMethodMultiValue TrafficRoutingMethod = "MultiValue" + // TrafficRoutingMethodPerformance ... + TrafficRoutingMethodPerformance TrafficRoutingMethod = "Performance" + // TrafficRoutingMethodPriority ... + TrafficRoutingMethodPriority TrafficRoutingMethod = "Priority" + // TrafficRoutingMethodSubnet ... + TrafficRoutingMethodSubnet TrafficRoutingMethod = "Subnet" + // TrafficRoutingMethodWeighted ... + TrafficRoutingMethodWeighted TrafficRoutingMethod = "Weighted" +) + +// PossibleTrafficRoutingMethodValues returns an array of possible values for the TrafficRoutingMethod const type. +func PossibleTrafficRoutingMethodValues() []TrafficRoutingMethod { + return []TrafficRoutingMethod{TrafficRoutingMethodGeographic, TrafficRoutingMethodMultiValue, TrafficRoutingMethodPerformance, TrafficRoutingMethodPriority, TrafficRoutingMethodSubnet, TrafficRoutingMethodWeighted} +} + +// TrafficViewEnrollmentStatus enumerates the values for traffic view enrollment status. +type TrafficViewEnrollmentStatus string + +const ( + // TrafficViewEnrollmentStatusDisabled ... + TrafficViewEnrollmentStatusDisabled TrafficViewEnrollmentStatus = "Disabled" + // TrafficViewEnrollmentStatusEnabled ... + TrafficViewEnrollmentStatusEnabled TrafficViewEnrollmentStatus = "Enabled" +) + +// PossibleTrafficViewEnrollmentStatusValues returns an array of possible values for the TrafficViewEnrollmentStatus const type. +func PossibleTrafficViewEnrollmentStatusValues() []TrafficViewEnrollmentStatus { + return []TrafficViewEnrollmentStatus{TrafficViewEnrollmentStatusDisabled, TrafficViewEnrollmentStatusEnabled} +} diff --git a/services/trafficmanager/mgmt/2018-08-01/trafficmanager/geographichierarchies.go b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/geographichierarchies.go new file mode 100644 index 000000000000..0da4367b13b0 --- /dev/null +++ b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/geographichierarchies.go @@ -0,0 +1,99 @@ +package trafficmanager + +// 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" +) + +// GeographicHierarchiesClient is the client for the GeographicHierarchies methods of the Trafficmanager service. +type GeographicHierarchiesClient struct { + BaseClient +} + +// NewGeographicHierarchiesClient creates an instance of the GeographicHierarchiesClient client. +func NewGeographicHierarchiesClient(subscriptionID string) GeographicHierarchiesClient { + return NewGeographicHierarchiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGeographicHierarchiesClientWithBaseURI creates an instance of the GeographicHierarchiesClient 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 NewGeographicHierarchiesClientWithBaseURI(baseURI string, subscriptionID string) GeographicHierarchiesClient { + return GeographicHierarchiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetDefault gets the default Geographic Hierarchy used by the Geographic traffic routing method. +func (client GeographicHierarchiesClient) GetDefault(ctx context.Context) (result GeographicHierarchy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GeographicHierarchiesClient.GetDefault") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetDefaultPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.GeographicHierarchiesClient", "GetDefault", nil, "Failure preparing request") + return + } + + resp, err := client.GetDefaultSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.GeographicHierarchiesClient", "GetDefault", resp, "Failure sending request") + return + } + + result, err = client.GetDefaultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.GeographicHierarchiesClient", "GetDefault", resp, "Failure responding to request") + return + } + + return +} + +// GetDefaultPreparer prepares the GetDefault request. +func (client GeographicHierarchiesClient) GetDefaultPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2018-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Network/trafficManagerGeographicHierarchies/default"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDefaultSender sends the GetDefault request. The method will close the +// http.Response Body if it receives an error. +func (client GeographicHierarchiesClient) GetDefaultSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDefaultResponder handles the response to the GetDefault request. The method always +// closes the http.Response Body. +func (client GeographicHierarchiesClient) GetDefaultResponder(resp *http.Response) (result GeographicHierarchy, 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/trafficmanager/mgmt/2018-08-01/trafficmanager/heatmap.go b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/heatmap.go new file mode 100644 index 000000000000..07f874130ad8 --- /dev/null +++ b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/heatmap.go @@ -0,0 +1,131 @@ +package trafficmanager + +// 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" +) + +// HeatMapClient is the client for the HeatMap methods of the Trafficmanager service. +type HeatMapClient struct { + BaseClient +} + +// NewHeatMapClient creates an instance of the HeatMapClient client. +func NewHeatMapClient(subscriptionID string) HeatMapClient { + return NewHeatMapClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewHeatMapClientWithBaseURI creates an instance of the HeatMapClient 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 NewHeatMapClientWithBaseURI(baseURI string, subscriptionID string) HeatMapClient { + return HeatMapClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets latest heatmap for Traffic Manager profile. +// Parameters: +// resourceGroupName - the name of the resource group containing the Traffic Manager endpoint. +// profileName - the name of the Traffic Manager profile. +// topLeft - the top left latitude,longitude pair of the rectangular viewport to query for. +// botRight - the bottom right latitude,longitude pair of the rectangular viewport to query for. +func (client HeatMapClient) Get(ctx context.Context, resourceGroupName string, profileName string, topLeft []float64, botRight []float64) (result HeatMapModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HeatMapClient.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: topLeft, + Constraints: []validation.Constraint{{Target: "topLeft", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "topLeft", Name: validation.MaxItems, Rule: 2, Chain: nil}, + {Target: "topLeft", Name: validation.MinItems, Rule: 2, Chain: nil}, + }}}}, + {TargetValue: botRight, + Constraints: []validation.Constraint{{Target: "botRight", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "botRight", Name: validation.MaxItems, Rule: 2, Chain: nil}, + {Target: "botRight", Name: validation.MinItems, Rule: 2, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("trafficmanager.HeatMapClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, profileName, topLeft, botRight) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.HeatMapClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.HeatMapClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.HeatMapClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client HeatMapClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string, topLeft []float64, botRight []float64) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "heatMapType": autorest.Encode("path", "default"), + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if topLeft != nil && len(topLeft) > 0 { + queryParameters["topLeft"] = autorest.Encode("query", topLeft, ",") + } + if botRight != nil && len(botRight) > 0 { + queryParameters["botRight"] = autorest.Encode("query", botRight, ",") + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}/heatMaps/{heatMapType}", 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 HeatMapClient) 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 HeatMapClient) GetResponder(resp *http.Response) (result HeatMapModel, 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/trafficmanager/mgmt/2018-08-01/trafficmanager/models.go b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/models.go new file mode 100644 index 000000000000..1901dae4bd7d --- /dev/null +++ b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/models.go @@ -0,0 +1,767 @@ +package trafficmanager + +// 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 ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/trafficmanager/mgmt/2018-08-01/trafficmanager" + +// CheckTrafficManagerRelativeDNSNameAvailabilityParameters parameters supplied to check Traffic Manager +// name operation. +type CheckTrafficManagerRelativeDNSNameAvailabilityParameters struct { + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` +} + +// CloudError an error returned by the Azure Resource Manager +type CloudError struct { + // Error - The content of the error. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody the content of an error returned by the Azure Resource Manager +type CloudErrorBody 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 *[]CloudErrorBody `json:"details,omitempty"` +} + +// DeleteOperationResult the result of the request or operation. +type DeleteOperationResult struct { + autorest.Response `json:"-"` + // OperationResult - READ-ONLY; The result of the operation or request. + OperationResult *bool `json:"boolean,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeleteOperationResult. +func (dor DeleteOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DNSConfig class containing DNS settings in a Traffic Manager profile. +type DNSConfig struct { + // RelativeName - The relative DNS name provided by this Traffic Manager profile. This value is combined with the DNS domain name used by Azure Traffic Manager to form the fully-qualified domain name (FQDN) of the profile. + RelativeName *string `json:"relativeName,omitempty"` + // Fqdn - READ-ONLY; The fully-qualified domain name (FQDN) of the Traffic Manager profile. This is formed from the concatenation of the RelativeName with the DNS domain used by Azure Traffic Manager. + Fqdn *string `json:"fqdn,omitempty"` + // TTL - The DNS Time-To-Live (TTL), in seconds. This informs the local DNS resolvers and DNS clients how long to cache DNS responses provided by this Traffic Manager profile. + TTL *int64 `json:"ttl,omitempty"` +} + +// MarshalJSON is the custom marshaler for DNSConfig. +func (dc DNSConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dc.RelativeName != nil { + objectMap["relativeName"] = dc.RelativeName + } + if dc.TTL != nil { + objectMap["ttl"] = dc.TTL + } + return json.Marshal(objectMap) +} + +// Endpoint class representing a Traffic Manager endpoint. +type Endpoint struct { + autorest.Response `json:"-"` + // EndpointProperties - The properties of the Traffic Manager endpoint. + *EndpointProperties `json:"properties,omitempty"` + // ID - Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName} + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Endpoint. +func (e Endpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.EndpointProperties != nil { + objectMap["properties"] = e.EndpointProperties + } + if e.ID != nil { + objectMap["id"] = e.ID + } + if e.Name != nil { + objectMap["name"] = e.Name + } + if e.Type != nil { + objectMap["type"] = e.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Endpoint struct. +func (e *Endpoint) 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 endpointProperties EndpointProperties + err = json.Unmarshal(*v, &endpointProperties) + if err != nil { + return err + } + e.EndpointProperties = &endpointProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + } + } + + return nil +} + +// EndpointProperties class representing a Traffic Manager endpoint properties. +type EndpointProperties struct { + // TargetResourceID - The Azure Resource URI of the of the endpoint. Not applicable to endpoints of type 'ExternalEndpoints'. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // Target - The fully-qualified DNS name or IP address of the endpoint. Traffic Manager returns this value in DNS responses to direct traffic to this endpoint. + Target *string `json:"target,omitempty"` + // EndpointStatus - The status of the endpoint. If the endpoint is Enabled, it is probed for endpoint health and is included in the traffic routing method. Possible values include: 'EndpointStatusEnabled', 'EndpointStatusDisabled' + EndpointStatus EndpointStatus `json:"endpointStatus,omitempty"` + // Weight - The weight of this endpoint when using the 'Weighted' traffic routing method. Possible values are from 1 to 1000. + Weight *int64 `json:"weight,omitempty"` + // Priority - The priority of this endpoint when using the 'Priority' traffic routing method. Possible values are from 1 to 1000, lower values represent higher priority. This is an optional parameter. If specified, it must be specified on all endpoints, and no two endpoints can share the same priority value. + Priority *int64 `json:"priority,omitempty"` + // EndpointLocation - Specifies the location of the external or nested endpoints when using the 'Performance' traffic routing method. + EndpointLocation *string `json:"endpointLocation,omitempty"` + // EndpointMonitorStatus - The monitoring status of the endpoint. Possible values include: 'EndpointMonitorStatusCheckingEndpoint', 'EndpointMonitorStatusOnline', 'EndpointMonitorStatusDegraded', 'EndpointMonitorStatusDisabled', 'EndpointMonitorStatusInactive', 'EndpointMonitorStatusStopped' + EndpointMonitorStatus EndpointMonitorStatus `json:"endpointMonitorStatus,omitempty"` + // MinChildEndpoints - The minimum number of endpoints that must be available in the child profile in order for the parent profile to be considered available. Only applicable to endpoint of type 'NestedEndpoints'. + MinChildEndpoints *int64 `json:"minChildEndpoints,omitempty"` + // MinChildEndpointsIPv4 - The minimum number of IPv4 (DNS record type A) endpoints that must be available in the child profile in order for the parent profile to be considered available. Only applicable to endpoint of type 'NestedEndpoints'. + MinChildEndpointsIPv4 *int64 `json:"minChildEndpointsIPv4,omitempty"` + // MinChildEndpointsIPv6 - The minimum number of IPv6 (DNS record type AAAA) endpoints that must be available in the child profile in order for the parent profile to be considered available. Only applicable to endpoint of type 'NestedEndpoints'. + MinChildEndpointsIPv6 *int64 `json:"minChildEndpointsIPv6,omitempty"` + // GeoMapping - The list of countries/regions mapped to this endpoint when using the 'Geographic' traffic routing method. Please consult Traffic Manager Geographic documentation for a full list of accepted values. + GeoMapping *[]string `json:"geoMapping,omitempty"` + // Subnets - The list of subnets, IP addresses, and/or address ranges mapped to this endpoint when using the 'Subnet' traffic routing method. An empty list will match all ranges not covered by other endpoints. + Subnets *[]EndpointPropertiesSubnetsItem `json:"subnets,omitempty"` + // CustomHeaders - List of custom headers. + CustomHeaders *[]EndpointPropertiesCustomHeadersItem `json:"customHeaders,omitempty"` +} + +// EndpointPropertiesCustomHeadersItem custom header name and value. +type EndpointPropertiesCustomHeadersItem struct { + // Name - Header name. + Name *string `json:"name,omitempty"` + // Value - Header value. + Value *string `json:"value,omitempty"` +} + +// EndpointPropertiesSubnetsItem subnet first address, scope, and/or last address. +type EndpointPropertiesSubnetsItem struct { + // First - First address in the subnet. + First *string `json:"first,omitempty"` + // Last - Last address in the subnet. + Last *string `json:"last,omitempty"` + // Scope - Block size (number of leading bits in the subnet mask). + Scope *int32 `json:"scope,omitempty"` +} + +// GeographicHierarchy class representing the Geographic hierarchy used with the Geographic traffic routing +// method. +type GeographicHierarchy struct { + autorest.Response `json:"-"` + // GeographicHierarchyProperties - The properties of the Geographic Hierarchy resource. + *GeographicHierarchyProperties `json:"properties,omitempty"` + // ID - Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName} + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for GeographicHierarchy. +func (gh GeographicHierarchy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gh.GeographicHierarchyProperties != nil { + objectMap["properties"] = gh.GeographicHierarchyProperties + } + if gh.ID != nil { + objectMap["id"] = gh.ID + } + if gh.Name != nil { + objectMap["name"] = gh.Name + } + if gh.Type != nil { + objectMap["type"] = gh.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for GeographicHierarchy struct. +func (gh *GeographicHierarchy) 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 geographicHierarchyProperties GeographicHierarchyProperties + err = json.Unmarshal(*v, &geographicHierarchyProperties) + if err != nil { + return err + } + gh.GeographicHierarchyProperties = &geographicHierarchyProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + gh.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + gh.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + gh.Type = &typeVar + } + } + } + + return nil +} + +// GeographicHierarchyProperties class representing the properties of the Geographic hierarchy used with +// the Geographic traffic routing method. +type GeographicHierarchyProperties struct { + // GeographicHierarchy - The region at the root of the hierarchy from all the regions in the hierarchy can be retrieved. + GeographicHierarchy *Region `json:"geographicHierarchy,omitempty"` +} + +// HeatMapEndpoint class which is a sparse representation of a Traffic Manager endpoint. +type HeatMapEndpoint struct { + // ResourceID - The ARM Resource ID of this Traffic Manager endpoint. + ResourceID *string `json:"resourceId,omitempty"` + // EndpointID - A number uniquely identifying this endpoint in query experiences. + EndpointID *int32 `json:"endpointId,omitempty"` +} + +// HeatMapModel class representing a Traffic Manager HeatMap. +type HeatMapModel struct { + autorest.Response `json:"-"` + // HeatMapProperties - The properties of the Traffic Manager HeatMap. + *HeatMapProperties `json:"properties,omitempty"` + // ID - Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName} + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for HeatMapModel. +func (hmm HeatMapModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hmm.HeatMapProperties != nil { + objectMap["properties"] = hmm.HeatMapProperties + } + if hmm.ID != nil { + objectMap["id"] = hmm.ID + } + if hmm.Name != nil { + objectMap["name"] = hmm.Name + } + if hmm.Type != nil { + objectMap["type"] = hmm.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HeatMapModel struct. +func (hmm *HeatMapModel) 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 heatMapProperties HeatMapProperties + err = json.Unmarshal(*v, &heatMapProperties) + if err != nil { + return err + } + hmm.HeatMapProperties = &heatMapProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hmm.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hmm.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + hmm.Type = &typeVar + } + } + } + + return nil +} + +// HeatMapProperties class representing a Traffic Manager HeatMap properties. +type HeatMapProperties struct { + // StartTime - The beginning of the time window for this HeatMap, inclusive. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - The ending of the time window for this HeatMap, exclusive. + EndTime *date.Time `json:"endTime,omitempty"` + // Endpoints - The endpoints used in this HeatMap calculation. + Endpoints *[]HeatMapEndpoint `json:"endpoints,omitempty"` + // TrafficFlows - The traffic flows produced in this HeatMap calculation. + TrafficFlows *[]TrafficFlow `json:"trafficFlows,omitempty"` +} + +// MonitorConfig class containing endpoint monitoring settings in a Traffic Manager profile. +type MonitorConfig struct { + // ProfileMonitorStatus - The profile-level monitoring status of the Traffic Manager profile. Possible values include: 'ProfileMonitorStatusCheckingEndpoints', 'ProfileMonitorStatusOnline', 'ProfileMonitorStatusDegraded', 'ProfileMonitorStatusDisabled', 'ProfileMonitorStatusInactive' + ProfileMonitorStatus ProfileMonitorStatus `json:"profileMonitorStatus,omitempty"` + // Protocol - The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health. Possible values include: 'MonitorProtocolHTTP', 'MonitorProtocolHTTPS', 'MonitorProtocolTCP' + Protocol MonitorProtocol `json:"protocol,omitempty"` + // Port - The TCP port used to probe for endpoint health. + Port *int64 `json:"port,omitempty"` + // Path - The path relative to the endpoint domain name used to probe for endpoint health. + Path *string `json:"path,omitempty"` + // IntervalInSeconds - The monitor interval for endpoints in this profile. This is the interval at which Traffic Manager will check the health of each endpoint in this profile. + IntervalInSeconds *int64 `json:"intervalInSeconds,omitempty"` + // TimeoutInSeconds - The monitor timeout for endpoints in this profile. This is the time that Traffic Manager allows endpoints in this profile to response to the health check. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // ToleratedNumberOfFailures - The number of consecutive failed health check that Traffic Manager tolerates before declaring an endpoint in this profile Degraded after the next failed health check. + ToleratedNumberOfFailures *int64 `json:"toleratedNumberOfFailures,omitempty"` + // CustomHeaders - List of custom headers. + CustomHeaders *[]MonitorConfigCustomHeadersItem `json:"customHeaders,omitempty"` + // ExpectedStatusCodeRanges - List of expected status code ranges. + ExpectedStatusCodeRanges *[]MonitorConfigExpectedStatusCodeRangesItem `json:"expectedStatusCodeRanges,omitempty"` +} + +// MonitorConfigCustomHeadersItem custom header name and value. +type MonitorConfigCustomHeadersItem struct { + // Name - Header name. + Name *string `json:"name,omitempty"` + // Value - Header value. + Value *string `json:"value,omitempty"` +} + +// MonitorConfigExpectedStatusCodeRangesItem min and max value of a status code range. +type MonitorConfigExpectedStatusCodeRangesItem struct { + // Min - Min status code. + Min *int32 `json:"min,omitempty"` + // Max - Max status code. + Max *int32 `json:"max,omitempty"` +} + +// NameAvailability class representing a Traffic Manager Name Availability response. +type NameAvailability struct { + autorest.Response `json:"-"` + // Name - The relative name. + Name *string `json:"name,omitempty"` + // Type - Traffic Manager profile resource type. + Type *string `json:"type,omitempty"` + // NameAvailable - Describes whether the relative name is available or not. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - The reason why the name is not available, when applicable. + Reason *string `json:"reason,omitempty"` + // Message - Descriptive message that explains why the name is not available, when applicable. + Message *string `json:"message,omitempty"` +} + +// Profile class representing a Traffic Manager profile. +type Profile struct { + autorest.Response `json:"-"` + // ProfileProperties - The properties of the Traffic Manager profile. + *ProfileProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The Azure Region where the resource lives + Location *string `json:"location,omitempty"` + // ID - Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName} + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Profile. +func (p Profile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.ProfileProperties != nil { + objectMap["properties"] = p.ProfileProperties + } + if p.Tags != nil { + objectMap["tags"] = p.Tags + } + if p.Location != nil { + objectMap["location"] = p.Location + } + if p.ID != nil { + objectMap["id"] = p.ID + } + if p.Name != nil { + objectMap["name"] = p.Name + } + if p.Type != nil { + objectMap["type"] = p.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Profile struct. +func (p *Profile) 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 profileProperties ProfileProperties + err = json.Unmarshal(*v, &profileProperties) + if err != nil { + return err + } + p.ProfileProperties = &profileProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + p.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + p.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + } + } + + return nil +} + +// ProfileListResult the list Traffic Manager profiles operation response. +type ProfileListResult struct { + autorest.Response `json:"-"` + // Value - Gets the list of Traffic manager profiles. + Value *[]Profile `json:"value,omitempty"` +} + +// ProfileProperties class representing the Traffic Manager profile properties. +type ProfileProperties struct { + // ProfileStatus - The status of the Traffic Manager profile. Possible values include: 'ProfileStatusEnabled', 'ProfileStatusDisabled' + ProfileStatus ProfileStatus `json:"profileStatus,omitempty"` + // TrafficRoutingMethod - The traffic routing method of the Traffic Manager profile. Possible values include: 'TrafficRoutingMethodPerformance', 'TrafficRoutingMethodPriority', 'TrafficRoutingMethodWeighted', 'TrafficRoutingMethodGeographic', 'TrafficRoutingMethodMultiValue', 'TrafficRoutingMethodSubnet' + TrafficRoutingMethod TrafficRoutingMethod `json:"trafficRoutingMethod,omitempty"` + // DNSConfig - The DNS settings of the Traffic Manager profile. + DNSConfig *DNSConfig `json:"dnsConfig,omitempty"` + // MonitorConfig - The endpoint monitoring settings of the Traffic Manager profile. + MonitorConfig *MonitorConfig `json:"monitorConfig,omitempty"` + // Endpoints - The list of endpoints in the Traffic Manager profile. + Endpoints *[]Endpoint `json:"endpoints,omitempty"` + // TrafficViewEnrollmentStatus - Indicates whether Traffic View is 'Enabled' or 'Disabled' for the Traffic Manager profile. Null, indicates 'Disabled'. Enabling this feature will increase the cost of the Traffic Manage profile. Possible values include: 'TrafficViewEnrollmentStatusEnabled', 'TrafficViewEnrollmentStatusDisabled' + TrafficViewEnrollmentStatus TrafficViewEnrollmentStatus `json:"trafficViewEnrollmentStatus,omitempty"` + // AllowedEndpointRecordTypes - The list of allowed endpoint record types. + AllowedEndpointRecordTypes *[]AllowedEndpointRecordType `json:"allowedEndpointRecordTypes,omitempty"` + // MaxReturn - Maximum number of endpoints to be returned for MultiValue routing type. + MaxReturn *int64 `json:"maxReturn,omitempty"` +} + +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags +type ProxyResource struct { + // ID - Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName} + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + Type *string `json:"type,omitempty"` +} + +// QueryExperience class representing a Traffic Manager HeatMap query experience properties. +type QueryExperience struct { + // EndpointID - The id of the endpoint from the 'endpoints' array which these queries were routed to. + EndpointID *int32 `json:"endpointId,omitempty"` + // QueryCount - The number of queries originating from this location. + QueryCount *int32 `json:"queryCount,omitempty"` + // Latency - The latency experienced by queries originating from this location. + Latency *float64 `json:"latency,omitempty"` +} + +// Region class representing a region in the Geographic hierarchy used with the Geographic traffic routing +// method. +type Region struct { + // Code - The code of the region + Code *string `json:"code,omitempty"` + // Name - The name of the region + Name *string `json:"name,omitempty"` + // Regions - The list of Regions grouped under this Region in the Geographic Hierarchy. + Regions *[]Region `json:"regions,omitempty"` +} + +// Resource the core properties of ARM resources +type Resource struct { + // ID - Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName} + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + Type *string `json:"type,omitempty"` +} + +// 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 Azure Region where the resource lives + Location *string `json:"location,omitempty"` + // ID - Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName} + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + 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 + } + if tr.ID != nil { + objectMap["id"] = tr.ID + } + if tr.Name != nil { + objectMap["name"] = tr.Name + } + if tr.Type != nil { + objectMap["type"] = tr.Type + } + return json.Marshal(objectMap) +} + +// TrafficFlow class representing a Traffic Manager HeatMap traffic flow properties. +type TrafficFlow struct { + // SourceIP - The IP address that this query experience originated from. + SourceIP *string `json:"sourceIp,omitempty"` + // Latitude - The approximate latitude that these queries originated from. + Latitude *float64 `json:"latitude,omitempty"` + // Longitude - The approximate longitude that these queries originated from. + Longitude *float64 `json:"longitude,omitempty"` + // QueryExperiences - The query experiences produced in this HeatMap calculation. + QueryExperiences *[]QueryExperience `json:"queryExperiences,omitempty"` +} + +// UserMetricsModel class representing Traffic Manager User Metrics. +type UserMetricsModel struct { + autorest.Response `json:"-"` + // UserMetricsProperties - The properties of the Traffic Manager User Metrics. + *UserMetricsProperties `json:"properties,omitempty"` + // ID - Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName} + ID *string `json:"id,omitempty"` + // Name - The name of the resource + Name *string `json:"name,omitempty"` + // Type - The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserMetricsModel. +func (umm UserMetricsModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if umm.UserMetricsProperties != nil { + objectMap["properties"] = umm.UserMetricsProperties + } + if umm.ID != nil { + objectMap["id"] = umm.ID + } + if umm.Name != nil { + objectMap["name"] = umm.Name + } + if umm.Type != nil { + objectMap["type"] = umm.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for UserMetricsModel struct. +func (umm *UserMetricsModel) 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 userMetricsProperties UserMetricsProperties + err = json.Unmarshal(*v, &userMetricsProperties) + if err != nil { + return err + } + umm.UserMetricsProperties = &userMetricsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + umm.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + umm.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + umm.Type = &typeVar + } + } + } + + return nil +} + +// UserMetricsProperties class representing a Traffic Manager Real User Metrics key response. +type UserMetricsProperties struct { + // Key - The key returned by the User Metrics operation. + Key *string `json:"key,omitempty"` +} diff --git a/services/trafficmanager/mgmt/2018-08-01/trafficmanager/profiles.go b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/profiles.go new file mode 100644 index 000000000000..9d5cfee34312 --- /dev/null +++ b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/profiles.go @@ -0,0 +1,558 @@ +package trafficmanager + +// 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" +) + +// ProfilesClient is the client for the Profiles methods of the Trafficmanager service. +type ProfilesClient struct { + BaseClient +} + +// NewProfilesClient creates an instance of the ProfilesClient client. +func NewProfilesClient(subscriptionID string) ProfilesClient { + return NewProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProfilesClientWithBaseURI creates an instance of the ProfilesClient 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 NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) ProfilesClient { + return ProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckTrafficManagerRelativeDNSNameAvailability checks the availability of a Traffic Manager Relative DNS name. +// Parameters: +// parameters - the Traffic Manager name parameters supplied to the CheckTrafficManagerNameAvailability +// operation. +func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailability(ctx context.Context, parameters CheckTrafficManagerRelativeDNSNameAvailabilityParameters) (result NameAvailability, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.CheckTrafficManagerRelativeDNSNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckTrafficManagerRelativeDNSNameAvailabilityPreparer(ctx, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CheckTrafficManagerRelativeDNSNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckTrafficManagerRelativeDNSNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CheckTrafficManagerRelativeDNSNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckTrafficManagerRelativeDNSNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CheckTrafficManagerRelativeDNSNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckTrafficManagerRelativeDNSNameAvailabilityPreparer prepares the CheckTrafficManagerRelativeDNSNameAvailability request. +func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailabilityPreparer(ctx context.Context, parameters CheckTrafficManagerRelativeDNSNameAvailabilityParameters) (*http.Request, error) { + const APIVersion = "2018-08-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.WithPath("/providers/Microsoft.Network/checkTrafficManagerNameAvailability"), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckTrafficManagerRelativeDNSNameAvailabilitySender sends the CheckTrafficManagerRelativeDNSNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CheckTrafficManagerRelativeDNSNameAvailabilityResponder handles the response to the CheckTrafficManagerRelativeDNSNameAvailability request. The method always +// closes the http.Response Body. +func (client ProfilesClient) CheckTrafficManagerRelativeDNSNameAvailabilityResponder(resp *http.Response) (result NameAvailability, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create or update a Traffic Manager profile. +// Parameters: +// resourceGroupName - the name of the resource group containing the Traffic Manager profile. +// profileName - the name of the Traffic Manager profile. +// parameters - the Traffic Manager profile parameters supplied to the CreateOrUpdate operation. +func (client ProfilesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, profileName string, parameters Profile) (result Profile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, profileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ProfilesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, parameters Profile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-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.Network/trafficmanagerprofiles/{profileName}", 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 ProfilesClient) 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 ProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result Profile, 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 Traffic Manager profile. +// Parameters: +// resourceGroupName - the name of the resource group containing the Traffic Manager profile to be deleted. +// profileName - the name of the Traffic Manager profile to be deleted. +func (client ProfilesClient) Delete(ctx context.Context, resourceGroupName string, profileName string) (result DeleteOperationResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProfilesClient) DeletePreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-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.Network/trafficmanagerprofiles/{profileName}", 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 ProfilesClient) 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 ProfilesClient) DeleteResponder(resp *http.Response) (result DeleteOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets a Traffic Manager profile. +// Parameters: +// resourceGroupName - the name of the resource group containing the Traffic Manager profile. +// profileName - the name of the Traffic Manager profile. +func (client ProfilesClient) Get(ctx context.Context, resourceGroupName string, profileName string) (result Profile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, profileName) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProfilesClient) GetPreparer(ctx context.Context, resourceGroupName string, profileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-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.Network/trafficmanagerprofiles/{profileName}", 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 ProfilesClient) 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 ProfilesClient) GetResponder(resp *http.Response) (result Profile, 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 Traffic Manager profiles within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group containing the Traffic Manager profiles to be listed. +func (client ProfilesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ProfileListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ProfilesClient) 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-08-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.Network/trafficmanagerprofiles", 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 ProfilesClient) 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 ProfilesClient) ListByResourceGroupResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscription lists all Traffic Manager profiles within a subscription. +func (client ProfilesClient) ListBySubscription(ctx context.Context) (result ProfileListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ProfilesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficmanagerprofiles", 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 ProfilesClient) 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 ProfilesClient) ListBySubscriptionResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update update a Traffic Manager profile. +// Parameters: +// resourceGroupName - the name of the resource group containing the Traffic Manager profile. +// profileName - the name of the Traffic Manager profile. +// parameters - the Traffic Manager profile parameters supplied to the Update operation. +func (client ProfilesClient) Update(ctx context.Context, resourceGroupName string, profileName string, parameters Profile) (result Profile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, profileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.ProfilesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ProfilesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, profileName string, parameters Profile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "profileName": autorest.Encode("path", profileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-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.Network/trafficmanagerprofiles/{profileName}", 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 ProfilesClient) 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 ProfilesClient) UpdateResponder(resp *http.Response) (result Profile, 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/trafficmanager/mgmt/2018-08-01/trafficmanager/trafficmanagerapi/interfaces.go b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/trafficmanagerapi/interfaces.go new file mode 100644 index 000000000000..a100d69d79d3 --- /dev/null +++ b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/trafficmanagerapi/interfaces.go @@ -0,0 +1,58 @@ +package trafficmanagerapi + +// 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/trafficmanager/mgmt/2018-08-01/trafficmanager" +) + +// EndpointsClientAPI contains the set of methods on the EndpointsClient type. +type EndpointsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, profileName string, endpointType string, endpointName string, parameters trafficmanager.Endpoint) (result trafficmanager.Endpoint, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string, endpointType string, endpointName string) (result trafficmanager.DeleteOperationResult, err error) + Get(ctx context.Context, resourceGroupName string, profileName string, endpointType string, endpointName string) (result trafficmanager.Endpoint, err error) + Update(ctx context.Context, resourceGroupName string, profileName string, endpointType string, endpointName string, parameters trafficmanager.Endpoint) (result trafficmanager.Endpoint, err error) +} + +var _ EndpointsClientAPI = (*trafficmanager.EndpointsClient)(nil) + +// ProfilesClientAPI contains the set of methods on the ProfilesClient type. +type ProfilesClientAPI interface { + CheckTrafficManagerRelativeDNSNameAvailability(ctx context.Context, parameters trafficmanager.CheckTrafficManagerRelativeDNSNameAvailabilityParameters) (result trafficmanager.NameAvailability, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, profileName string, parameters trafficmanager.Profile) (result trafficmanager.Profile, err error) + Delete(ctx context.Context, resourceGroupName string, profileName string) (result trafficmanager.DeleteOperationResult, err error) + Get(ctx context.Context, resourceGroupName string, profileName string) (result trafficmanager.Profile, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result trafficmanager.ProfileListResult, err error) + ListBySubscription(ctx context.Context) (result trafficmanager.ProfileListResult, err error) + Update(ctx context.Context, resourceGroupName string, profileName string, parameters trafficmanager.Profile) (result trafficmanager.Profile, err error) +} + +var _ ProfilesClientAPI = (*trafficmanager.ProfilesClient)(nil) + +// GeographicHierarchiesClientAPI contains the set of methods on the GeographicHierarchiesClient type. +type GeographicHierarchiesClientAPI interface { + GetDefault(ctx context.Context) (result trafficmanager.GeographicHierarchy, err error) +} + +var _ GeographicHierarchiesClientAPI = (*trafficmanager.GeographicHierarchiesClient)(nil) + +// HeatMapClientAPI contains the set of methods on the HeatMapClient type. +type HeatMapClientAPI interface { + Get(ctx context.Context, resourceGroupName string, profileName string, topLeft []float64, botRight []float64) (result trafficmanager.HeatMapModel, err error) +} + +var _ HeatMapClientAPI = (*trafficmanager.HeatMapClient)(nil) + +// UserMetricsKeysClientAPI contains the set of methods on the UserMetricsKeysClient type. +type UserMetricsKeysClientAPI interface { + CreateOrUpdate(ctx context.Context) (result trafficmanager.UserMetricsModel, err error) + Delete(ctx context.Context) (result trafficmanager.DeleteOperationResult, err error) + Get(ctx context.Context) (result trafficmanager.UserMetricsModel, err error) +} + +var _ UserMetricsKeysClientAPI = (*trafficmanager.UserMetricsKeysClient)(nil) diff --git a/services/trafficmanager/mgmt/2018-08-01/trafficmanager/usermetricskeys.go b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/usermetricskeys.go new file mode 100644 index 000000000000..2428c38257bc --- /dev/null +++ b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/usermetricskeys.go @@ -0,0 +1,244 @@ +package trafficmanager + +// 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" +) + +// UserMetricsKeysClient is the client for the UserMetricsKeys methods of the Trafficmanager service. +type UserMetricsKeysClient struct { + BaseClient +} + +// NewUserMetricsKeysClient creates an instance of the UserMetricsKeysClient client. +func NewUserMetricsKeysClient(subscriptionID string) UserMetricsKeysClient { + return NewUserMetricsKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUserMetricsKeysClientWithBaseURI creates an instance of the UserMetricsKeysClient 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 NewUserMetricsKeysClientWithBaseURI(baseURI string, subscriptionID string) UserMetricsKeysClient { + return UserMetricsKeysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a subscription-level key used for Real User Metrics collection. +func (client UserMetricsKeysClient) CreateOrUpdate(ctx context.Context) (result UserMetricsModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserMetricsKeysClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.UserMetricsKeysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.UserMetricsKeysClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.UserMetricsKeysClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client UserMetricsKeysClient) CreateOrUpdatePreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default", pathParameters), + 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 UserMetricsKeysClient) 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 UserMetricsKeysClient) CreateOrUpdateResponder(resp *http.Response) (result UserMetricsModel, 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 a subscription-level key used for Real User Metrics collection. +func (client UserMetricsKeysClient) Delete(ctx context.Context) (result DeleteOperationResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserMetricsKeysClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.UserMetricsKeysClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.UserMetricsKeysClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.UserMetricsKeysClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client UserMetricsKeysClient) DeletePreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default", 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 UserMetricsKeysClient) 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 UserMetricsKeysClient) DeleteResponder(resp *http.Response) (result DeleteOperationResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the subscription-level key used for Real User Metrics collection. +func (client UserMetricsKeysClient) Get(ctx context.Context) (result UserMetricsModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserMetricsKeysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.UserMetricsKeysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "trafficmanager.UserMetricsKeysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "trafficmanager.UserMetricsKeysClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client UserMetricsKeysClient) GetPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/trafficManagerUserMetricsKeys/default", 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 UserMetricsKeysClient) 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 UserMetricsKeysClient) GetResponder(resp *http.Response) (result UserMetricsModel, 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/trafficmanager/mgmt/2018-08-01/trafficmanager/version.go b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/version.go new file mode 100644 index 000000000000..d8c5839dd75d --- /dev/null +++ b/services/trafficmanager/mgmt/2018-08-01/trafficmanager/version.go @@ -0,0 +1,19 @@ +package trafficmanager + +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() + " trafficmanager/2018-08-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 aabf42a4d501..25ff8c0689b2 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 = "v55.2.0" +const Number = "v55.3.0"