diff --git a/CHANGELOG.md b/CHANGELOG.md index 5daa168b0f18..077cab891e9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # CHANGELOG +## `v58.3.0` + +### New Packages + +- `github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2021-09-01/containerservice` +- `github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2021-12-01/eventgrid` +- `github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry` + +### Breaking Changes + +| Package Path | Changelog | +| :--- | :---: | +| `github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry` | [details](https://github.com/Azure/azure-sdk-for-go/tree/main/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/CHANGELOG.md) | + ## `v58.2.0` ### New Packages @@ -15,7 +29,7 @@ | Package Path | Changelog | | :--- | :---: | -| `github.com/Azure/azure-sdk-for-go/services/preview/deviceupdate/mgmt/2020-03-01-preview/deviceupdate` | [details](https://github.com/Azure/azure-sdk-for-go/tree/main/services/preview/deviceupdate/mgmt/2020-03-01-preview/deviceupdate/CHANGELOG.md) | +| `github.com/Azure/azure-sdk-for-go/services/preview/deviceupdate/mgmt/2020-03-01-preview/deviceupdate` | [details](https://github.com/Azure/azure-sdk-for-go/blob/v58.2.0/services/preview/deviceupdate/mgmt/2020-03-01-preview/deviceupdate/CHANGELOG.md) | ## `v58.1.0` diff --git a/profiles/latest/containerservice/mgmt/containerservice/containerserviceapi/models.go b/profiles/latest/containerservice/mgmt/containerservice/containerserviceapi/models.go index 38e14d4827cf..bdcfc9e50d0b 100644 --- a/profiles/latest/containerservice/mgmt/containerservice/containerserviceapi/models.go +++ b/profiles/latest/containerservice/mgmt/containerservice/containerserviceapi/models.go @@ -9,7 +9,7 @@ package containerserviceapi -import original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2021-08-01/containerservice/containerserviceapi" +import original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2021-09-01/containerservice/containerserviceapi" type AgentPoolsClientAPI = original.AgentPoolsClientAPI type MaintenanceConfigurationsClientAPI = original.MaintenanceConfigurationsClientAPI diff --git a/profiles/latest/containerservice/mgmt/containerservice/models.go b/profiles/latest/containerservice/mgmt/containerservice/models.go index 0ffc1330fb9f..4387bdc0ad5f 100644 --- a/profiles/latest/containerservice/mgmt/containerservice/models.go +++ b/profiles/latest/containerservice/mgmt/containerservice/models.go @@ -12,7 +12,7 @@ package containerservice import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2021-08-01/containerservice" + original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2021-09-01/containerservice" ) const ( @@ -572,6 +572,7 @@ type TimeInWeek = original.TimeInWeek type TimeSpan = original.TimeSpan type UserAssignedIdentity = original.UserAssignedIdentity type VMDiagnostics = original.VMDiagnostics +type WindowsGmsaProfile = original.WindowsGmsaProfile func New(subscriptionID string) BaseClient { return original.New(subscriptionID) diff --git a/profiles/latest/eventgrid/mgmt/eventgrid/eventgridapi/models.go b/profiles/latest/eventgrid/mgmt/eventgrid/eventgridapi/models.go index 509702cd65e8..a5486251166c 100644 --- a/profiles/latest/eventgrid/mgmt/eventgrid/eventgridapi/models.go +++ b/profiles/latest/eventgrid/mgmt/eventgrid/eventgridapi/models.go @@ -9,13 +9,16 @@ package eventgridapi -import original "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2020-06-01/eventgrid/eventgridapi" +import original "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2021-12-01/eventgrid/eventgridapi" type DomainTopicsClientAPI = original.DomainTopicsClientAPI type DomainsClientAPI = original.DomainsClientAPI type EventSubscriptionsClientAPI = original.EventSubscriptionsClientAPI +type ExtensionTopicsClientAPI = original.ExtensionTopicsClientAPI type OperationsClientAPI = original.OperationsClientAPI type PrivateEndpointConnectionsClientAPI = original.PrivateEndpointConnectionsClientAPI type PrivateLinkResourcesClientAPI = original.PrivateLinkResourcesClientAPI +type SystemTopicEventSubscriptionsClientAPI = original.SystemTopicEventSubscriptionsClientAPI +type SystemTopicsClientAPI = original.SystemTopicsClientAPI type TopicTypesClientAPI = original.TopicTypesClientAPI type TopicsClientAPI = original.TopicsClientAPI diff --git a/profiles/latest/eventgrid/mgmt/eventgrid/models.go b/profiles/latest/eventgrid/mgmt/eventgrid/models.go index df0a61312b0b..d74c996ef6b7 100644 --- a/profiles/latest/eventgrid/mgmt/eventgrid/models.go +++ b/profiles/latest/eventgrid/mgmt/eventgrid/models.go @@ -12,22 +12,31 @@ package eventgrid import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2020-06-01/eventgrid" + original "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2021-12-01/eventgrid" ) 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 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 @@ -57,16 +66,23 @@ const ( type EndpointTypeBasicDeadLetterDestination = original.EndpointTypeBasicDeadLetterDestination const ( - EndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = original.EndpointTypeDeadLetterDestination - EndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = original.EndpointTypeStorageBlob + EndpointTypeBasicDeadLetterDestinationEndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = original.EndpointTypeBasicDeadLetterDestinationEndpointTypeDeadLetterDestination + EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = original.EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob ) 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 ( + EventSubscriptionIdentityTypeSystemAssigned EventSubscriptionIdentityType = original.EventSubscriptionIdentityTypeSystemAssigned + EventSubscriptionIdentityTypeUserAssigned EventSubscriptionIdentityType = original.EventSubscriptionIdentityTypeUserAssigned ) type EventSubscriptionProvisioningState = original.EventSubscriptionProvisioningState @@ -84,7 +100,16 @@ const ( type IPActionType = original.IPActionType const ( - Allow IPActionType = original.Allow + IPActionTypeAllow IPActionType = original.IPActionTypeAllow +) + +type IdentityType = original.IdentityType + +const ( + IdentityTypeNone IdentityType = original.IdentityTypeNone + IdentityTypeSystemAssigned IdentityType = original.IdentityTypeSystemAssigned + IdentityTypeSystemAssignedUserAssigned IdentityType = original.IdentityTypeSystemAssignedUserAssigned + IdentityTypeUserAssigned IdentityType = original.IdentityTypeUserAssigned ) type InputSchema = original.InputSchema @@ -123,17 +148,17 @@ const ( 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 ResourceProvisioningState = original.ResourceProvisioningState @@ -150,8 +175,8 @@ const ( type ResourceRegionType = original.ResourceRegionType const ( - GlobalResource ResourceRegionType = original.GlobalResource - RegionalResource ResourceRegionType = original.RegionalResource + ResourceRegionTypeGlobalResource ResourceRegionType = original.ResourceRegionTypeGlobalResource + ResourceRegionTypeRegionalResource ResourceRegionType = original.ResourceRegionTypeRegionalResource ) type TopicProvisioningState = original.TopicProvisioningState @@ -176,17 +201,30 @@ const ( TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = original.TopicTypeProvisioningStateUpdating ) +type Type = original.Type + +const ( + TypeDeliveryAttributeMapping Type = original.TypeDeliveryAttributeMapping + TypeDynamic Type = original.TypeDynamic + TypeStatic Type = original.TypeStatic +) + type AdvancedFilter = original.AdvancedFilter type AzureFunctionEventSubscriptionDestination = original.AzureFunctionEventSubscriptionDestination type AzureFunctionEventSubscriptionDestinationProperties = original.AzureFunctionEventSubscriptionDestinationProperties type BaseClient = original.BaseClient type BasicAdvancedFilter = original.BasicAdvancedFilter type BasicDeadLetterDestination = original.BasicDeadLetterDestination +type BasicDeliveryAttributeMapping = original.BasicDeliveryAttributeMapping type BasicEventSubscriptionDestination = original.BasicEventSubscriptionDestination type BasicInputSchemaMapping = original.BasicInputSchemaMapping type BoolEqualsAdvancedFilter = original.BoolEqualsAdvancedFilter type ConnectionState = original.ConnectionState type DeadLetterDestination = original.DeadLetterDestination +type DeadLetterWithResourceIdentity = original.DeadLetterWithResourceIdentity +type DeliveryAttributeListResult = original.DeliveryAttributeListResult +type DeliveryAttributeMapping = original.DeliveryAttributeMapping +type DeliveryWithResourceIdentity = original.DeliveryWithResourceIdentity type Domain = original.Domain type DomainProperties = original.DomainProperties type DomainRegenerateKeyRequest = original.DomainRegenerateKeyRequest @@ -208,12 +246,15 @@ type DomainsListResult = original.DomainsListResult type DomainsListResultIterator = original.DomainsListResultIterator type DomainsListResultPage = original.DomainsListResultPage type DomainsUpdateFuture = original.DomainsUpdateFuture +type DynamicDeliveryAttributeMapping = original.DynamicDeliveryAttributeMapping +type DynamicDeliveryAttributeMappingProperties = original.DynamicDeliveryAttributeMappingProperties type EventHubEventSubscriptionDestination = original.EventHubEventSubscriptionDestination type EventHubEventSubscriptionDestinationProperties = original.EventHubEventSubscriptionDestinationProperties type EventSubscription = original.EventSubscription type EventSubscriptionDestination = original.EventSubscriptionDestination type EventSubscriptionFilter = original.EventSubscriptionFilter type EventSubscriptionFullURL = original.EventSubscriptionFullURL +type EventSubscriptionIdentity = original.EventSubscriptionIdentity type EventSubscriptionProperties = original.EventSubscriptionProperties type EventSubscriptionUpdateParameters = original.EventSubscriptionUpdateParameters type EventSubscriptionsClient = original.EventSubscriptionsClient @@ -226,8 +267,12 @@ type EventSubscriptionsUpdateFuture = original.EventSubscriptionsUpdateFuture type EventType = original.EventType type EventTypeProperties = original.EventTypeProperties type EventTypesListResult = original.EventTypesListResult +type ExtensionTopic = original.ExtensionTopic +type ExtensionTopicProperties = original.ExtensionTopicProperties +type ExtensionTopicsClient = original.ExtensionTopicsClient type HybridConnectionEventSubscriptionDestination = original.HybridConnectionEventSubscriptionDestination type HybridConnectionEventSubscriptionDestinationProperties = original.HybridConnectionEventSubscriptionDestinationProperties +type IdentityInfo = original.IdentityInfo type InboundIPRule = original.InboundIPRule type InputSchemaMapping = original.InputSchemaMapping type JSONField = original.JSONField @@ -265,6 +310,8 @@ type ServiceBusQueueEventSubscriptionDestination = original.ServiceBusQueueEvent type ServiceBusQueueEventSubscriptionDestinationProperties = original.ServiceBusQueueEventSubscriptionDestinationProperties type ServiceBusTopicEventSubscriptionDestination = original.ServiceBusTopicEventSubscriptionDestination type ServiceBusTopicEventSubscriptionDestinationProperties = original.ServiceBusTopicEventSubscriptionDestinationProperties +type StaticDeliveryAttributeMapping = original.StaticDeliveryAttributeMapping +type StaticDeliveryAttributeMappingProperties = original.StaticDeliveryAttributeMappingProperties type StorageBlobDeadLetterDestination = original.StorageBlobDeadLetterDestination type StorageBlobDeadLetterDestinationProperties = original.StorageBlobDeadLetterDestinationProperties type StorageQueueEventSubscriptionDestination = original.StorageQueueEventSubscriptionDestination @@ -274,6 +321,21 @@ type StringContainsAdvancedFilter = original.StringContainsAdvancedFilter type StringEndsWithAdvancedFilter = original.StringEndsWithAdvancedFilter type StringInAdvancedFilter = original.StringInAdvancedFilter type StringNotInAdvancedFilter = original.StringNotInAdvancedFilter +type SystemData = original.SystemData +type SystemTopic = original.SystemTopic +type SystemTopicEventSubscriptionsClient = original.SystemTopicEventSubscriptionsClient +type SystemTopicEventSubscriptionsCreateOrUpdateFuture = original.SystemTopicEventSubscriptionsCreateOrUpdateFuture +type SystemTopicEventSubscriptionsDeleteFuture = original.SystemTopicEventSubscriptionsDeleteFuture +type SystemTopicEventSubscriptionsUpdateFuture = original.SystemTopicEventSubscriptionsUpdateFuture +type SystemTopicProperties = original.SystemTopicProperties +type SystemTopicUpdateParameters = original.SystemTopicUpdateParameters +type SystemTopicsClient = original.SystemTopicsClient +type SystemTopicsCreateOrUpdateFuture = original.SystemTopicsCreateOrUpdateFuture +type SystemTopicsDeleteFuture = original.SystemTopicsDeleteFuture +type SystemTopicsListResult = original.SystemTopicsListResult +type SystemTopicsListResultIterator = original.SystemTopicsListResultIterator +type SystemTopicsListResultPage = original.SystemTopicsListResultPage +type SystemTopicsUpdateFuture = original.SystemTopicsUpdateFuture type Topic = original.Topic type TopicProperties = original.TopicProperties type TopicRegenerateKeyRequest = original.TopicRegenerateKeyRequest @@ -290,8 +352,10 @@ type TopicsDeleteFuture = original.TopicsDeleteFuture type TopicsListResult = original.TopicsListResult type TopicsListResultIterator = original.TopicsListResultIterator type TopicsListResultPage = original.TopicsListResultPage +type TopicsRegenerateKeyFuture = original.TopicsRegenerateKeyFuture type TopicsUpdateFuture = original.TopicsUpdateFuture type TrackedResource = original.TrackedResource +type UserIdentityProperties = original.UserIdentityProperties type WebHookEventSubscriptionDestination = original.WebHookEventSubscriptionDestination type WebHookEventSubscriptionDestinationProperties = original.WebHookEventSubscriptionDestinationProperties @@ -334,6 +398,12 @@ func NewEventSubscriptionsListResultIterator(page EventSubscriptionsListResultPa func NewEventSubscriptionsListResultPage(cur EventSubscriptionsListResult, getNextPage func(context.Context, EventSubscriptionsListResult) (EventSubscriptionsListResult, error)) EventSubscriptionsListResultPage { return original.NewEventSubscriptionsListResultPage(cur, getNextPage) } +func NewExtensionTopicsClient(subscriptionID string) ExtensionTopicsClient { + return original.NewExtensionTopicsClient(subscriptionID) +} +func NewExtensionTopicsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTopicsClient { + return original.NewExtensionTopicsClientWithBaseURI(baseURI, subscriptionID) +} func NewOperationsClient(subscriptionID string) OperationsClient { return original.NewOperationsClient(subscriptionID) } @@ -364,6 +434,24 @@ func NewPrivateLinkResourcesListResultIterator(page PrivateLinkResourcesListResu func NewPrivateLinkResourcesListResultPage(cur PrivateLinkResourcesListResult, getNextPage func(context.Context, PrivateLinkResourcesListResult) (PrivateLinkResourcesListResult, error)) PrivateLinkResourcesListResultPage { return original.NewPrivateLinkResourcesListResultPage(cur, getNextPage) } +func NewSystemTopicEventSubscriptionsClient(subscriptionID string) SystemTopicEventSubscriptionsClient { + return original.NewSystemTopicEventSubscriptionsClient(subscriptionID) +} +func NewSystemTopicEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SystemTopicEventSubscriptionsClient { + return original.NewSystemTopicEventSubscriptionsClientWithBaseURI(baseURI, subscriptionID) +} +func NewSystemTopicsClient(subscriptionID string) SystemTopicsClient { + return original.NewSystemTopicsClient(subscriptionID) +} +func NewSystemTopicsClientWithBaseURI(baseURI string, subscriptionID string) SystemTopicsClient { + return original.NewSystemTopicsClientWithBaseURI(baseURI, subscriptionID) +} +func NewSystemTopicsListResultIterator(page SystemTopicsListResultPage) SystemTopicsListResultIterator { + return original.NewSystemTopicsListResultIterator(page) +} +func NewSystemTopicsListResultPage(cur SystemTopicsListResult, getNextPage func(context.Context, SystemTopicsListResult) (SystemTopicsListResult, error)) SystemTopicsListResultPage { + return original.NewSystemTopicsListResultPage(cur, getNextPage) +} func NewTopicTypesClient(subscriptionID string) TopicTypesClient { return original.NewTopicTypesClient(subscriptionID) } @@ -385,6 +473,9 @@ func NewTopicsListResultPage(cur TopicsListResult, getNextPage func(context.Cont func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } +func PossibleCreatedByTypeValues() []CreatedByType { + return original.PossibleCreatedByTypeValues() +} func PossibleDomainProvisioningStateValues() []DomainProvisioningState { return original.PossibleDomainProvisioningStateValues() } @@ -400,12 +491,18 @@ func PossibleEndpointTypeValues() []EndpointType { func PossibleEventDeliverySchemaValues() []EventDeliverySchema { return original.PossibleEventDeliverySchemaValues() } +func PossibleEventSubscriptionIdentityTypeValues() []EventSubscriptionIdentityType { + return original.PossibleEventSubscriptionIdentityTypeValues() +} func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { return original.PossibleEventSubscriptionProvisioningStateValues() } func PossibleIPActionTypeValues() []IPActionType { return original.PossibleIPActionTypeValues() } +func PossibleIdentityTypeValues() []IdentityType { + return original.PossibleIdentityTypeValues() +} func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { return original.PossibleInputSchemaMappingTypeValues() } @@ -433,6 +530,9 @@ func PossibleTopicProvisioningStateValues() []TopicProvisioningState { func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { return original.PossibleTopicTypeProvisioningStateValues() } +func PossibleTypeValues() []Type { + return original.PossibleTypeValues() +} func UserAgent() string { return original.UserAgent() + " profiles/latest" } diff --git a/profiles/preview/containerservice/mgmt/containerservice/containerserviceapi/models.go b/profiles/preview/containerservice/mgmt/containerservice/containerserviceapi/models.go index 38e14d4827cf..bdcfc9e50d0b 100644 --- a/profiles/preview/containerservice/mgmt/containerservice/containerserviceapi/models.go +++ b/profiles/preview/containerservice/mgmt/containerservice/containerserviceapi/models.go @@ -9,7 +9,7 @@ package containerserviceapi -import original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2021-08-01/containerservice/containerserviceapi" +import original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2021-09-01/containerservice/containerserviceapi" type AgentPoolsClientAPI = original.AgentPoolsClientAPI type MaintenanceConfigurationsClientAPI = original.MaintenanceConfigurationsClientAPI diff --git a/profiles/preview/containerservice/mgmt/containerservice/models.go b/profiles/preview/containerservice/mgmt/containerservice/models.go index 4ac094148ff7..1ecbc0fdd48c 100644 --- a/profiles/preview/containerservice/mgmt/containerservice/models.go +++ b/profiles/preview/containerservice/mgmt/containerservice/models.go @@ -12,7 +12,7 @@ package containerservice import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2021-08-01/containerservice" + original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2021-09-01/containerservice" ) const ( @@ -572,6 +572,7 @@ type TimeInWeek = original.TimeInWeek type TimeSpan = original.TimeSpan type UserAssignedIdentity = original.UserAssignedIdentity type VMDiagnostics = original.VMDiagnostics +type WindowsGmsaProfile = original.WindowsGmsaProfile func New(subscriptionID string) BaseClient { return original.New(subscriptionID) diff --git a/profiles/preview/eventgrid/mgmt/eventgrid/eventgridapi/models.go b/profiles/preview/eventgrid/mgmt/eventgrid/eventgridapi/models.go index 509702cd65e8..a5486251166c 100644 --- a/profiles/preview/eventgrid/mgmt/eventgrid/eventgridapi/models.go +++ b/profiles/preview/eventgrid/mgmt/eventgrid/eventgridapi/models.go @@ -9,13 +9,16 @@ package eventgridapi -import original "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2020-06-01/eventgrid/eventgridapi" +import original "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2021-12-01/eventgrid/eventgridapi" type DomainTopicsClientAPI = original.DomainTopicsClientAPI type DomainsClientAPI = original.DomainsClientAPI type EventSubscriptionsClientAPI = original.EventSubscriptionsClientAPI +type ExtensionTopicsClientAPI = original.ExtensionTopicsClientAPI type OperationsClientAPI = original.OperationsClientAPI type PrivateEndpointConnectionsClientAPI = original.PrivateEndpointConnectionsClientAPI type PrivateLinkResourcesClientAPI = original.PrivateLinkResourcesClientAPI +type SystemTopicEventSubscriptionsClientAPI = original.SystemTopicEventSubscriptionsClientAPI +type SystemTopicsClientAPI = original.SystemTopicsClientAPI type TopicTypesClientAPI = original.TopicTypesClientAPI type TopicsClientAPI = original.TopicsClientAPI diff --git a/profiles/preview/eventgrid/mgmt/eventgrid/models.go b/profiles/preview/eventgrid/mgmt/eventgrid/models.go index c182a8eb12f5..bb7efe7a1c5c 100644 --- a/profiles/preview/eventgrid/mgmt/eventgrid/models.go +++ b/profiles/preview/eventgrid/mgmt/eventgrid/models.go @@ -12,22 +12,31 @@ package eventgrid import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2020-06-01/eventgrid" + original "github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2021-12-01/eventgrid" ) 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 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 @@ -57,16 +66,23 @@ const ( type EndpointTypeBasicDeadLetterDestination = original.EndpointTypeBasicDeadLetterDestination const ( - EndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = original.EndpointTypeDeadLetterDestination - EndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = original.EndpointTypeStorageBlob + EndpointTypeBasicDeadLetterDestinationEndpointTypeDeadLetterDestination EndpointTypeBasicDeadLetterDestination = original.EndpointTypeBasicDeadLetterDestinationEndpointTypeDeadLetterDestination + EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob EndpointTypeBasicDeadLetterDestination = original.EndpointTypeBasicDeadLetterDestinationEndpointTypeStorageBlob ) 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 ( + EventSubscriptionIdentityTypeSystemAssigned EventSubscriptionIdentityType = original.EventSubscriptionIdentityTypeSystemAssigned + EventSubscriptionIdentityTypeUserAssigned EventSubscriptionIdentityType = original.EventSubscriptionIdentityTypeUserAssigned ) type EventSubscriptionProvisioningState = original.EventSubscriptionProvisioningState @@ -84,7 +100,16 @@ const ( type IPActionType = original.IPActionType const ( - Allow IPActionType = original.Allow + IPActionTypeAllow IPActionType = original.IPActionTypeAllow +) + +type IdentityType = original.IdentityType + +const ( + IdentityTypeNone IdentityType = original.IdentityTypeNone + IdentityTypeSystemAssigned IdentityType = original.IdentityTypeSystemAssigned + IdentityTypeSystemAssignedUserAssigned IdentityType = original.IdentityTypeSystemAssignedUserAssigned + IdentityTypeUserAssigned IdentityType = original.IdentityTypeUserAssigned ) type InputSchema = original.InputSchema @@ -123,17 +148,17 @@ const ( 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 ResourceProvisioningState = original.ResourceProvisioningState @@ -150,8 +175,8 @@ const ( type ResourceRegionType = original.ResourceRegionType const ( - GlobalResource ResourceRegionType = original.GlobalResource - RegionalResource ResourceRegionType = original.RegionalResource + ResourceRegionTypeGlobalResource ResourceRegionType = original.ResourceRegionTypeGlobalResource + ResourceRegionTypeRegionalResource ResourceRegionType = original.ResourceRegionTypeRegionalResource ) type TopicProvisioningState = original.TopicProvisioningState @@ -176,17 +201,30 @@ const ( TopicTypeProvisioningStateUpdating TopicTypeProvisioningState = original.TopicTypeProvisioningStateUpdating ) +type Type = original.Type + +const ( + TypeDeliveryAttributeMapping Type = original.TypeDeliveryAttributeMapping + TypeDynamic Type = original.TypeDynamic + TypeStatic Type = original.TypeStatic +) + type AdvancedFilter = original.AdvancedFilter type AzureFunctionEventSubscriptionDestination = original.AzureFunctionEventSubscriptionDestination type AzureFunctionEventSubscriptionDestinationProperties = original.AzureFunctionEventSubscriptionDestinationProperties type BaseClient = original.BaseClient type BasicAdvancedFilter = original.BasicAdvancedFilter type BasicDeadLetterDestination = original.BasicDeadLetterDestination +type BasicDeliveryAttributeMapping = original.BasicDeliveryAttributeMapping type BasicEventSubscriptionDestination = original.BasicEventSubscriptionDestination type BasicInputSchemaMapping = original.BasicInputSchemaMapping type BoolEqualsAdvancedFilter = original.BoolEqualsAdvancedFilter type ConnectionState = original.ConnectionState type DeadLetterDestination = original.DeadLetterDestination +type DeadLetterWithResourceIdentity = original.DeadLetterWithResourceIdentity +type DeliveryAttributeListResult = original.DeliveryAttributeListResult +type DeliveryAttributeMapping = original.DeliveryAttributeMapping +type DeliveryWithResourceIdentity = original.DeliveryWithResourceIdentity type Domain = original.Domain type DomainProperties = original.DomainProperties type DomainRegenerateKeyRequest = original.DomainRegenerateKeyRequest @@ -208,12 +246,15 @@ type DomainsListResult = original.DomainsListResult type DomainsListResultIterator = original.DomainsListResultIterator type DomainsListResultPage = original.DomainsListResultPage type DomainsUpdateFuture = original.DomainsUpdateFuture +type DynamicDeliveryAttributeMapping = original.DynamicDeliveryAttributeMapping +type DynamicDeliveryAttributeMappingProperties = original.DynamicDeliveryAttributeMappingProperties type EventHubEventSubscriptionDestination = original.EventHubEventSubscriptionDestination type EventHubEventSubscriptionDestinationProperties = original.EventHubEventSubscriptionDestinationProperties type EventSubscription = original.EventSubscription type EventSubscriptionDestination = original.EventSubscriptionDestination type EventSubscriptionFilter = original.EventSubscriptionFilter type EventSubscriptionFullURL = original.EventSubscriptionFullURL +type EventSubscriptionIdentity = original.EventSubscriptionIdentity type EventSubscriptionProperties = original.EventSubscriptionProperties type EventSubscriptionUpdateParameters = original.EventSubscriptionUpdateParameters type EventSubscriptionsClient = original.EventSubscriptionsClient @@ -226,8 +267,12 @@ type EventSubscriptionsUpdateFuture = original.EventSubscriptionsUpdateFuture type EventType = original.EventType type EventTypeProperties = original.EventTypeProperties type EventTypesListResult = original.EventTypesListResult +type ExtensionTopic = original.ExtensionTopic +type ExtensionTopicProperties = original.ExtensionTopicProperties +type ExtensionTopicsClient = original.ExtensionTopicsClient type HybridConnectionEventSubscriptionDestination = original.HybridConnectionEventSubscriptionDestination type HybridConnectionEventSubscriptionDestinationProperties = original.HybridConnectionEventSubscriptionDestinationProperties +type IdentityInfo = original.IdentityInfo type InboundIPRule = original.InboundIPRule type InputSchemaMapping = original.InputSchemaMapping type JSONField = original.JSONField @@ -265,6 +310,8 @@ type ServiceBusQueueEventSubscriptionDestination = original.ServiceBusQueueEvent type ServiceBusQueueEventSubscriptionDestinationProperties = original.ServiceBusQueueEventSubscriptionDestinationProperties type ServiceBusTopicEventSubscriptionDestination = original.ServiceBusTopicEventSubscriptionDestination type ServiceBusTopicEventSubscriptionDestinationProperties = original.ServiceBusTopicEventSubscriptionDestinationProperties +type StaticDeliveryAttributeMapping = original.StaticDeliveryAttributeMapping +type StaticDeliveryAttributeMappingProperties = original.StaticDeliveryAttributeMappingProperties type StorageBlobDeadLetterDestination = original.StorageBlobDeadLetterDestination type StorageBlobDeadLetterDestinationProperties = original.StorageBlobDeadLetterDestinationProperties type StorageQueueEventSubscriptionDestination = original.StorageQueueEventSubscriptionDestination @@ -274,6 +321,21 @@ type StringContainsAdvancedFilter = original.StringContainsAdvancedFilter type StringEndsWithAdvancedFilter = original.StringEndsWithAdvancedFilter type StringInAdvancedFilter = original.StringInAdvancedFilter type StringNotInAdvancedFilter = original.StringNotInAdvancedFilter +type SystemData = original.SystemData +type SystemTopic = original.SystemTopic +type SystemTopicEventSubscriptionsClient = original.SystemTopicEventSubscriptionsClient +type SystemTopicEventSubscriptionsCreateOrUpdateFuture = original.SystemTopicEventSubscriptionsCreateOrUpdateFuture +type SystemTopicEventSubscriptionsDeleteFuture = original.SystemTopicEventSubscriptionsDeleteFuture +type SystemTopicEventSubscriptionsUpdateFuture = original.SystemTopicEventSubscriptionsUpdateFuture +type SystemTopicProperties = original.SystemTopicProperties +type SystemTopicUpdateParameters = original.SystemTopicUpdateParameters +type SystemTopicsClient = original.SystemTopicsClient +type SystemTopicsCreateOrUpdateFuture = original.SystemTopicsCreateOrUpdateFuture +type SystemTopicsDeleteFuture = original.SystemTopicsDeleteFuture +type SystemTopicsListResult = original.SystemTopicsListResult +type SystemTopicsListResultIterator = original.SystemTopicsListResultIterator +type SystemTopicsListResultPage = original.SystemTopicsListResultPage +type SystemTopicsUpdateFuture = original.SystemTopicsUpdateFuture type Topic = original.Topic type TopicProperties = original.TopicProperties type TopicRegenerateKeyRequest = original.TopicRegenerateKeyRequest @@ -290,8 +352,10 @@ type TopicsDeleteFuture = original.TopicsDeleteFuture type TopicsListResult = original.TopicsListResult type TopicsListResultIterator = original.TopicsListResultIterator type TopicsListResultPage = original.TopicsListResultPage +type TopicsRegenerateKeyFuture = original.TopicsRegenerateKeyFuture type TopicsUpdateFuture = original.TopicsUpdateFuture type TrackedResource = original.TrackedResource +type UserIdentityProperties = original.UserIdentityProperties type WebHookEventSubscriptionDestination = original.WebHookEventSubscriptionDestination type WebHookEventSubscriptionDestinationProperties = original.WebHookEventSubscriptionDestinationProperties @@ -334,6 +398,12 @@ func NewEventSubscriptionsListResultIterator(page EventSubscriptionsListResultPa func NewEventSubscriptionsListResultPage(cur EventSubscriptionsListResult, getNextPage func(context.Context, EventSubscriptionsListResult) (EventSubscriptionsListResult, error)) EventSubscriptionsListResultPage { return original.NewEventSubscriptionsListResultPage(cur, getNextPage) } +func NewExtensionTopicsClient(subscriptionID string) ExtensionTopicsClient { + return original.NewExtensionTopicsClient(subscriptionID) +} +func NewExtensionTopicsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTopicsClient { + return original.NewExtensionTopicsClientWithBaseURI(baseURI, subscriptionID) +} func NewOperationsClient(subscriptionID string) OperationsClient { return original.NewOperationsClient(subscriptionID) } @@ -364,6 +434,24 @@ func NewPrivateLinkResourcesListResultIterator(page PrivateLinkResourcesListResu func NewPrivateLinkResourcesListResultPage(cur PrivateLinkResourcesListResult, getNextPage func(context.Context, PrivateLinkResourcesListResult) (PrivateLinkResourcesListResult, error)) PrivateLinkResourcesListResultPage { return original.NewPrivateLinkResourcesListResultPage(cur, getNextPage) } +func NewSystemTopicEventSubscriptionsClient(subscriptionID string) SystemTopicEventSubscriptionsClient { + return original.NewSystemTopicEventSubscriptionsClient(subscriptionID) +} +func NewSystemTopicEventSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SystemTopicEventSubscriptionsClient { + return original.NewSystemTopicEventSubscriptionsClientWithBaseURI(baseURI, subscriptionID) +} +func NewSystemTopicsClient(subscriptionID string) SystemTopicsClient { + return original.NewSystemTopicsClient(subscriptionID) +} +func NewSystemTopicsClientWithBaseURI(baseURI string, subscriptionID string) SystemTopicsClient { + return original.NewSystemTopicsClientWithBaseURI(baseURI, subscriptionID) +} +func NewSystemTopicsListResultIterator(page SystemTopicsListResultPage) SystemTopicsListResultIterator { + return original.NewSystemTopicsListResultIterator(page) +} +func NewSystemTopicsListResultPage(cur SystemTopicsListResult, getNextPage func(context.Context, SystemTopicsListResult) (SystemTopicsListResult, error)) SystemTopicsListResultPage { + return original.NewSystemTopicsListResultPage(cur, getNextPage) +} func NewTopicTypesClient(subscriptionID string) TopicTypesClient { return original.NewTopicTypesClient(subscriptionID) } @@ -385,6 +473,9 @@ func NewTopicsListResultPage(cur TopicsListResult, getNextPage func(context.Cont func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } +func PossibleCreatedByTypeValues() []CreatedByType { + return original.PossibleCreatedByTypeValues() +} func PossibleDomainProvisioningStateValues() []DomainProvisioningState { return original.PossibleDomainProvisioningStateValues() } @@ -400,12 +491,18 @@ func PossibleEndpointTypeValues() []EndpointType { func PossibleEventDeliverySchemaValues() []EventDeliverySchema { return original.PossibleEventDeliverySchemaValues() } +func PossibleEventSubscriptionIdentityTypeValues() []EventSubscriptionIdentityType { + return original.PossibleEventSubscriptionIdentityTypeValues() +} func PossibleEventSubscriptionProvisioningStateValues() []EventSubscriptionProvisioningState { return original.PossibleEventSubscriptionProvisioningStateValues() } func PossibleIPActionTypeValues() []IPActionType { return original.PossibleIPActionTypeValues() } +func PossibleIdentityTypeValues() []IdentityType { + return original.PossibleIdentityTypeValues() +} func PossibleInputSchemaMappingTypeValues() []InputSchemaMappingType { return original.PossibleInputSchemaMappingTypeValues() } @@ -433,6 +530,9 @@ func PossibleTopicProvisioningStateValues() []TopicProvisioningState { func PossibleTopicTypeProvisioningStateValues() []TopicTypeProvisioningState { return original.PossibleTopicTypeProvisioningStateValues() } +func PossibleTypeValues() []Type { + return original.PossibleTypeValues() +} func UserAgent() string { return original.UserAgent() + " profiles/preview" } diff --git a/profiles/preview/preview/containerregistry/mgmt/containerregistry/containerregistryapi/models.go b/profiles/preview/preview/containerregistry/mgmt/containerregistry/containerregistryapi/models.go index 245ea8020272..f0b6a06378a3 100644 --- a/profiles/preview/preview/containerregistry/mgmt/containerregistry/containerregistryapi/models.go +++ b/profiles/preview/preview/containerregistry/mgmt/containerregistry/containerregistryapi/models.go @@ -9,7 +9,7 @@ package containerregistryapi -import original "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/containerregistryapi" +import original "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/containerregistryapi" type AgentPoolsClientAPI = original.AgentPoolsClientAPI type ConnectedRegistriesClientAPI = original.ConnectedRegistriesClientAPI diff --git a/profiles/preview/preview/containerregistry/mgmt/containerregistry/models.go b/profiles/preview/preview/containerregistry/mgmt/containerregistry/models.go index 949596e1d608..2cc92d5fa2ba 100644 --- a/profiles/preview/preview/containerregistry/mgmt/containerregistry/models.go +++ b/profiles/preview/preview/containerregistry/mgmt/containerregistry/models.go @@ -12,7 +12,7 @@ package containerregistry import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry" + original "github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry" ) const ( @@ -22,58 +22,58 @@ const ( type Action = original.Action const ( - Allow Action = original.Allow + ActionAllow Action = original.ActionAllow ) type ActionsRequired = original.ActionsRequired const ( - None ActionsRequired = original.None - Recreate ActionsRequired = original.Recreate + ActionsRequiredNone ActionsRequired = original.ActionsRequiredNone + ActionsRequiredRecreate ActionsRequired = original.ActionsRequiredRecreate ) type ActivationStatus = original.ActivationStatus const ( - Active ActivationStatus = original.Active - Inactive ActivationStatus = original.Inactive + ActivationStatusActive ActivationStatus = original.ActivationStatusActive + ActivationStatusInactive ActivationStatus = original.ActivationStatusInactive ) type Architecture = original.Architecture const ( - Amd64 Architecture = original.Amd64 - Arm Architecture = original.Arm - Arm64 Architecture = original.Arm64 - ThreeEightSix Architecture = original.ThreeEightSix - X86 Architecture = original.X86 + ArchitectureAmd64 Architecture = original.ArchitectureAmd64 + ArchitectureArm Architecture = original.ArchitectureArm + ArchitectureArm64 Architecture = original.ArchitectureArm64 + ArchitectureThreeEightSix Architecture = original.ArchitectureThreeEightSix + ArchitectureX86 Architecture = original.ArchitectureX86 ) type AuditLogStatus = original.AuditLogStatus const ( - Disabled AuditLogStatus = original.Disabled - Enabled AuditLogStatus = original.Enabled + AuditLogStatusDisabled AuditLogStatus = original.AuditLogStatusDisabled + AuditLogStatusEnabled AuditLogStatus = original.AuditLogStatusEnabled ) type BaseImageDependencyType = original.BaseImageDependencyType const ( - BuildTime BaseImageDependencyType = original.BuildTime - RunTime BaseImageDependencyType = original.RunTime + BaseImageDependencyTypeBuildTime BaseImageDependencyType = original.BaseImageDependencyTypeBuildTime + BaseImageDependencyTypeRunTime BaseImageDependencyType = original.BaseImageDependencyTypeRunTime ) type BaseImageTriggerType = original.BaseImageTriggerType const ( - All BaseImageTriggerType = original.All - Runtime BaseImageTriggerType = original.Runtime + BaseImageTriggerTypeAll BaseImageTriggerType = original.BaseImageTriggerTypeAll + BaseImageTriggerTypeRuntime BaseImageTriggerType = original.BaseImageTriggerTypeRuntime ) type CertificateType = original.CertificateType const ( - LocalDirectory CertificateType = original.LocalDirectory + CertificateTypeLocalDirectory CertificateType = original.CertificateTypeLocalDirectory ) type ConnectedRegistryMode = original.ConnectedRegistryMode @@ -86,28 +86,28 @@ const ( type ConnectionState = original.ConnectionState const ( - Offline ConnectionState = original.Offline - Online ConnectionState = original.Online - Syncing ConnectionState = original.Syncing - Unhealthy ConnectionState = original.Unhealthy + ConnectionStateOffline ConnectionState = original.ConnectionStateOffline + ConnectionStateOnline ConnectionState = original.ConnectionStateOnline + ConnectionStateSyncing ConnectionState = original.ConnectionStateSyncing + ConnectionStateUnhealthy ConnectionState = original.ConnectionStateUnhealthy ) type ConnectionStatus = original.ConnectionStatus const ( - Approved ConnectionStatus = original.Approved - Disconnected ConnectionStatus = original.Disconnected - Pending ConnectionStatus = original.Pending - Rejected ConnectionStatus = original.Rejected + ConnectionStatusApproved ConnectionStatus = original.ConnectionStatusApproved + ConnectionStatusDisconnected ConnectionStatus = original.ConnectionStatusDisconnected + ConnectionStatusPending ConnectionStatus = original.ConnectionStatusPending + ConnectionStatusRejected ConnectionStatus = original.ConnectionStatusRejected ) 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 DefaultAction = original.DefaultAction @@ -124,11 +124,18 @@ const ( EncryptionStatusEnabled EncryptionStatus = original.EncryptionStatusEnabled ) +type ExportPolicyStatus = original.ExportPolicyStatus + +const ( + ExportPolicyStatusDisabled ExportPolicyStatus = original.ExportPolicyStatusDisabled + ExportPolicyStatusEnabled ExportPolicyStatus = original.ExportPolicyStatusEnabled +) + type ImportMode = original.ImportMode const ( - Force ImportMode = original.Force - NoForce ImportMode = original.NoForce + ImportModeForce ImportMode = original.ImportModeForce + ImportModeNoForce ImportMode = original.ImportModeNoForce ) type LastModifiedByType = original.LastModifiedByType @@ -160,30 +167,30 @@ const ( type OS = original.OS const ( - Linux OS = original.Linux - Windows OS = original.Windows + OSLinux OS = original.OSLinux + OSWindows OS = original.OSWindows ) type PasswordName = original.PasswordName const ( - Password PasswordName = original.Password - Password2 PasswordName = original.Password2 + PasswordNamePassword PasswordName = original.PasswordNamePassword + PasswordNamePassword2 PasswordName = original.PasswordNamePassword2 ) type PipelineOptions = original.PipelineOptions const ( - ContinueOnErrors PipelineOptions = original.ContinueOnErrors - DeleteSourceBlobOnSuccess PipelineOptions = original.DeleteSourceBlobOnSuccess - OverwriteBlobs PipelineOptions = original.OverwriteBlobs - OverwriteTags PipelineOptions = original.OverwriteTags + PipelineOptionsContinueOnErrors PipelineOptions = original.PipelineOptionsContinueOnErrors + PipelineOptionsDeleteSourceBlobOnSuccess PipelineOptions = original.PipelineOptionsDeleteSourceBlobOnSuccess + PipelineOptionsOverwriteBlobs PipelineOptions = original.PipelineOptionsOverwriteBlobs + PipelineOptionsOverwriteTags PipelineOptions = original.PipelineOptionsOverwriteTags ) type PipelineRunSourceType = original.PipelineRunSourceType const ( - AzureStorageBlob PipelineRunSourceType = original.AzureStorageBlob + PipelineRunSourceTypeAzureStorageBlob PipelineRunSourceType = original.PipelineRunSourceTypeAzureStorageBlob ) type PipelineRunTargetType = original.PipelineRunTargetType @@ -195,7 +202,7 @@ const ( type PipelineSourceType = original.PipelineSourceType const ( - AzureStorageBlobContainer PipelineSourceType = original.AzureStorageBlobContainer + PipelineSourceTypeAzureStorageBlobContainer PipelineSourceType = original.PipelineSourceTypeAzureStorageBlobContainer ) type PolicyStatus = original.PolicyStatus @@ -208,12 +215,12 @@ const ( type ProvisioningState = original.ProvisioningState const ( - Canceled ProvisioningState = original.Canceled - Creating ProvisioningState = original.Creating - Deleting ProvisioningState = original.Deleting - Failed ProvisioningState = original.Failed - Succeeded ProvisioningState = original.Succeeded - Updating ProvisioningState = original.Updating + ProvisioningStateCanceled ProvisioningState = original.ProvisioningStateCanceled + ProvisioningStateCreating ProvisioningState = original.ProvisioningStateCreating + ProvisioningStateDeleting ProvisioningState = original.ProvisioningStateDeleting + ProvisioningStateFailed ProvisioningState = original.ProvisioningStateFailed + ProvisioningStateSucceeded ProvisioningState = original.ProvisioningStateSucceeded + ProvisioningStateUpdating ProvisioningState = original.ProvisioningStateUpdating ) type PublicNetworkAccess = original.PublicNetworkAccess @@ -226,8 +233,8 @@ const ( type RegistryUsageUnit = original.RegistryUsageUnit const ( - Bytes RegistryUsageUnit = original.Bytes - Count RegistryUsageUnit = original.Count + RegistryUsageUnitBytes RegistryUsageUnit = original.RegistryUsageUnitBytes + RegistryUsageUnitCount RegistryUsageUnit = original.RegistryUsageUnitCount ) type ResourceIdentityType = original.ResourceIdentityType @@ -255,26 +262,26 @@ const ( type RunType = original.RunType const ( - AutoBuild RunType = original.AutoBuild - AutoRun RunType = original.AutoRun - QuickBuild RunType = original.QuickBuild - QuickRun RunType = original.QuickRun + RunTypeAutoBuild RunType = original.RunTypeAutoBuild + RunTypeAutoRun RunType = original.RunTypeAutoRun + RunTypeQuickBuild RunType = original.RunTypeQuickBuild + RunTypeQuickRun RunType = original.RunTypeQuickRun ) type SecretObjectType = original.SecretObjectType const ( - Opaque SecretObjectType = original.Opaque - Vaultsecret SecretObjectType = original.Vaultsecret + SecretObjectTypeOpaque SecretObjectType = original.SecretObjectTypeOpaque + SecretObjectTypeVaultsecret SecretObjectType = original.SecretObjectTypeVaultsecret ) type SkuName = original.SkuName const ( - Basic SkuName = original.Basic - Classic SkuName = original.Classic - Premium SkuName = original.Premium - Standard SkuName = original.Standard + SkuNameBasic SkuName = original.SkuNameBasic + SkuNameClassic SkuName = original.SkuNameClassic + SkuNamePremium SkuName = original.SkuNamePremium + SkuNameStandard SkuName = original.SkuNameStandard ) type SkuTier = original.SkuTier @@ -289,8 +296,8 @@ const ( type SourceControlType = original.SourceControlType const ( - Github SourceControlType = original.Github - VisualStudioTeamService SourceControlType = original.VisualStudioTeamService + SourceControlTypeGithub SourceControlType = original.SourceControlTypeGithub + SourceControlTypeVisualStudioTeamService SourceControlType = original.SourceControlTypeVisualStudioTeamService ) type SourceRegistryLoginMode = original.SourceRegistryLoginMode @@ -303,8 +310,8 @@ const ( type SourceTriggerEvent = original.SourceTriggerEvent const ( - Commit SourceTriggerEvent = original.Commit - Pullrequest SourceTriggerEvent = original.Pullrequest + SourceTriggerEventCommit SourceTriggerEvent = original.SourceTriggerEventCommit + SourceTriggerEventPullrequest SourceTriggerEvent = original.SourceTriggerEventPullrequest ) type TLSStatus = original.TLSStatus @@ -324,8 +331,8 @@ const ( type TokenCertificateName = original.TokenCertificateName const ( - Certificate1 TokenCertificateName = original.Certificate1 - Certificate2 TokenCertificateName = original.Certificate2 + TokenCertificateNameCertificate1 TokenCertificateName = original.TokenCertificateNameCertificate1 + TokenCertificateNameCertificate2 TokenCertificateName = original.TokenCertificateNameCertificate2 ) type TokenPasswordName = original.TokenPasswordName @@ -345,8 +352,8 @@ const ( type TokenType = original.TokenType const ( - OAuth TokenType = original.OAuth - PAT TokenType = original.PAT + TokenTypeOAuth TokenType = original.TokenTypeOAuth + TokenTypePAT TokenType = original.TokenTypePAT ) type TriggerStatus = original.TriggerStatus @@ -359,7 +366,7 @@ const ( type TrustPolicyType = original.TrustPolicyType const ( - Notary TrustPolicyType = original.Notary + TrustPolicyTypeNotary TrustPolicyType = original.TrustPolicyTypeNotary ) type Type = original.Type @@ -375,10 +382,10 @@ const ( type TypeBasicTaskStepProperties = original.TypeBasicTaskStepProperties const ( - TypeDocker TypeBasicTaskStepProperties = original.TypeDocker - TypeEncodedTask TypeBasicTaskStepProperties = original.TypeEncodedTask - TypeFileTask TypeBasicTaskStepProperties = original.TypeFileTask - TypeTaskStepProperties TypeBasicTaskStepProperties = original.TypeTaskStepProperties + TypeBasicTaskStepPropertiesTypeDocker TypeBasicTaskStepProperties = original.TypeBasicTaskStepPropertiesTypeDocker + TypeBasicTaskStepPropertiesTypeEncodedTask TypeBasicTaskStepProperties = original.TypeBasicTaskStepPropertiesTypeEncodedTask + TypeBasicTaskStepPropertiesTypeFileTask TypeBasicTaskStepProperties = original.TypeBasicTaskStepPropertiesTypeFileTask + TypeBasicTaskStepPropertiesTypeTaskStepProperties TypeBasicTaskStepProperties = original.TypeBasicTaskStepPropertiesTypeTaskStepProperties ) type TypeBasicTaskStepUpdateParameters = original.TypeBasicTaskStepUpdateParameters @@ -400,19 +407,19 @@ const ( type Variant = original.Variant const ( - V6 Variant = original.V6 - V7 Variant = original.V7 - V8 Variant = original.V8 + VariantV6 Variant = original.VariantV6 + VariantV7 Variant = original.VariantV7 + VariantV8 Variant = original.VariantV8 ) type WebhookAction = original.WebhookAction const ( - ChartDelete WebhookAction = original.ChartDelete - ChartPush WebhookAction = original.ChartPush - Delete WebhookAction = original.Delete - Push WebhookAction = original.Push - Quarantine WebhookAction = original.Quarantine + WebhookActionChartDelete WebhookAction = original.WebhookActionChartDelete + WebhookActionChartPush WebhookAction = original.WebhookActionChartPush + WebhookActionDelete WebhookAction = original.WebhookActionDelete + WebhookActionPush WebhookAction = original.WebhookActionPush + WebhookActionQuarantine WebhookAction = original.WebhookActionQuarantine ) type WebhookStatus = original.WebhookStatus @@ -496,6 +503,7 @@ type ExportPipelineTargetProperties = original.ExportPipelineTargetProperties type ExportPipelinesClient = original.ExportPipelinesClient type ExportPipelinesCreateFuture = original.ExportPipelinesCreateFuture type ExportPipelinesDeleteFuture = original.ExportPipelinesDeleteFuture +type ExportPolicy = original.ExportPolicy type FileTaskRunRequest = original.FileTaskRunRequest type FileTaskStep = original.FileTaskStep type FileTaskStepUpdateParameters = original.FileTaskStepUpdateParameters @@ -527,6 +535,7 @@ type OperationDisplayDefinition = original.OperationDisplayDefinition type OperationListResult = original.OperationListResult type OperationListResultIterator = original.OperationListResultIterator type OperationListResultPage = original.OperationListResultPage +type OperationLogSpecificationDefinition = original.OperationLogSpecificationDefinition type OperationMetricSpecificationDefinition = original.OperationMetricSpecificationDefinition type OperationPropertiesDefinition = original.OperationPropertiesDefinition type OperationServiceSpecificationDefinition = original.OperationServiceSpecificationDefinition @@ -641,7 +650,6 @@ type SourceUpdateParameters = original.SourceUpdateParameters type SourceUploadDefinition = original.SourceUploadDefinition type Status = original.Status type StatusDetailProperties = original.StatusDetailProperties -type StorageAccountProperties = original.StorageAccountProperties type SyncProperties = original.SyncProperties type SyncUpdateProperties = original.SyncUpdateProperties type SystemData = original.SystemData @@ -949,6 +957,9 @@ func PossibleDefaultActionValues() []DefaultAction { func PossibleEncryptionStatusValues() []EncryptionStatus { return original.PossibleEncryptionStatusValues() } +func PossibleExportPolicyStatusValues() []ExportPolicyStatus { + return original.PossibleExportPolicyStatusValues() +} func PossibleImportModeValues() []ImportMode { return original.PossibleImportModeValues() } diff --git a/services/containerservice/mgmt/2021-09-01/containerservice/CHANGELOG.md b/services/containerservice/mgmt/2021-09-01/containerservice/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/containerservice/mgmt/2021-09-01/containerservice/_meta.json b/services/containerservice/mgmt/2021-09-01/containerservice/_meta.json new file mode 100644 index 000000000000..37295af7f2e1 --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "769e09cac92c50b1f9fa6468775b7cb7de16bb06", + "readme": "/_/azure-rest-api-specs/specification/containerservice/resource-manager/readme.md", + "tag": "package-2021-09", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-09 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/containerservice/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/containerservice/mgmt/2021-09-01/containerservice/agentpools.go b/services/containerservice/mgmt/2021-09-01/containerservice/agentpools.go new file mode 100644 index 000000000000..4663f0112cea --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/agentpools.go @@ -0,0 +1,708 @@ +package containerservice + +// 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" +) + +// AgentPoolsClient is the the Container Service Client. +type AgentPoolsClient struct { + BaseClient +} + +// NewAgentPoolsClient creates an instance of the AgentPoolsClient client. +func NewAgentPoolsClient(subscriptionID string) AgentPoolsClient { + return NewAgentPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAgentPoolsClientWithBaseURI creates an instance of the AgentPoolsClient 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 NewAgentPoolsClientWithBaseURI(baseURI string, subscriptionID string) AgentPoolsClient { + return AgentPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +// parameters - the agent pool to create or update. +func (client AgentPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool) (result AgentPoolsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ManagedClusterAgentPoolProfileProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterAgentPoolProfileProperties.KubeletConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterAgentPoolProfileProperties.KubeletConfig.ContainerLogMaxFiles", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterAgentPoolProfileProperties.KubeletConfig.ContainerLogMaxFiles", Name: validation.InclusiveMinimum, Rule: int64(2), Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, agentPoolName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AgentPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) CreateOrUpdateSender(req *http.Request) (future AgentPoolsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result AgentPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AgentPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) DeleteSender(req *http.Request) (future AgentPoolsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AgentPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) 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 AgentPoolsClient) GetResponder(resp *http.Response) (result AgentPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAvailableAgentPoolVersions see [supported Kubernetes +// versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version +// lifecycle. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolAvailableVersions, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetAvailableAgentPoolVersions") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", err.Error()) + } + + req, err := client.GetAvailableAgentPoolVersionsPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", nil, "Failure preparing request") + return + } + + resp, err := client.GetAvailableAgentPoolVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", resp, "Failure sending request") + return + } + + result, err = client.GetAvailableAgentPoolVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", resp, "Failure responding to request") + return + } + + return +} + +// GetAvailableAgentPoolVersionsPreparer prepares the GetAvailableAgentPoolVersions request. +func (client AgentPoolsClient) GetAvailableAgentPoolVersionsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAvailableAgentPoolVersionsSender sends the GetAvailableAgentPoolVersions request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) GetAvailableAgentPoolVersionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAvailableAgentPoolVersionsResponder handles the response to the GetAvailableAgentPoolVersions request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) GetAvailableAgentPoolVersionsResponder(resp *http.Response) (result AgentPoolAvailableVersions, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetUpgradeProfile sends the get upgrade profile request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolUpgradeProfile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetUpgradeProfile") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "GetUpgradeProfile", err.Error()) + } + + req, err := client.GetUpgradeProfilePreparer(ctx, resourceGroupName, resourceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetUpgradeProfile", nil, "Failure preparing request") + return + } + + resp, err := client.GetUpgradeProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetUpgradeProfile", resp, "Failure sending request") + return + } + + result, err = client.GetUpgradeProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetUpgradeProfile", resp, "Failure responding to request") + return + } + + return +} + +// GetUpgradeProfilePreparer prepares the GetUpgradeProfile request. +func (client AgentPoolsClient) GetUpgradeProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetUpgradeProfileSender sends the GetUpgradeProfile request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) GetUpgradeProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetUpgradeProfileResponder handles the response to the GetUpgradeProfile request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) GetUpgradeProfileResponder(resp *http.Response) (result AgentPoolUpgradeProfile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client AgentPoolsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.List") + defer func() { + sc := -1 + if result.aplr.Response.Response != nil { + sc = result.aplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "List", resp, "Failure sending request") + return + } + + result.aplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "List", resp, "Failure responding to request") + return + } + if result.aplr.hasNextLink() && result.aplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AgentPoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", 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 AgentPoolsClient) 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 AgentPoolsClient) ListResponder(resp *http.Response) (result AgentPoolListResult, 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 AgentPoolsClient) listNextResults(ctx context.Context, lastResults AgentPoolListResult) (result AgentPoolListResult, err error) { + req, err := lastResults.agentPoolListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "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, "containerservice.AgentPoolsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AgentPoolsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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, resourceName) + return +} + +// UpgradeNodeImageVersion upgrading the node image version of an agent pool applies the newest OS and runtime updates +// to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, +// see: https://docs.microsoft.com/azure/aks/node-image-upgrade +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) UpgradeNodeImageVersion(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolsUpgradeNodeImageVersionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.UpgradeNodeImageVersion") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "UpgradeNodeImageVersion", err.Error()) + } + + req, err := client.UpgradeNodeImageVersionPreparer(ctx, resourceGroupName, resourceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "UpgradeNodeImageVersion", nil, "Failure preparing request") + return + } + + result, err = client.UpgradeNodeImageVersionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "UpgradeNodeImageVersion", result.Response(), "Failure sending request") + return + } + + return +} + +// UpgradeNodeImageVersionPreparer prepares the UpgradeNodeImageVersion request. +func (client AgentPoolsClient) UpgradeNodeImageVersionPreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpgradeNodeImageVersionSender sends the UpgradeNodeImageVersion request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) UpgradeNodeImageVersionSender(req *http.Request) (future AgentPoolsUpgradeNodeImageVersionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpgradeNodeImageVersionResponder handles the response to the UpgradeNodeImageVersion request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) UpgradeNodeImageVersionResponder(resp *http.Response) (result AgentPool, 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/containerservice/mgmt/2021-09-01/containerservice/client.go b/services/containerservice/mgmt/2021-09-01/containerservice/client.go new file mode 100644 index 000000000000..80a831d99be7 --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/client.go @@ -0,0 +1,41 @@ +// Package containerservice implements the Azure ARM Containerservice service API version 2021-09-01. +// +// The Container Service Client. +package containerservice + +// 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 Containerservice + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Containerservice. +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/containerservice/mgmt/2021-09-01/containerservice/containerserviceapi/interfaces.go b/services/containerservice/mgmt/2021-09-01/containerservice/containerserviceapi/interfaces.go new file mode 100644 index 000000000000..99e305ae2a80 --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/containerserviceapi/interfaces.go @@ -0,0 +1,112 @@ +package containerserviceapi + +// 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/containerservice/mgmt/2021-09-01/containerservice" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result containerservice.OperationListResult, err error) +} + +var _ OperationsClientAPI = (*containerservice.OperationsClient)(nil) + +// ManagedClustersClientAPI contains the set of methods on the ManagedClustersClient type. +type ManagedClustersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.ManagedCluster) (result containerservice.ManagedClustersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClustersDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedCluster, err error) + GetAccessProfile(ctx context.Context, resourceGroupName string, resourceName string, roleName string) (result containerservice.ManagedClusterAccessProfile, err error) + GetCommandResult(ctx context.Context, resourceGroupName string, resourceName string, commandID string) (result containerservice.RunCommandResult, err error) + GetOSOptions(ctx context.Context, location string, resourceType string) (result containerservice.OSOptionProfile, err error) + GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClusterUpgradeProfile, err error) + List(ctx context.Context) (result containerservice.ManagedClusterListResultPage, err error) + ListComplete(ctx context.Context) (result containerservice.ManagedClusterListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerservice.ManagedClusterListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerservice.ManagedClusterListResultIterator, err error) + ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result containerservice.CredentialResults, err error) + ListClusterMonitoringUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result containerservice.CredentialResults, err error) + ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result containerservice.CredentialResults, err error) + ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.OutboundEnvironmentEndpointCollectionPage, err error) + ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.OutboundEnvironmentEndpointCollectionIterator, err error) + ResetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.ManagedClusterAADProfile) (result containerservice.ManagedClustersResetAADProfileFuture, err error) + ResetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.ManagedClusterServicePrincipalProfile) (result containerservice.ManagedClustersResetServicePrincipalProfileFuture, err error) + RotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClustersRotateClusterCertificatesFuture, err error) + RunCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload containerservice.RunCommandRequest) (result containerservice.ManagedClustersRunCommandFuture, err error) + Start(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClustersStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClustersStopFuture, err error) + UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.TagsObject) (result containerservice.ManagedClustersUpdateTagsFuture, err error) +} + +var _ ManagedClustersClientAPI = (*containerservice.ManagedClustersClient)(nil) + +// MaintenanceConfigurationsClientAPI contains the set of methods on the MaintenanceConfigurationsClient type. +type MaintenanceConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters containerservice.MaintenanceConfiguration) (result containerservice.MaintenanceConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result containerservice.MaintenanceConfiguration, err error) + ListByManagedCluster(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.MaintenanceConfigurationListResultPage, err error) + ListByManagedClusterComplete(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.MaintenanceConfigurationListResultIterator, err error) +} + +var _ MaintenanceConfigurationsClientAPI = (*containerservice.MaintenanceConfigurationsClient)(nil) + +// AgentPoolsClientAPI contains the set of methods on the AgentPoolsClient type. +type AgentPoolsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters containerservice.AgentPool) (result containerservice.AgentPoolsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result containerservice.AgentPoolsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result containerservice.AgentPool, err error) + GetAvailableAgentPoolVersions(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.AgentPoolAvailableVersions, err error) + GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result containerservice.AgentPoolUpgradeProfile, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.AgentPoolListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.AgentPoolListResultIterator, err error) + UpgradeNodeImageVersion(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result containerservice.AgentPoolsUpgradeNodeImageVersionFuture, err error) +} + +var _ AgentPoolsClientAPI = (*containerservice.AgentPoolsClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result containerservice.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result containerservice.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.PrivateEndpointConnectionListResult, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters containerservice.PrivateEndpointConnection) (result containerservice.PrivateEndpointConnection, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*containerservice.PrivateEndpointConnectionsClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + List(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.PrivateLinkResourcesListResult, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*containerservice.PrivateLinkResourcesClient)(nil) + +// ResolvePrivateLinkServiceIDClientAPI contains the set of methods on the ResolvePrivateLinkServiceIDClient type. +type ResolvePrivateLinkServiceIDClientAPI interface { + POST(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.PrivateLinkResource) (result containerservice.PrivateLinkResource, err error) +} + +var _ ResolvePrivateLinkServiceIDClientAPI = (*containerservice.ResolvePrivateLinkServiceIDClient)(nil) + +// SnapshotsClientAPI contains the set of methods on the SnapshotsClient type. +type SnapshotsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.Snapshot) (result containerservice.Snapshot, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.Snapshot, err error) + List(ctx context.Context) (result containerservice.SnapshotListResultPage, err error) + ListComplete(ctx context.Context) (result containerservice.SnapshotListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerservice.SnapshotListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerservice.SnapshotListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.TagsObject) (result containerservice.Snapshot, err error) +} + +var _ SnapshotsClientAPI = (*containerservice.SnapshotsClient)(nil) diff --git a/services/containerservice/mgmt/2021-09-01/containerservice/enums.go b/services/containerservice/mgmt/2021-09-01/containerservice/enums.go new file mode 100644 index 000000000000..df97741019e9 --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/enums.go @@ -0,0 +1,948 @@ +package containerservice + +// 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. + +// AgentPoolMode enumerates the values for agent pool mode. +type AgentPoolMode string + +const ( + // AgentPoolModeSystem System agent pools are primarily for hosting critical system pods such as CoreDNS + // and metrics-server. System agent pools osType must be Linux. System agent pools VM SKU must have at + // least 2vCPUs and 4GB of memory. + AgentPoolModeSystem AgentPoolMode = "System" + // AgentPoolModeUser User agent pools are primarily for hosting your application pods. + AgentPoolModeUser AgentPoolMode = "User" +) + +// PossibleAgentPoolModeValues returns an array of possible values for the AgentPoolMode const type. +func PossibleAgentPoolModeValues() []AgentPoolMode { + return []AgentPoolMode{AgentPoolModeSystem, AgentPoolModeUser} +} + +// AgentPoolType enumerates the values for agent pool type. +type AgentPoolType string + +const ( + // AgentPoolTypeAvailabilitySet Use of this is strongly discouraged. + AgentPoolTypeAvailabilitySet AgentPoolType = "AvailabilitySet" + // AgentPoolTypeVirtualMachineScaleSets Create an Agent Pool backed by a Virtual Machine Scale Set. + AgentPoolTypeVirtualMachineScaleSets AgentPoolType = "VirtualMachineScaleSets" +) + +// PossibleAgentPoolTypeValues returns an array of possible values for the AgentPoolType const type. +func PossibleAgentPoolTypeValues() []AgentPoolType { + return []AgentPoolType{AgentPoolTypeAvailabilitySet, AgentPoolTypeVirtualMachineScaleSets} +} + +// Code enumerates the values for code. +type Code string + +const ( + // CodeRunning The cluster is running. + CodeRunning Code = "Running" + // CodeStopped The cluster is stopped. + CodeStopped Code = "Stopped" +) + +// PossibleCodeValues returns an array of possible values for the Code const type. +func PossibleCodeValues() []Code { + return []Code{CodeRunning, CodeStopped} +} + +// ConnectionStatus enumerates the values for connection status. +type ConnectionStatus string + +const ( + // ConnectionStatusApproved ... + ConnectionStatusApproved ConnectionStatus = "Approved" + // ConnectionStatusDisconnected ... + ConnectionStatusDisconnected ConnectionStatus = "Disconnected" + // ConnectionStatusPending ... + ConnectionStatusPending ConnectionStatus = "Pending" + // ConnectionStatusRejected ... + ConnectionStatusRejected ConnectionStatus = "Rejected" +) + +// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. +func PossibleConnectionStatusValues() []ConnectionStatus { + return []ConnectionStatus{ConnectionStatusApproved, ConnectionStatusDisconnected, ConnectionStatusPending, ConnectionStatusRejected} +} + +// 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} +} + +// Expander enumerates the values for expander. +type Expander string + +const ( + // ExpanderLeastWaste Selects the node group that will have the least idle CPU (if tied, unused memory) + // after scale-up. This is useful when you have different classes of nodes, for example, high CPU or high + // memory nodes, and only want to expand those when there are pending pods that need a lot of those + // resources. + ExpanderLeastWaste Expander = "least-waste" + // ExpanderMostPods Selects the node group that would be able to schedule the most pods when scaling up. + // This is useful when you are using nodeSelector to make sure certain pods land on certain nodes. Note + // that this won't cause the autoscaler to select bigger nodes vs. smaller, as it can add multiple smaller + // nodes at once. + ExpanderMostPods Expander = "most-pods" + // ExpanderPriority Selects the node group that has the highest priority assigned by the user. It's + // configuration is described in more details + // [here](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/expander/priority/readme.md). + ExpanderPriority Expander = "priority" + // ExpanderRandom Used when you don't have a particular need for the node groups to scale differently. + ExpanderRandom Expander = "random" +) + +// PossibleExpanderValues returns an array of possible values for the Expander const type. +func PossibleExpanderValues() []Expander { + return []Expander{ExpanderLeastWaste, ExpanderMostPods, ExpanderPriority, ExpanderRandom} +} + +// ExtendedLocationTypes enumerates the values for extended location types. +type ExtendedLocationTypes string + +const ( + // ExtendedLocationTypesEdgeZone ... + ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone" +) + +// PossibleExtendedLocationTypesValues returns an array of possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ExtendedLocationTypesEdgeZone} +} + +// GPUInstanceProfile enumerates the values for gpu instance profile. +type GPUInstanceProfile string + +const ( + // GPUInstanceProfileMIG1g ... + GPUInstanceProfileMIG1g GPUInstanceProfile = "MIG1g" + // GPUInstanceProfileMIG2g ... + GPUInstanceProfileMIG2g GPUInstanceProfile = "MIG2g" + // GPUInstanceProfileMIG3g ... + GPUInstanceProfileMIG3g GPUInstanceProfile = "MIG3g" + // GPUInstanceProfileMIG4g ... + GPUInstanceProfileMIG4g GPUInstanceProfile = "MIG4g" + // GPUInstanceProfileMIG7g ... + GPUInstanceProfileMIG7g GPUInstanceProfile = "MIG7g" +) + +// PossibleGPUInstanceProfileValues returns an array of possible values for the GPUInstanceProfile const type. +func PossibleGPUInstanceProfileValues() []GPUInstanceProfile { + return []GPUInstanceProfile{GPUInstanceProfileMIG1g, GPUInstanceProfileMIG2g, GPUInstanceProfileMIG3g, GPUInstanceProfileMIG4g, GPUInstanceProfileMIG7g} +} + +// KubeletDiskType enumerates the values for kubelet disk type. +type KubeletDiskType string + +const ( + // KubeletDiskTypeOS Kubelet will use the OS disk for its data. + KubeletDiskTypeOS KubeletDiskType = "OS" + // KubeletDiskTypeTemporary Kubelet will use the temporary disk for its data. + KubeletDiskTypeTemporary KubeletDiskType = "Temporary" +) + +// PossibleKubeletDiskTypeValues returns an array of possible values for the KubeletDiskType const type. +func PossibleKubeletDiskTypeValues() []KubeletDiskType { + return []KubeletDiskType{KubeletDiskTypeOS, KubeletDiskTypeTemporary} +} + +// LicenseType enumerates the values for license type. +type LicenseType string + +const ( + // LicenseTypeNone No additional licensing is applied. + LicenseTypeNone LicenseType = "None" + // LicenseTypeWindowsServer Enables Azure Hybrid User Benefits for Windows VMs. + LicenseTypeWindowsServer LicenseType = "Windows_Server" +) + +// PossibleLicenseTypeValues returns an array of possible values for the LicenseType const type. +func PossibleLicenseTypeValues() []LicenseType { + return []LicenseType{LicenseTypeNone, LicenseTypeWindowsServer} +} + +// LoadBalancerSku enumerates the values for load balancer sku. +type LoadBalancerSku string + +const ( + // LoadBalancerSkuBasic Use a basic Load Balancer with limited functionality. + LoadBalancerSkuBasic LoadBalancerSku = "basic" + // LoadBalancerSkuStandard Use a a standard Load Balancer. This is the recommended Load Balancer SKU. For + // more information about on working with the load balancer in the managed cluster, see the [standard Load + // Balancer](https://docs.microsoft.com/azure/aks/load-balancer-standard) article. + LoadBalancerSkuStandard LoadBalancerSku = "standard" +) + +// PossibleLoadBalancerSkuValues returns an array of possible values for the LoadBalancerSku const type. +func PossibleLoadBalancerSkuValues() []LoadBalancerSku { + return []LoadBalancerSku{LoadBalancerSkuBasic, LoadBalancerSkuStandard} +} + +// ManagedClusterPodIdentityProvisioningState enumerates the values for managed cluster pod identity +// provisioning state. +type ManagedClusterPodIdentityProvisioningState string + +const ( + // ManagedClusterPodIdentityProvisioningStateAssigned ... + ManagedClusterPodIdentityProvisioningStateAssigned ManagedClusterPodIdentityProvisioningState = "Assigned" + // ManagedClusterPodIdentityProvisioningStateDeleting ... + ManagedClusterPodIdentityProvisioningStateDeleting ManagedClusterPodIdentityProvisioningState = "Deleting" + // ManagedClusterPodIdentityProvisioningStateFailed ... + ManagedClusterPodIdentityProvisioningStateFailed ManagedClusterPodIdentityProvisioningState = "Failed" + // ManagedClusterPodIdentityProvisioningStateUpdating ... + ManagedClusterPodIdentityProvisioningStateUpdating ManagedClusterPodIdentityProvisioningState = "Updating" +) + +// PossibleManagedClusterPodIdentityProvisioningStateValues returns an array of possible values for the ManagedClusterPodIdentityProvisioningState const type. +func PossibleManagedClusterPodIdentityProvisioningStateValues() []ManagedClusterPodIdentityProvisioningState { + return []ManagedClusterPodIdentityProvisioningState{ManagedClusterPodIdentityProvisioningStateAssigned, ManagedClusterPodIdentityProvisioningStateDeleting, ManagedClusterPodIdentityProvisioningStateFailed, ManagedClusterPodIdentityProvisioningStateUpdating} +} + +// ManagedClusterSKUName enumerates the values for managed cluster sku name. +type ManagedClusterSKUName string + +const ( + // ManagedClusterSKUNameBasic ... + ManagedClusterSKUNameBasic ManagedClusterSKUName = "Basic" +) + +// PossibleManagedClusterSKUNameValues returns an array of possible values for the ManagedClusterSKUName const type. +func PossibleManagedClusterSKUNameValues() []ManagedClusterSKUName { + return []ManagedClusterSKUName{ManagedClusterSKUNameBasic} +} + +// ManagedClusterSKUTier enumerates the values for managed cluster sku tier. +type ManagedClusterSKUTier string + +const ( + // ManagedClusterSKUTierFree No guaranteed SLA, no additional charges. Free tier clusters have an SLO of + // 99.5%. + ManagedClusterSKUTierFree ManagedClusterSKUTier = "Free" + // ManagedClusterSKUTierPaid Guarantees 99.95% availability of the Kubernetes API server endpoint for + // clusters that use Availability Zones and 99.9% of availability for clusters that don't use Availability + // Zones. + ManagedClusterSKUTierPaid ManagedClusterSKUTier = "Paid" +) + +// PossibleManagedClusterSKUTierValues returns an array of possible values for the ManagedClusterSKUTier const type. +func PossibleManagedClusterSKUTierValues() []ManagedClusterSKUTier { + return []ManagedClusterSKUTier{ManagedClusterSKUTierFree, ManagedClusterSKUTierPaid} +} + +// NetworkMode enumerates the values for network mode. +type NetworkMode string + +const ( + // NetworkModeBridge This is no longer supported + NetworkModeBridge NetworkMode = "bridge" + // NetworkModeTransparent No bridge is created. Intra-VM Pod to Pod communication is through IP routes + // created by Azure CNI. See [Transparent Mode](https://docs.microsoft.com/azure/aks/faq#transparent-mode) + // for more information. + NetworkModeTransparent NetworkMode = "transparent" +) + +// PossibleNetworkModeValues returns an array of possible values for the NetworkMode const type. +func PossibleNetworkModeValues() []NetworkMode { + return []NetworkMode{NetworkModeBridge, NetworkModeTransparent} +} + +// NetworkPlugin enumerates the values for network plugin. +type NetworkPlugin string + +const ( + // NetworkPluginAzure Use the Azure CNI network plugin. See [Azure CNI (advanced) + // networking](https://docs.microsoft.com/azure/aks/concepts-network#azure-cni-advanced-networking) for + // more information. + NetworkPluginAzure NetworkPlugin = "azure" + // NetworkPluginKubenet Use the Kubenet network plugin. See [Kubenet (basic) + // networking](https://docs.microsoft.com/azure/aks/concepts-network#kubenet-basic-networking) for more + // information. + NetworkPluginKubenet NetworkPlugin = "kubenet" +) + +// PossibleNetworkPluginValues returns an array of possible values for the NetworkPlugin const type. +func PossibleNetworkPluginValues() []NetworkPlugin { + return []NetworkPlugin{NetworkPluginAzure, NetworkPluginKubenet} +} + +// NetworkPolicy enumerates the values for network policy. +type NetworkPolicy string + +const ( + // NetworkPolicyAzure Use Azure network policies. See [differences between Azure and Calico + // policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) + // for more information. + NetworkPolicyAzure NetworkPolicy = "azure" + // NetworkPolicyCalico Use Calico network policies. See [differences between Azure and Calico + // policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) + // for more information. + NetworkPolicyCalico NetworkPolicy = "calico" +) + +// PossibleNetworkPolicyValues returns an array of possible values for the NetworkPolicy const type. +func PossibleNetworkPolicyValues() []NetworkPolicy { + return []NetworkPolicy{NetworkPolicyAzure, NetworkPolicyCalico} +} + +// OSDiskType enumerates the values for os disk type. +type OSDiskType string + +const ( + // OSDiskTypeEphemeral Ephemeral OS disks are stored only on the host machine, just like a temporary disk. + // This provides lower read/write latency, along with faster node scaling and cluster upgrades. + OSDiskTypeEphemeral OSDiskType = "Ephemeral" + // OSDiskTypeManaged Azure replicates the operating system disk for a virtual machine to Azure storage to + // avoid data loss should the VM need to be relocated to another host. Since containers aren't designed to + // have local state persisted, this behavior offers limited value while providing some drawbacks, including + // slower node provisioning and higher read/write latency. + OSDiskTypeManaged OSDiskType = "Managed" +) + +// PossibleOSDiskTypeValues returns an array of possible values for the OSDiskType const type. +func PossibleOSDiskTypeValues() []OSDiskType { + return []OSDiskType{OSDiskTypeEphemeral, OSDiskTypeManaged} +} + +// OSSKU enumerates the values for ossku. +type OSSKU string + +const ( + // OSSKUCBLMariner ... + OSSKUCBLMariner OSSKU = "CBLMariner" + // OSSKUUbuntu ... + OSSKUUbuntu OSSKU = "Ubuntu" +) + +// PossibleOSSKUValues returns an array of possible values for the OSSKU const type. +func PossibleOSSKUValues() []OSSKU { + return []OSSKU{OSSKUCBLMariner, OSSKUUbuntu} +} + +// OSType enumerates the values for os type. +type OSType string + +const ( + // OSTypeLinux Use Linux. + OSTypeLinux OSType = "Linux" + // OSTypeWindows Use Windows. + OSTypeWindows OSType = "Windows" +) + +// PossibleOSTypeValues returns an array of possible values for the OSType const type. +func PossibleOSTypeValues() []OSType { + return []OSType{OSTypeLinux, OSTypeWindows} +} + +// OutboundType enumerates the values for outbound type. +type OutboundType string + +const ( + // OutboundTypeLoadBalancer The load balancer is used for egress through an AKS assigned public IP. This + // supports Kubernetes services of type 'loadBalancer'. For more information see [outbound type + // loadbalancer](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-loadbalancer). + OutboundTypeLoadBalancer OutboundType = "loadBalancer" + // OutboundTypeManagedNATGateway The AKS-managed NAT gateway is used for egress. + OutboundTypeManagedNATGateway OutboundType = "managedNATGateway" + // OutboundTypeUserAssignedNATGateway The user-assigned NAT gateway associated to the cluster subnet is + // used for egress. This is an advanced scenario and requires proper network configuration. + OutboundTypeUserAssignedNATGateway OutboundType = "userAssignedNATGateway" + // OutboundTypeUserDefinedRouting Egress paths must be defined by the user. This is an advanced scenario + // and requires proper network configuration. For more information see [outbound type + // userDefinedRouting](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-userdefinedrouting). + OutboundTypeUserDefinedRouting OutboundType = "userDefinedRouting" +) + +// PossibleOutboundTypeValues returns an array of possible values for the OutboundType const type. +func PossibleOutboundTypeValues() []OutboundType { + return []OutboundType{OutboundTypeLoadBalancer, OutboundTypeManagedNATGateway, OutboundTypeUserAssignedNATGateway, OutboundTypeUserDefinedRouting} +} + +// 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" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} +} + +// 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} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone Do not use a managed identity for the Managed Cluster, service principal will + // be used instead. + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned Use an implicitly created system assigned managed identity to manage + // cluster resources. Master components in the control plane such as kube-controller-manager will use the + // system assigned managed identity to manipulate Azure resources. + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeUserAssigned Use a user-specified identity to manage cluster resources. Master + // components in the control plane such as kube-controller-manager will use the specified user assigned + // managed identity to manipulate Azure resources. + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeUserAssigned} +} + +// ScaleDownMode enumerates the values for scale down mode. +type ScaleDownMode string + +const ( + // ScaleDownModeDeallocate Attempt to start deallocated instances (if they exist) during scale up and + // deallocate instances during scale down. + ScaleDownModeDeallocate ScaleDownMode = "Deallocate" + // ScaleDownModeDelete Create new instances during scale up and remove instances during scale down. + ScaleDownModeDelete ScaleDownMode = "Delete" +) + +// PossibleScaleDownModeValues returns an array of possible values for the ScaleDownMode const type. +func PossibleScaleDownModeValues() []ScaleDownMode { + return []ScaleDownMode{ScaleDownModeDeallocate, ScaleDownModeDelete} +} + +// ScaleSetEvictionPolicy enumerates the values for scale set eviction policy. +type ScaleSetEvictionPolicy string + +const ( + // ScaleSetEvictionPolicyDeallocate Nodes in the underlying Scale Set of the node pool are set to the + // stopped-deallocated state upon eviction. Nodes in the stopped-deallocated state count against your + // compute quota and can cause issues with cluster scaling or upgrading. + ScaleSetEvictionPolicyDeallocate ScaleSetEvictionPolicy = "Deallocate" + // ScaleSetEvictionPolicyDelete Nodes in the underlying Scale Set of the node pool are deleted when they're + // evicted. + ScaleSetEvictionPolicyDelete ScaleSetEvictionPolicy = "Delete" +) + +// PossibleScaleSetEvictionPolicyValues returns an array of possible values for the ScaleSetEvictionPolicy const type. +func PossibleScaleSetEvictionPolicyValues() []ScaleSetEvictionPolicy { + return []ScaleSetEvictionPolicy{ScaleSetEvictionPolicyDeallocate, ScaleSetEvictionPolicyDelete} +} + +// ScaleSetPriority enumerates the values for scale set priority. +type ScaleSetPriority string + +const ( + // ScaleSetPriorityRegular Regular VMs will be used. + ScaleSetPriorityRegular ScaleSetPriority = "Regular" + // ScaleSetPrioritySpot Spot priority VMs will be used. There is no SLA for spot nodes. See [spot on + // AKS](https://docs.microsoft.com/azure/aks/spot-node-pool) for more information. + ScaleSetPrioritySpot ScaleSetPriority = "Spot" +) + +// PossibleScaleSetPriorityValues returns an array of possible values for the ScaleSetPriority const type. +func PossibleScaleSetPriorityValues() []ScaleSetPriority { + return []ScaleSetPriority{ScaleSetPriorityRegular, ScaleSetPrioritySpot} +} + +// SnapshotType enumerates the values for snapshot type. +type SnapshotType string + +const ( + // SnapshotTypeNodePool The snapshot is a snapshot of a node pool. + SnapshotTypeNodePool SnapshotType = "NodePool" +) + +// PossibleSnapshotTypeValues returns an array of possible values for the SnapshotType const type. +func PossibleSnapshotTypeValues() []SnapshotType { + return []SnapshotType{SnapshotTypeNodePool} +} + +// StorageProfileTypes enumerates the values for storage profile types. +type StorageProfileTypes string + +const ( + // StorageProfileTypesManagedDisks ... + StorageProfileTypesManagedDisks StorageProfileTypes = "ManagedDisks" + // StorageProfileTypesStorageAccount ... + StorageProfileTypesStorageAccount StorageProfileTypes = "StorageAccount" +) + +// PossibleStorageProfileTypesValues returns an array of possible values for the StorageProfileTypes const type. +func PossibleStorageProfileTypesValues() []StorageProfileTypes { + return []StorageProfileTypes{StorageProfileTypesManagedDisks, StorageProfileTypesStorageAccount} +} + +// UpgradeChannel enumerates the values for upgrade channel. +type UpgradeChannel string + +const ( + // UpgradeChannelNodeImage Automatically upgrade the node image to the latest version available. Microsoft + // provides patches and new images for image nodes frequently (usually weekly), but your running nodes + // won't get the new images unless you do a node image upgrade. Turning on the node-image channel will + // automatically update your node images whenever a new version is available. + UpgradeChannelNodeImage UpgradeChannel = "node-image" + // UpgradeChannelNone Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. + UpgradeChannelNone UpgradeChannel = "none" + // UpgradeChannelPatch Automatically upgrade the cluster to the latest supported patch version when it + // becomes available while keeping the minor version the same. For example, if a cluster is running version + // 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded to + // 1.17.9. + UpgradeChannelPatch UpgradeChannel = "patch" + // UpgradeChannelRapid Automatically upgrade the cluster to the latest supported patch release on the + // latest supported minor version. In cases where the cluster is at a version of Kubernetes that is at an + // N-2 minor version where N is the latest supported minor version, the cluster first upgrades to the + // latest supported patch version on N-1 minor version. For example, if a cluster is running version 1.17.7 + // and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster first is upgraded to 1.18.6, + // then is upgraded to 1.19.1. + UpgradeChannelRapid UpgradeChannel = "rapid" + // UpgradeChannelStable Automatically upgrade the cluster to the latest supported patch release on minor + // version N-1, where N is the latest supported minor version. For example, if a cluster is running version + // 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded to + // 1.18.6. + UpgradeChannelStable UpgradeChannel = "stable" +) + +// PossibleUpgradeChannelValues returns an array of possible values for the UpgradeChannel const type. +func PossibleUpgradeChannelValues() []UpgradeChannel { + return []UpgradeChannel{UpgradeChannelNodeImage, UpgradeChannelNone, UpgradeChannelPatch, UpgradeChannelRapid, UpgradeChannelStable} +} + +// VMSizeTypes enumerates the values for vm size types. +type VMSizeTypes string + +const ( + // VMSizeTypesStandardA1 ... + VMSizeTypesStandardA1 VMSizeTypes = "Standard_A1" + // VMSizeTypesStandardA10 ... + VMSizeTypesStandardA10 VMSizeTypes = "Standard_A10" + // VMSizeTypesStandardA11 ... + VMSizeTypesStandardA11 VMSizeTypes = "Standard_A11" + // VMSizeTypesStandardA1V2 ... + VMSizeTypesStandardA1V2 VMSizeTypes = "Standard_A1_v2" + // VMSizeTypesStandardA2 ... + VMSizeTypesStandardA2 VMSizeTypes = "Standard_A2" + // VMSizeTypesStandardA2mV2 ... + VMSizeTypesStandardA2mV2 VMSizeTypes = "Standard_A2m_v2" + // VMSizeTypesStandardA2V2 ... + VMSizeTypesStandardA2V2 VMSizeTypes = "Standard_A2_v2" + // VMSizeTypesStandardA3 ... + VMSizeTypesStandardA3 VMSizeTypes = "Standard_A3" + // VMSizeTypesStandardA4 ... + VMSizeTypesStandardA4 VMSizeTypes = "Standard_A4" + // VMSizeTypesStandardA4mV2 ... + VMSizeTypesStandardA4mV2 VMSizeTypes = "Standard_A4m_v2" + // VMSizeTypesStandardA4V2 ... + VMSizeTypesStandardA4V2 VMSizeTypes = "Standard_A4_v2" + // VMSizeTypesStandardA5 ... + VMSizeTypesStandardA5 VMSizeTypes = "Standard_A5" + // VMSizeTypesStandardA6 ... + VMSizeTypesStandardA6 VMSizeTypes = "Standard_A6" + // VMSizeTypesStandardA7 ... + VMSizeTypesStandardA7 VMSizeTypes = "Standard_A7" + // VMSizeTypesStandardA8 ... + VMSizeTypesStandardA8 VMSizeTypes = "Standard_A8" + // VMSizeTypesStandardA8mV2 ... + VMSizeTypesStandardA8mV2 VMSizeTypes = "Standard_A8m_v2" + // VMSizeTypesStandardA8V2 ... + VMSizeTypesStandardA8V2 VMSizeTypes = "Standard_A8_v2" + // VMSizeTypesStandardA9 ... + VMSizeTypesStandardA9 VMSizeTypes = "Standard_A9" + // VMSizeTypesStandardB2ms ... + VMSizeTypesStandardB2ms VMSizeTypes = "Standard_B2ms" + // VMSizeTypesStandardB2s ... + VMSizeTypesStandardB2s VMSizeTypes = "Standard_B2s" + // VMSizeTypesStandardB4ms ... + VMSizeTypesStandardB4ms VMSizeTypes = "Standard_B4ms" + // VMSizeTypesStandardB8ms ... + VMSizeTypesStandardB8ms VMSizeTypes = "Standard_B8ms" + // VMSizeTypesStandardD1 ... + VMSizeTypesStandardD1 VMSizeTypes = "Standard_D1" + // VMSizeTypesStandardD11 ... + VMSizeTypesStandardD11 VMSizeTypes = "Standard_D11" + // VMSizeTypesStandardD11V2 ... + VMSizeTypesStandardD11V2 VMSizeTypes = "Standard_D11_v2" + // VMSizeTypesStandardD11V2Promo ... + VMSizeTypesStandardD11V2Promo VMSizeTypes = "Standard_D11_v2_Promo" + // VMSizeTypesStandardD12 ... + VMSizeTypesStandardD12 VMSizeTypes = "Standard_D12" + // VMSizeTypesStandardD12V2 ... + VMSizeTypesStandardD12V2 VMSizeTypes = "Standard_D12_v2" + // VMSizeTypesStandardD12V2Promo ... + VMSizeTypesStandardD12V2Promo VMSizeTypes = "Standard_D12_v2_Promo" + // VMSizeTypesStandardD13 ... + VMSizeTypesStandardD13 VMSizeTypes = "Standard_D13" + // VMSizeTypesStandardD13V2 ... + VMSizeTypesStandardD13V2 VMSizeTypes = "Standard_D13_v2" + // VMSizeTypesStandardD13V2Promo ... + VMSizeTypesStandardD13V2Promo VMSizeTypes = "Standard_D13_v2_Promo" + // VMSizeTypesStandardD14 ... + VMSizeTypesStandardD14 VMSizeTypes = "Standard_D14" + // VMSizeTypesStandardD14V2 ... + VMSizeTypesStandardD14V2 VMSizeTypes = "Standard_D14_v2" + // VMSizeTypesStandardD14V2Promo ... + VMSizeTypesStandardD14V2Promo VMSizeTypes = "Standard_D14_v2_Promo" + // VMSizeTypesStandardD15V2 ... + VMSizeTypesStandardD15V2 VMSizeTypes = "Standard_D15_v2" + // VMSizeTypesStandardD16sV3 ... + VMSizeTypesStandardD16sV3 VMSizeTypes = "Standard_D16s_v3" + // VMSizeTypesStandardD16V3 ... + VMSizeTypesStandardD16V3 VMSizeTypes = "Standard_D16_v3" + // VMSizeTypesStandardD1V2 ... + VMSizeTypesStandardD1V2 VMSizeTypes = "Standard_D1_v2" + // VMSizeTypesStandardD2 ... + VMSizeTypesStandardD2 VMSizeTypes = "Standard_D2" + // VMSizeTypesStandardD2sV3 ... + VMSizeTypesStandardD2sV3 VMSizeTypes = "Standard_D2s_v3" + // VMSizeTypesStandardD2V2 ... + VMSizeTypesStandardD2V2 VMSizeTypes = "Standard_D2_v2" + // VMSizeTypesStandardD2V2Promo ... + VMSizeTypesStandardD2V2Promo VMSizeTypes = "Standard_D2_v2_Promo" + // VMSizeTypesStandardD2V3 ... + VMSizeTypesStandardD2V3 VMSizeTypes = "Standard_D2_v3" + // VMSizeTypesStandardD3 ... + VMSizeTypesStandardD3 VMSizeTypes = "Standard_D3" + // VMSizeTypesStandardD32sV3 ... + VMSizeTypesStandardD32sV3 VMSizeTypes = "Standard_D32s_v3" + // VMSizeTypesStandardD32V3 ... + VMSizeTypesStandardD32V3 VMSizeTypes = "Standard_D32_v3" + // VMSizeTypesStandardD3V2 ... + VMSizeTypesStandardD3V2 VMSizeTypes = "Standard_D3_v2" + // VMSizeTypesStandardD3V2Promo ... + VMSizeTypesStandardD3V2Promo VMSizeTypes = "Standard_D3_v2_Promo" + // VMSizeTypesStandardD4 ... + VMSizeTypesStandardD4 VMSizeTypes = "Standard_D4" + // VMSizeTypesStandardD4sV3 ... + VMSizeTypesStandardD4sV3 VMSizeTypes = "Standard_D4s_v3" + // VMSizeTypesStandardD4V2 ... + VMSizeTypesStandardD4V2 VMSizeTypes = "Standard_D4_v2" + // VMSizeTypesStandardD4V2Promo ... + VMSizeTypesStandardD4V2Promo VMSizeTypes = "Standard_D4_v2_Promo" + // VMSizeTypesStandardD4V3 ... + VMSizeTypesStandardD4V3 VMSizeTypes = "Standard_D4_v3" + // VMSizeTypesStandardD5V2 ... + VMSizeTypesStandardD5V2 VMSizeTypes = "Standard_D5_v2" + // VMSizeTypesStandardD5V2Promo ... + VMSizeTypesStandardD5V2Promo VMSizeTypes = "Standard_D5_v2_Promo" + // VMSizeTypesStandardD64sV3 ... + VMSizeTypesStandardD64sV3 VMSizeTypes = "Standard_D64s_v3" + // VMSizeTypesStandardD64V3 ... + VMSizeTypesStandardD64V3 VMSizeTypes = "Standard_D64_v3" + // VMSizeTypesStandardD8sV3 ... + VMSizeTypesStandardD8sV3 VMSizeTypes = "Standard_D8s_v3" + // VMSizeTypesStandardD8V3 ... + VMSizeTypesStandardD8V3 VMSizeTypes = "Standard_D8_v3" + // VMSizeTypesStandardDS1 ... + VMSizeTypesStandardDS1 VMSizeTypes = "Standard_DS1" + // VMSizeTypesStandardDS11 ... + VMSizeTypesStandardDS11 VMSizeTypes = "Standard_DS11" + // VMSizeTypesStandardDS11V2 ... + VMSizeTypesStandardDS11V2 VMSizeTypes = "Standard_DS11_v2" + // VMSizeTypesStandardDS11V2Promo ... + VMSizeTypesStandardDS11V2Promo VMSizeTypes = "Standard_DS11_v2_Promo" + // VMSizeTypesStandardDS12 ... + VMSizeTypesStandardDS12 VMSizeTypes = "Standard_DS12" + // VMSizeTypesStandardDS12V2 ... + VMSizeTypesStandardDS12V2 VMSizeTypes = "Standard_DS12_v2" + // VMSizeTypesStandardDS12V2Promo ... + VMSizeTypesStandardDS12V2Promo VMSizeTypes = "Standard_DS12_v2_Promo" + // VMSizeTypesStandardDS13 ... + VMSizeTypesStandardDS13 VMSizeTypes = "Standard_DS13" + // VMSizeTypesStandardDS132V2 ... + VMSizeTypesStandardDS132V2 VMSizeTypes = "Standard_DS13-2_v2" + // VMSizeTypesStandardDS134V2 ... + VMSizeTypesStandardDS134V2 VMSizeTypes = "Standard_DS13-4_v2" + // VMSizeTypesStandardDS13V2 ... + VMSizeTypesStandardDS13V2 VMSizeTypes = "Standard_DS13_v2" + // VMSizeTypesStandardDS13V2Promo ... + VMSizeTypesStandardDS13V2Promo VMSizeTypes = "Standard_DS13_v2_Promo" + // VMSizeTypesStandardDS14 ... + VMSizeTypesStandardDS14 VMSizeTypes = "Standard_DS14" + // VMSizeTypesStandardDS144V2 ... + VMSizeTypesStandardDS144V2 VMSizeTypes = "Standard_DS14-4_v2" + // VMSizeTypesStandardDS148V2 ... + VMSizeTypesStandardDS148V2 VMSizeTypes = "Standard_DS14-8_v2" + // VMSizeTypesStandardDS14V2 ... + VMSizeTypesStandardDS14V2 VMSizeTypes = "Standard_DS14_v2" + // VMSizeTypesStandardDS14V2Promo ... + VMSizeTypesStandardDS14V2Promo VMSizeTypes = "Standard_DS14_v2_Promo" + // VMSizeTypesStandardDS15V2 ... + VMSizeTypesStandardDS15V2 VMSizeTypes = "Standard_DS15_v2" + // VMSizeTypesStandardDS1V2 ... + VMSizeTypesStandardDS1V2 VMSizeTypes = "Standard_DS1_v2" + // VMSizeTypesStandardDS2 ... + VMSizeTypesStandardDS2 VMSizeTypes = "Standard_DS2" + // VMSizeTypesStandardDS2V2 ... + VMSizeTypesStandardDS2V2 VMSizeTypes = "Standard_DS2_v2" + // VMSizeTypesStandardDS2V2Promo ... + VMSizeTypesStandardDS2V2Promo VMSizeTypes = "Standard_DS2_v2_Promo" + // VMSizeTypesStandardDS3 ... + VMSizeTypesStandardDS3 VMSizeTypes = "Standard_DS3" + // VMSizeTypesStandardDS3V2 ... + VMSizeTypesStandardDS3V2 VMSizeTypes = "Standard_DS3_v2" + // VMSizeTypesStandardDS3V2Promo ... + VMSizeTypesStandardDS3V2Promo VMSizeTypes = "Standard_DS3_v2_Promo" + // VMSizeTypesStandardDS4 ... + VMSizeTypesStandardDS4 VMSizeTypes = "Standard_DS4" + // VMSizeTypesStandardDS4V2 ... + VMSizeTypesStandardDS4V2 VMSizeTypes = "Standard_DS4_v2" + // VMSizeTypesStandardDS4V2Promo ... + VMSizeTypesStandardDS4V2Promo VMSizeTypes = "Standard_DS4_v2_Promo" + // VMSizeTypesStandardDS5V2 ... + VMSizeTypesStandardDS5V2 VMSizeTypes = "Standard_DS5_v2" + // VMSizeTypesStandardDS5V2Promo ... + VMSizeTypesStandardDS5V2Promo VMSizeTypes = "Standard_DS5_v2_Promo" + // VMSizeTypesStandardE16sV3 ... + VMSizeTypesStandardE16sV3 VMSizeTypes = "Standard_E16s_v3" + // VMSizeTypesStandardE16V3 ... + VMSizeTypesStandardE16V3 VMSizeTypes = "Standard_E16_v3" + // VMSizeTypesStandardE2sV3 ... + VMSizeTypesStandardE2sV3 VMSizeTypes = "Standard_E2s_v3" + // VMSizeTypesStandardE2V3 ... + VMSizeTypesStandardE2V3 VMSizeTypes = "Standard_E2_v3" + // VMSizeTypesStandardE3216sV3 ... + VMSizeTypesStandardE3216sV3 VMSizeTypes = "Standard_E32-16s_v3" + // VMSizeTypesStandardE328sV3 ... + VMSizeTypesStandardE328sV3 VMSizeTypes = "Standard_E32-8s_v3" + // VMSizeTypesStandardE32sV3 ... + VMSizeTypesStandardE32sV3 VMSizeTypes = "Standard_E32s_v3" + // VMSizeTypesStandardE32V3 ... + VMSizeTypesStandardE32V3 VMSizeTypes = "Standard_E32_v3" + // VMSizeTypesStandardE4sV3 ... + VMSizeTypesStandardE4sV3 VMSizeTypes = "Standard_E4s_v3" + // VMSizeTypesStandardE4V3 ... + VMSizeTypesStandardE4V3 VMSizeTypes = "Standard_E4_v3" + // VMSizeTypesStandardE6416sV3 ... + VMSizeTypesStandardE6416sV3 VMSizeTypes = "Standard_E64-16s_v3" + // VMSizeTypesStandardE6432sV3 ... + VMSizeTypesStandardE6432sV3 VMSizeTypes = "Standard_E64-32s_v3" + // VMSizeTypesStandardE64sV3 ... + VMSizeTypesStandardE64sV3 VMSizeTypes = "Standard_E64s_v3" + // VMSizeTypesStandardE64V3 ... + VMSizeTypesStandardE64V3 VMSizeTypes = "Standard_E64_v3" + // VMSizeTypesStandardE8sV3 ... + VMSizeTypesStandardE8sV3 VMSizeTypes = "Standard_E8s_v3" + // VMSizeTypesStandardE8V3 ... + VMSizeTypesStandardE8V3 VMSizeTypes = "Standard_E8_v3" + // VMSizeTypesStandardF1 ... + VMSizeTypesStandardF1 VMSizeTypes = "Standard_F1" + // VMSizeTypesStandardF16 ... + VMSizeTypesStandardF16 VMSizeTypes = "Standard_F16" + // VMSizeTypesStandardF16s ... + VMSizeTypesStandardF16s VMSizeTypes = "Standard_F16s" + // VMSizeTypesStandardF16sV2 ... + VMSizeTypesStandardF16sV2 VMSizeTypes = "Standard_F16s_v2" + // VMSizeTypesStandardF1s ... + VMSizeTypesStandardF1s VMSizeTypes = "Standard_F1s" + // VMSizeTypesStandardF2 ... + VMSizeTypesStandardF2 VMSizeTypes = "Standard_F2" + // VMSizeTypesStandardF2s ... + VMSizeTypesStandardF2s VMSizeTypes = "Standard_F2s" + // VMSizeTypesStandardF2sV2 ... + VMSizeTypesStandardF2sV2 VMSizeTypes = "Standard_F2s_v2" + // VMSizeTypesStandardF32sV2 ... + VMSizeTypesStandardF32sV2 VMSizeTypes = "Standard_F32s_v2" + // VMSizeTypesStandardF4 ... + VMSizeTypesStandardF4 VMSizeTypes = "Standard_F4" + // VMSizeTypesStandardF4s ... + VMSizeTypesStandardF4s VMSizeTypes = "Standard_F4s" + // VMSizeTypesStandardF4sV2 ... + VMSizeTypesStandardF4sV2 VMSizeTypes = "Standard_F4s_v2" + // VMSizeTypesStandardF64sV2 ... + VMSizeTypesStandardF64sV2 VMSizeTypes = "Standard_F64s_v2" + // VMSizeTypesStandardF72sV2 ... + VMSizeTypesStandardF72sV2 VMSizeTypes = "Standard_F72s_v2" + // VMSizeTypesStandardF8 ... + VMSizeTypesStandardF8 VMSizeTypes = "Standard_F8" + // VMSizeTypesStandardF8s ... + VMSizeTypesStandardF8s VMSizeTypes = "Standard_F8s" + // VMSizeTypesStandardF8sV2 ... + VMSizeTypesStandardF8sV2 VMSizeTypes = "Standard_F8s_v2" + // VMSizeTypesStandardG1 ... + VMSizeTypesStandardG1 VMSizeTypes = "Standard_G1" + // VMSizeTypesStandardG2 ... + VMSizeTypesStandardG2 VMSizeTypes = "Standard_G2" + // VMSizeTypesStandardG3 ... + VMSizeTypesStandardG3 VMSizeTypes = "Standard_G3" + // VMSizeTypesStandardG4 ... + VMSizeTypesStandardG4 VMSizeTypes = "Standard_G4" + // VMSizeTypesStandardG5 ... + VMSizeTypesStandardG5 VMSizeTypes = "Standard_G5" + // VMSizeTypesStandardGS1 ... + VMSizeTypesStandardGS1 VMSizeTypes = "Standard_GS1" + // VMSizeTypesStandardGS2 ... + VMSizeTypesStandardGS2 VMSizeTypes = "Standard_GS2" + // VMSizeTypesStandardGS3 ... + VMSizeTypesStandardGS3 VMSizeTypes = "Standard_GS3" + // VMSizeTypesStandardGS4 ... + VMSizeTypesStandardGS4 VMSizeTypes = "Standard_GS4" + // VMSizeTypesStandardGS44 ... + VMSizeTypesStandardGS44 VMSizeTypes = "Standard_GS4-4" + // VMSizeTypesStandardGS48 ... + VMSizeTypesStandardGS48 VMSizeTypes = "Standard_GS4-8" + // VMSizeTypesStandardGS5 ... + VMSizeTypesStandardGS5 VMSizeTypes = "Standard_GS5" + // VMSizeTypesStandardGS516 ... + VMSizeTypesStandardGS516 VMSizeTypes = "Standard_GS5-16" + // VMSizeTypesStandardGS58 ... + VMSizeTypesStandardGS58 VMSizeTypes = "Standard_GS5-8" + // VMSizeTypesStandardH16 ... + VMSizeTypesStandardH16 VMSizeTypes = "Standard_H16" + // VMSizeTypesStandardH16m ... + VMSizeTypesStandardH16m VMSizeTypes = "Standard_H16m" + // VMSizeTypesStandardH16mr ... + VMSizeTypesStandardH16mr VMSizeTypes = "Standard_H16mr" + // VMSizeTypesStandardH16r ... + VMSizeTypesStandardH16r VMSizeTypes = "Standard_H16r" + // VMSizeTypesStandardH8 ... + VMSizeTypesStandardH8 VMSizeTypes = "Standard_H8" + // VMSizeTypesStandardH8m ... + VMSizeTypesStandardH8m VMSizeTypes = "Standard_H8m" + // VMSizeTypesStandardL16s ... + VMSizeTypesStandardL16s VMSizeTypes = "Standard_L16s" + // VMSizeTypesStandardL32s ... + VMSizeTypesStandardL32s VMSizeTypes = "Standard_L32s" + // VMSizeTypesStandardL4s ... + VMSizeTypesStandardL4s VMSizeTypes = "Standard_L4s" + // VMSizeTypesStandardL8s ... + VMSizeTypesStandardL8s VMSizeTypes = "Standard_L8s" + // VMSizeTypesStandardM12832ms ... + VMSizeTypesStandardM12832ms VMSizeTypes = "Standard_M128-32ms" + // VMSizeTypesStandardM12864ms ... + VMSizeTypesStandardM12864ms VMSizeTypes = "Standard_M128-64ms" + // VMSizeTypesStandardM128ms ... + VMSizeTypesStandardM128ms VMSizeTypes = "Standard_M128ms" + // VMSizeTypesStandardM128s ... + VMSizeTypesStandardM128s VMSizeTypes = "Standard_M128s" + // VMSizeTypesStandardM6416ms ... + VMSizeTypesStandardM6416ms VMSizeTypes = "Standard_M64-16ms" + // VMSizeTypesStandardM6432ms ... + VMSizeTypesStandardM6432ms VMSizeTypes = "Standard_M64-32ms" + // VMSizeTypesStandardM64ms ... + VMSizeTypesStandardM64ms VMSizeTypes = "Standard_M64ms" + // VMSizeTypesStandardM64s ... + VMSizeTypesStandardM64s VMSizeTypes = "Standard_M64s" + // VMSizeTypesStandardNC12 ... + VMSizeTypesStandardNC12 VMSizeTypes = "Standard_NC12" + // VMSizeTypesStandardNC12sV2 ... + VMSizeTypesStandardNC12sV2 VMSizeTypes = "Standard_NC12s_v2" + // VMSizeTypesStandardNC12sV3 ... + VMSizeTypesStandardNC12sV3 VMSizeTypes = "Standard_NC12s_v3" + // VMSizeTypesStandardNC24 ... + VMSizeTypesStandardNC24 VMSizeTypes = "Standard_NC24" + // VMSizeTypesStandardNC24r ... + VMSizeTypesStandardNC24r VMSizeTypes = "Standard_NC24r" + // VMSizeTypesStandardNC24rsV2 ... + VMSizeTypesStandardNC24rsV2 VMSizeTypes = "Standard_NC24rs_v2" + // VMSizeTypesStandardNC24rsV3 ... + VMSizeTypesStandardNC24rsV3 VMSizeTypes = "Standard_NC24rs_v3" + // VMSizeTypesStandardNC24sV2 ... + VMSizeTypesStandardNC24sV2 VMSizeTypes = "Standard_NC24s_v2" + // VMSizeTypesStandardNC24sV3 ... + VMSizeTypesStandardNC24sV3 VMSizeTypes = "Standard_NC24s_v3" + // VMSizeTypesStandardNC6 ... + VMSizeTypesStandardNC6 VMSizeTypes = "Standard_NC6" + // VMSizeTypesStandardNC6sV2 ... + VMSizeTypesStandardNC6sV2 VMSizeTypes = "Standard_NC6s_v2" + // VMSizeTypesStandardNC6sV3 ... + VMSizeTypesStandardNC6sV3 VMSizeTypes = "Standard_NC6s_v3" + // VMSizeTypesStandardND12s ... + VMSizeTypesStandardND12s VMSizeTypes = "Standard_ND12s" + // VMSizeTypesStandardND24rs ... + VMSizeTypesStandardND24rs VMSizeTypes = "Standard_ND24rs" + // VMSizeTypesStandardND24s ... + VMSizeTypesStandardND24s VMSizeTypes = "Standard_ND24s" + // VMSizeTypesStandardND6s ... + VMSizeTypesStandardND6s VMSizeTypes = "Standard_ND6s" + // VMSizeTypesStandardNV12 ... + VMSizeTypesStandardNV12 VMSizeTypes = "Standard_NV12" + // VMSizeTypesStandardNV24 ... + VMSizeTypesStandardNV24 VMSizeTypes = "Standard_NV24" + // VMSizeTypesStandardNV6 ... + VMSizeTypesStandardNV6 VMSizeTypes = "Standard_NV6" +) + +// PossibleVMSizeTypesValues returns an array of possible values for the VMSizeTypes const type. +func PossibleVMSizeTypesValues() []VMSizeTypes { + return []VMSizeTypes{VMSizeTypesStandardA1, VMSizeTypesStandardA10, VMSizeTypesStandardA11, VMSizeTypesStandardA1V2, VMSizeTypesStandardA2, VMSizeTypesStandardA2mV2, VMSizeTypesStandardA2V2, VMSizeTypesStandardA3, VMSizeTypesStandardA4, VMSizeTypesStandardA4mV2, VMSizeTypesStandardA4V2, VMSizeTypesStandardA5, VMSizeTypesStandardA6, VMSizeTypesStandardA7, VMSizeTypesStandardA8, VMSizeTypesStandardA8mV2, VMSizeTypesStandardA8V2, VMSizeTypesStandardA9, VMSizeTypesStandardB2ms, VMSizeTypesStandardB2s, VMSizeTypesStandardB4ms, VMSizeTypesStandardB8ms, VMSizeTypesStandardD1, VMSizeTypesStandardD11, VMSizeTypesStandardD11V2, VMSizeTypesStandardD11V2Promo, VMSizeTypesStandardD12, VMSizeTypesStandardD12V2, VMSizeTypesStandardD12V2Promo, VMSizeTypesStandardD13, VMSizeTypesStandardD13V2, VMSizeTypesStandardD13V2Promo, VMSizeTypesStandardD14, VMSizeTypesStandardD14V2, VMSizeTypesStandardD14V2Promo, VMSizeTypesStandardD15V2, VMSizeTypesStandardD16sV3, VMSizeTypesStandardD16V3, VMSizeTypesStandardD1V2, VMSizeTypesStandardD2, VMSizeTypesStandardD2sV3, VMSizeTypesStandardD2V2, VMSizeTypesStandardD2V2Promo, VMSizeTypesStandardD2V3, VMSizeTypesStandardD3, VMSizeTypesStandardD32sV3, VMSizeTypesStandardD32V3, VMSizeTypesStandardD3V2, VMSizeTypesStandardD3V2Promo, VMSizeTypesStandardD4, VMSizeTypesStandardD4sV3, VMSizeTypesStandardD4V2, VMSizeTypesStandardD4V2Promo, VMSizeTypesStandardD4V3, VMSizeTypesStandardD5V2, VMSizeTypesStandardD5V2Promo, VMSizeTypesStandardD64sV3, VMSizeTypesStandardD64V3, VMSizeTypesStandardD8sV3, VMSizeTypesStandardD8V3, VMSizeTypesStandardDS1, VMSizeTypesStandardDS11, VMSizeTypesStandardDS11V2, VMSizeTypesStandardDS11V2Promo, VMSizeTypesStandardDS12, VMSizeTypesStandardDS12V2, VMSizeTypesStandardDS12V2Promo, VMSizeTypesStandardDS13, VMSizeTypesStandardDS132V2, VMSizeTypesStandardDS134V2, VMSizeTypesStandardDS13V2, VMSizeTypesStandardDS13V2Promo, VMSizeTypesStandardDS14, VMSizeTypesStandardDS144V2, VMSizeTypesStandardDS148V2, VMSizeTypesStandardDS14V2, VMSizeTypesStandardDS14V2Promo, VMSizeTypesStandardDS15V2, VMSizeTypesStandardDS1V2, VMSizeTypesStandardDS2, VMSizeTypesStandardDS2V2, VMSizeTypesStandardDS2V2Promo, VMSizeTypesStandardDS3, VMSizeTypesStandardDS3V2, VMSizeTypesStandardDS3V2Promo, VMSizeTypesStandardDS4, VMSizeTypesStandardDS4V2, VMSizeTypesStandardDS4V2Promo, VMSizeTypesStandardDS5V2, VMSizeTypesStandardDS5V2Promo, VMSizeTypesStandardE16sV3, VMSizeTypesStandardE16V3, VMSizeTypesStandardE2sV3, VMSizeTypesStandardE2V3, VMSizeTypesStandardE3216sV3, VMSizeTypesStandardE328sV3, VMSizeTypesStandardE32sV3, VMSizeTypesStandardE32V3, VMSizeTypesStandardE4sV3, VMSizeTypesStandardE4V3, VMSizeTypesStandardE6416sV3, VMSizeTypesStandardE6432sV3, VMSizeTypesStandardE64sV3, VMSizeTypesStandardE64V3, VMSizeTypesStandardE8sV3, VMSizeTypesStandardE8V3, VMSizeTypesStandardF1, VMSizeTypesStandardF16, VMSizeTypesStandardF16s, VMSizeTypesStandardF16sV2, VMSizeTypesStandardF1s, VMSizeTypesStandardF2, VMSizeTypesStandardF2s, VMSizeTypesStandardF2sV2, VMSizeTypesStandardF32sV2, VMSizeTypesStandardF4, VMSizeTypesStandardF4s, VMSizeTypesStandardF4sV2, VMSizeTypesStandardF64sV2, VMSizeTypesStandardF72sV2, VMSizeTypesStandardF8, VMSizeTypesStandardF8s, VMSizeTypesStandardF8sV2, VMSizeTypesStandardG1, VMSizeTypesStandardG2, VMSizeTypesStandardG3, VMSizeTypesStandardG4, VMSizeTypesStandardG5, VMSizeTypesStandardGS1, VMSizeTypesStandardGS2, VMSizeTypesStandardGS3, VMSizeTypesStandardGS4, VMSizeTypesStandardGS44, VMSizeTypesStandardGS48, VMSizeTypesStandardGS5, VMSizeTypesStandardGS516, VMSizeTypesStandardGS58, VMSizeTypesStandardH16, VMSizeTypesStandardH16m, VMSizeTypesStandardH16mr, VMSizeTypesStandardH16r, VMSizeTypesStandardH8, VMSizeTypesStandardH8m, VMSizeTypesStandardL16s, VMSizeTypesStandardL32s, VMSizeTypesStandardL4s, VMSizeTypesStandardL8s, VMSizeTypesStandardM12832ms, VMSizeTypesStandardM12864ms, VMSizeTypesStandardM128ms, VMSizeTypesStandardM128s, VMSizeTypesStandardM6416ms, VMSizeTypesStandardM6432ms, VMSizeTypesStandardM64ms, VMSizeTypesStandardM64s, VMSizeTypesStandardNC12, VMSizeTypesStandardNC12sV2, VMSizeTypesStandardNC12sV3, VMSizeTypesStandardNC24, VMSizeTypesStandardNC24r, VMSizeTypesStandardNC24rsV2, VMSizeTypesStandardNC24rsV3, VMSizeTypesStandardNC24sV2, VMSizeTypesStandardNC24sV3, VMSizeTypesStandardNC6, VMSizeTypesStandardNC6sV2, VMSizeTypesStandardNC6sV3, VMSizeTypesStandardND12s, VMSizeTypesStandardND24rs, VMSizeTypesStandardND24s, VMSizeTypesStandardND6s, VMSizeTypesStandardNV12, VMSizeTypesStandardNV24, VMSizeTypesStandardNV6} +} + +// WeekDay enumerates the values for week day. +type WeekDay string + +const ( + // WeekDayFriday ... + WeekDayFriday WeekDay = "Friday" + // WeekDayMonday ... + WeekDayMonday WeekDay = "Monday" + // WeekDaySaturday ... + WeekDaySaturday WeekDay = "Saturday" + // WeekDaySunday ... + WeekDaySunday WeekDay = "Sunday" + // WeekDayThursday ... + WeekDayThursday WeekDay = "Thursday" + // WeekDayTuesday ... + WeekDayTuesday WeekDay = "Tuesday" + // WeekDayWednesday ... + WeekDayWednesday WeekDay = "Wednesday" +) + +// PossibleWeekDayValues returns an array of possible values for the WeekDay const type. +func PossibleWeekDayValues() []WeekDay { + return []WeekDay{WeekDayFriday, WeekDayMonday, WeekDaySaturday, WeekDaySunday, WeekDayThursday, WeekDayTuesday, WeekDayWednesday} +} + +// WorkloadRuntime enumerates the values for workload runtime. +type WorkloadRuntime string + +const ( + // WorkloadRuntimeOCIContainer Nodes will use Kubelet to run standard OCI container workloads. + WorkloadRuntimeOCIContainer WorkloadRuntime = "OCIContainer" + // WorkloadRuntimeWasmWasi Nodes will use Krustlet to run WASM workloads using the WASI provider (Preview). + WorkloadRuntimeWasmWasi WorkloadRuntime = "WasmWasi" +) + +// PossibleWorkloadRuntimeValues returns an array of possible values for the WorkloadRuntime const type. +func PossibleWorkloadRuntimeValues() []WorkloadRuntime { + return []WorkloadRuntime{WorkloadRuntimeOCIContainer, WorkloadRuntimeWasmWasi} +} diff --git a/services/containerservice/mgmt/2021-09-01/containerservice/maintenanceconfigurations.go b/services/containerservice/mgmt/2021-09-01/containerservice/maintenanceconfigurations.go new file mode 100644 index 000000000000..11307f6c8b3b --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/maintenanceconfigurations.go @@ -0,0 +1,428 @@ +package containerservice + +// 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" +) + +// MaintenanceConfigurationsClient is the the Container Service Client. +type MaintenanceConfigurationsClient struct { + BaseClient +} + +// NewMaintenanceConfigurationsClient creates an instance of the MaintenanceConfigurationsClient client. +func NewMaintenanceConfigurationsClient(subscriptionID string) MaintenanceConfigurationsClient { + return NewMaintenanceConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMaintenanceConfigurationsClientWithBaseURI creates an instance of the MaintenanceConfigurationsClient 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 NewMaintenanceConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) MaintenanceConfigurationsClient { + return MaintenanceConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// configName - the name of the maintenance configuration. +// parameters - the maintenance configuration to create or update. +func (client MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters MaintenanceConfiguration) (result MaintenanceConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.MaintenanceConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, configName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client MaintenanceConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters MaintenanceConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", configName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + 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.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", 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 MaintenanceConfigurationsClient) 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 MaintenanceConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result MaintenanceConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// configName - the name of the maintenance configuration. +func (client MaintenanceConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.MaintenanceConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, configName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MaintenanceConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, configName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", configName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", 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 MaintenanceConfigurationsClient) 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 MaintenanceConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// configName - the name of the maintenance configuration. +func (client MaintenanceConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result MaintenanceConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.MaintenanceConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, configName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MaintenanceConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, configName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", configName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", 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 MaintenanceConfigurationsClient) 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 MaintenanceConfigurationsClient) GetResponder(resp *http.Response) (result MaintenanceConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByManagedCluster sends the list by managed cluster request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client MaintenanceConfigurationsClient) ListByManagedCluster(ctx context.Context, resourceGroupName string, resourceName string) (result MaintenanceConfigurationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.ListByManagedCluster") + defer func() { + sc := -1 + if result.mclr.Response.Response != nil { + sc = result.mclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.MaintenanceConfigurationsClient", "ListByManagedCluster", err.Error()) + } + + result.fn = client.listByManagedClusterNextResults + req, err := client.ListByManagedClusterPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "ListByManagedCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListByManagedClusterSender(req) + if err != nil { + result.mclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "ListByManagedCluster", resp, "Failure sending request") + return + } + + result.mclr, err = client.ListByManagedClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "ListByManagedCluster", resp, "Failure responding to request") + return + } + if result.mclr.hasNextLink() && result.mclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByManagedClusterPreparer prepares the ListByManagedCluster request. +func (client MaintenanceConfigurationsClient) ListByManagedClusterPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByManagedClusterSender sends the ListByManagedCluster request. The method will close the +// http.Response Body if it receives an error. +func (client MaintenanceConfigurationsClient) ListByManagedClusterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByManagedClusterResponder handles the response to the ListByManagedCluster request. The method always +// closes the http.Response Body. +func (client MaintenanceConfigurationsClient) ListByManagedClusterResponder(resp *http.Response) (result MaintenanceConfigurationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByManagedClusterNextResults retrieves the next set of results, if any. +func (client MaintenanceConfigurationsClient) listByManagedClusterNextResults(ctx context.Context, lastResults MaintenanceConfigurationListResult) (result MaintenanceConfigurationListResult, err error) { + req, err := lastResults.maintenanceConfigurationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "listByManagedClusterNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByManagedClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "listByManagedClusterNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByManagedClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "listByManagedClusterNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByManagedClusterComplete enumerates all values, automatically crossing page boundaries as required. +func (client MaintenanceConfigurationsClient) ListByManagedClusterComplete(ctx context.Context, resourceGroupName string, resourceName string) (result MaintenanceConfigurationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.ListByManagedCluster") + 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.ListByManagedCluster(ctx, resourceGroupName, resourceName) + return +} diff --git a/services/containerservice/mgmt/2021-09-01/containerservice/managedclusters.go b/services/containerservice/mgmt/2021-09-01/containerservice/managedclusters.go new file mode 100644 index 000000000000..ac7be0651229 --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/managedclusters.go @@ -0,0 +1,1965 @@ +package containerservice + +// 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" +) + +// ManagedClustersClient is the the Container Service Client. +type ManagedClustersClient struct { + BaseClient +} + +// NewManagedClustersClient creates an instance of the ManagedClustersClient client. +func NewManagedClustersClient(subscriptionID string) ManagedClustersClient { + return NewManagedClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedClustersClientWithBaseURI creates an instance of the ManagedClustersClient 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 NewManagedClustersClientWithBaseURI(baseURI string, subscriptionID string) ManagedClustersClient { + return ManagedClustersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// parameters - the managed cluster to create or update. +func (client ManagedClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster) (result ManagedClustersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.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: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ManagedClusterProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile.AdminUsername", Name: validation.Pattern, Rule: `^[A-Za-z][-A-Za-z0-9_]*$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.LinuxProfile.SSH", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile.SSH.PublicKeys", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "parameters.ManagedClusterProperties.WindowsProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.ServicePrincipalProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.ServicePrincipalProfile.ClientID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.PodCidr", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.PodCidr", Name: validation.Pattern, Rule: `^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.ServiceCidr", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.ServiceCidr", Name: validation.Pattern, Rule: `^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.DNSServiceIP", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.DNSServiceIP", Name: validation.Pattern, Rule: `^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.DockerBridgeCidr", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.DockerBridgeCidr", Name: validation.Pattern, Rule: `^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts", Name: validation.InclusiveMaximum, Rule: int64(64000), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.IdleTimeoutInMinutes", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.IdleTimeoutInMinutes", Name: validation.InclusiveMaximum, Rule: int64(120), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.IdleTimeoutInMinutes", Name: validation.InclusiveMinimum, Rule: int64(4), Chain: nil}, + }}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.ManagedOutboundIPProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.ManagedOutboundIPProfile.Count", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.ManagedOutboundIPProfile.Count", Name: validation.InclusiveMaximum, Rule: int64(16), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.ManagedOutboundIPProfile.Count", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.IdleTimeoutInMinutes", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.IdleTimeoutInMinutes", Name: validation.InclusiveMaximum, Rule: int64(120), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.IdleTimeoutInMinutes", Name: validation.InclusiveMinimum, Rule: int64(4), Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagedClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", 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 ManagedClustersClient) CreateOrUpdateSender(req *http.Request) (future ManagedClustersCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedCluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagedClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", 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 ManagedClustersClient) DeleteSender(req *http.Request) (future ManagedClustersDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedCluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagedClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", 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 ManagedClustersClient) 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 ManagedClustersClient) GetResponder(resp *http.Response) (result ManagedCluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAccessProfile **WARNING**: This API will be deprecated. Instead use +// [ListClusterUserCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusterusercredentials) or +// [ListClusterAdminCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusteradmincredentials) . +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// roleName - the name of the role for managed cluster accessProfile resource. +func (client ManagedClustersClient) GetAccessProfile(ctx context.Context, resourceGroupName string, resourceName string, roleName string) (result ManagedClusterAccessProfile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetAccessProfile") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "GetAccessProfile", err.Error()) + } + + req, err := client.GetAccessProfilePreparer(ctx, resourceGroupName, resourceName, roleName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetAccessProfile", nil, "Failure preparing request") + return + } + + resp, err := client.GetAccessProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetAccessProfile", resp, "Failure sending request") + return + } + + result, err = client.GetAccessProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetAccessProfile", resp, "Failure responding to request") + return + } + + return +} + +// GetAccessProfilePreparer prepares the GetAccessProfile request. +func (client ManagedClustersClient) GetAccessProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, roleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "roleName": autorest.Encode("path", roleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAccessProfileSender sends the GetAccessProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetAccessProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAccessProfileResponder handles the response to the GetAccessProfile request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetAccessProfileResponder(resp *http.Response) (result ManagedClusterAccessProfile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCommandResult sends the get command result request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// commandID - id of the command. +func (client ManagedClustersClient) GetCommandResult(ctx context.Context, resourceGroupName string, resourceName string, commandID string) (result RunCommandResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetCommandResult") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "GetCommandResult", err.Error()) + } + + req, err := client.GetCommandResultPreparer(ctx, resourceGroupName, resourceName, commandID) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetCommandResult", nil, "Failure preparing request") + return + } + + resp, err := client.GetCommandResultSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetCommandResult", resp, "Failure sending request") + return + } + + result, err = client.GetCommandResultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetCommandResult", resp, "Failure responding to request") + return + } + + return +} + +// GetCommandResultPreparer prepares the GetCommandResult request. +func (client ManagedClustersClient) GetCommandResultPreparer(ctx context.Context, resourceGroupName string, resourceName string, commandID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "commandId": autorest.Encode("path", commandID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCommandResultSender sends the GetCommandResult request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetCommandResultSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetCommandResultResponder handles the response to the GetCommandResult request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetCommandResultResponder(resp *http.Response) (result RunCommandResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOSOptions sends the get os options request. +// Parameters: +// location - the name of a supported Azure region. +// resourceType - the resource type for which the OS options needs to be returned +func (client ManagedClustersClient) GetOSOptions(ctx context.Context, location string, resourceType string) (result OSOptionProfile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetOSOptions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetOSOptionsPreparer(ctx, location, resourceType) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetOSOptions", nil, "Failure preparing request") + return + } + + resp, err := client.GetOSOptionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetOSOptions", resp, "Failure sending request") + return + } + + result, err = client.GetOSOptionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetOSOptions", resp, "Failure responding to request") + return + } + + return +} + +// GetOSOptionsPreparer prepares the GetOSOptions request. +func (client ManagedClustersClient) GetOSOptionsPreparer(ctx context.Context, location string, resourceType string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(resourceType) > 0 { + queryParameters["resource-type"] = autorest.Encode("query", resourceType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetOSOptionsSender sends the GetOSOptions request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetOSOptionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetOSOptionsResponder handles the response to the GetOSOptions request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetOSOptionsResponder(resp *http.Response) (result OSOptionProfile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetUpgradeProfile sends the get upgrade profile request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClusterUpgradeProfile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetUpgradeProfile") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "GetUpgradeProfile", err.Error()) + } + + req, err := client.GetUpgradeProfilePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetUpgradeProfile", nil, "Failure preparing request") + return + } + + resp, err := client.GetUpgradeProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetUpgradeProfile", resp, "Failure sending request") + return + } + + result, err = client.GetUpgradeProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetUpgradeProfile", resp, "Failure responding to request") + return + } + + return +} + +// GetUpgradeProfilePreparer prepares the GetUpgradeProfile request. +func (client ManagedClustersClient) GetUpgradeProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetUpgradeProfileSender sends the GetUpgradeProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetUpgradeProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetUpgradeProfileResponder handles the response to the GetUpgradeProfile request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetUpgradeProfileResponder(resp *http.Response) (result ManagedClusterUpgradeProfile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client ManagedClustersClient) List(ctx context.Context) (result ManagedClusterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.List") + defer func() { + sc := -1 + if result.mclr.Response.Response != nil { + sc = result.mclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "List", resp, "Failure sending request") + return + } + + result.mclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "List", resp, "Failure responding to request") + return + } + if result.mclr.hasNextLink() && result.mclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ManagedClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters", 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 ManagedClustersClient) 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 ManagedClustersClient) ListResponder(resp *http.Response) (result ManagedClusterListResult, 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 ManagedClustersClient) listNextResults(ctx context.Context, lastResults ManagedClusterListResult) (result ManagedClusterListResult, err error) { + req, err := lastResults.managedClusterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "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, "containerservice.ManagedClustersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClustersClient) ListComplete(ctx context.Context) (result ManagedClusterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ManagedClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ManagedClusterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.mclr.Response.Response != nil { + sc = result.mclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.mclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.mclr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.mclr.hasNextLink() && result.mclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ManagedClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", 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 ManagedClustersClient) 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 ManagedClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ManagedClusterListResult, 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 ManagedClustersClient) listByResourceGroupNextResults(ctx context.Context, lastResults ManagedClusterListResult) (result ManagedClusterListResult, err error) { + req, err := lastResults.managedClusterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "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, "containerservice.ManagedClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ManagedClusterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.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 +} + +// ListClusterAdminCredentials sends the list cluster admin credentials request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// serverFqdn - server fqdn type for credentials to be returned +func (client ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result CredentialResults, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterAdminCredentials") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterAdminCredentials", err.Error()) + } + + req, err := client.ListClusterAdminCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListClusterAdminCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListClusterAdminCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", resp, "Failure responding to request") + return + } + + return +} + +// ListClusterAdminCredentialsPreparer prepares the ListClusterAdminCredentials request. +func (client ManagedClustersClient) ListClusterAdminCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(serverFqdn) > 0 { + queryParameters["server-fqdn"] = autorest.Encode("query", serverFqdn) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListClusterAdminCredentialsSender sends the ListClusterAdminCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListClusterAdminCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListClusterAdminCredentialsResponder handles the response to the ListClusterAdminCredentials request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListClusterAdminCredentialsResponder(resp *http.Response) (result CredentialResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListClusterMonitoringUserCredentials sends the list cluster monitoring user credentials request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// serverFqdn - server fqdn type for credentials to be returned +func (client ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result CredentialResults, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterMonitoringUserCredentials") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterMonitoringUserCredentials", err.Error()) + } + + req, err := client.ListClusterMonitoringUserCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterMonitoringUserCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListClusterMonitoringUserCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterMonitoringUserCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListClusterMonitoringUserCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterMonitoringUserCredentials", resp, "Failure responding to request") + return + } + + return +} + +// ListClusterMonitoringUserCredentialsPreparer prepares the ListClusterMonitoringUserCredentials request. +func (client ManagedClustersClient) ListClusterMonitoringUserCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(serverFqdn) > 0 { + queryParameters["server-fqdn"] = autorest.Encode("query", serverFqdn) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListClusterMonitoringUserCredentialsSender sends the ListClusterMonitoringUserCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListClusterMonitoringUserCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListClusterMonitoringUserCredentialsResponder handles the response to the ListClusterMonitoringUserCredentials request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListClusterMonitoringUserCredentialsResponder(resp *http.Response) (result CredentialResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListClusterUserCredentials sends the list cluster user credentials request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// serverFqdn - server fqdn type for credentials to be returned +func (client ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result CredentialResults, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterUserCredentials") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterUserCredentials", err.Error()) + } + + req, err := client.ListClusterUserCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListClusterUserCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListClusterUserCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", resp, "Failure responding to request") + return + } + + return +} + +// ListClusterUserCredentialsPreparer prepares the ListClusterUserCredentials request. +func (client ManagedClustersClient) ListClusterUserCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(serverFqdn) > 0 { + queryParameters["server-fqdn"] = autorest.Encode("query", serverFqdn) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListClusterUserCredentialsSender sends the ListClusterUserCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListClusterUserCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListClusterUserCredentialsResponder handles the response to the ListClusterUserCredentials request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListClusterUserCredentialsResponder(resp *http.Response) (result CredentialResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListOutboundNetworkDependenciesEndpoints gets a list of egress endpoints (network endpoints of all outbound +// dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, resourceName string) (result OutboundEnvironmentEndpointCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListOutboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.oeec.Response.Response != nil { + sc = result.oeec.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", err.Error()) + } + + result.fn = client.listOutboundNetworkDependenciesEndpointsNextResults + req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.oeec.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") + return + } + + result.oeec, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") + return + } + if result.oeec.hasNextLink() && result.oeec.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOutboundNetworkDependenciesEndpointsSender sends the ListOutboundNetworkDependenciesEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListOutboundNetworkDependenciesEndpointsResponder handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result OutboundEnvironmentEndpointCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listOutboundNetworkDependenciesEndpointsNextResults retrieves the next set of results, if any. +func (client ManagedClustersClient) listOutboundNetworkDependenciesEndpointsNextResults(ctx context.Context, lastResults OutboundEnvironmentEndpointCollection) (result OutboundEnvironmentEndpointCollection, err error) { + req, err := lastResults.outboundEnvironmentEndpointCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListOutboundNetworkDependenciesEndpointsComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, resourceName string) (result OutboundEnvironmentEndpointCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListOutboundNetworkDependenciesEndpoints") + 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.ListOutboundNetworkDependenciesEndpoints(ctx, resourceGroupName, resourceName) + return +} + +// ResetAADProfile sends the reset aad profile request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// parameters - the AAD profile to set on the Managed Cluster +func (client ManagedClustersClient) ResetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile) (result ManagedClustersResetAADProfileFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ResetAADProfile") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ResetAADProfile", err.Error()) + } + + req, err := client.ResetAADProfilePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetAADProfile", nil, "Failure preparing request") + return + } + + result, err = client.ResetAADProfileSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetAADProfile", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetAADProfilePreparer prepares the ResetAADProfile request. +func (client ManagedClustersClient) ResetAADProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetAADProfileSender sends the ResetAADProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ResetAADProfileSender(req *http.Request) (future ManagedClustersResetAADProfileFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetAADProfileResponder handles the response to the ResetAADProfile request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ResetAADProfileResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetServicePrincipalProfile this action cannot be performed on a cluster that is not using a service principal +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// parameters - the service principal profile to set on the managed cluster. +func (client ManagedClustersClient) ResetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile) (result ManagedClustersResetServicePrincipalProfileFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ResetServicePrincipalProfile") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ClientID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ResetServicePrincipalProfile", err.Error()) + } + + req, err := client.ResetServicePrincipalProfilePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetServicePrincipalProfile", nil, "Failure preparing request") + return + } + + result, err = client.ResetServicePrincipalProfileSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetServicePrincipalProfile", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetServicePrincipalProfilePreparer prepares the ResetServicePrincipalProfile request. +func (client ManagedClustersClient) ResetServicePrincipalProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetServicePrincipalProfileSender sends the ResetServicePrincipalProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ResetServicePrincipalProfileSender(req *http.Request) (future ManagedClustersResetServicePrincipalProfileFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetServicePrincipalProfileResponder handles the response to the ResetServicePrincipalProfile request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ResetServicePrincipalProfileResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RotateClusterCertificates see [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for +// more details about rotating managed cluster certificates. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) RotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersRotateClusterCertificatesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.RotateClusterCertificates") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "RotateClusterCertificates", err.Error()) + } + + req, err := client.RotateClusterCertificatesPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RotateClusterCertificates", nil, "Failure preparing request") + return + } + + result, err = client.RotateClusterCertificatesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RotateClusterCertificates", result.Response(), "Failure sending request") + return + } + + return +} + +// RotateClusterCertificatesPreparer prepares the RotateClusterCertificates request. +func (client ManagedClustersClient) RotateClusterCertificatesPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RotateClusterCertificatesSender sends the RotateClusterCertificates request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) RotateClusterCertificatesSender(req *http.Request) (future ManagedClustersRotateClusterCertificatesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RotateClusterCertificatesResponder handles the response to the RotateClusterCertificates request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) RotateClusterCertificatesResponder(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 +} + +// RunCommand AKS will create a pod to run the command. This is primarily useful for private clusters. For more +// information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// requestPayload - the run command request +func (client ManagedClustersClient) RunCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest) (result ManagedClustersRunCommandFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.RunCommand") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: requestPayload, + Constraints: []validation.Constraint{{Target: "requestPayload.Command", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "RunCommand", err.Error()) + } + + req, err := client.RunCommandPreparer(ctx, resourceGroupName, resourceName, requestPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RunCommand", nil, "Failure preparing request") + return + } + + result, err = client.RunCommandSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RunCommand", result.Response(), "Failure sending request") + return + } + + return +} + +// RunCommandPreparer prepares the RunCommand request. +func (client ManagedClustersClient) RunCommandPreparer(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand", pathParameters), + autorest.WithJSON(requestPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RunCommandSender sends the RunCommand request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) RunCommandSender(req *http.Request) (future ManagedClustersRunCommandFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RunCommandResponder handles the response to the RunCommand request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) RunCommandResponder(resp *http.Response) (result RunCommandResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start see [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about +// starting a cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) Start(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Start") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "Start", err.Error()) + } + + req, err := client.StartPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client ManagedClustersClient) StartPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) StartSender(req *http.Request) (future ManagedClustersStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) StartResponder(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 +} + +// Stop this can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the +// control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue +// charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for +// more details about stopping a cluster. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) Stop(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Stop") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client ManagedClustersClient) StopPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) StopSender(req *http.Request) (future ManagedClustersStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) StopResponder(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 +} + +// UpdateTags sends the update tags request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// parameters - parameters supplied to the Update Managed Cluster Tags operation. +func (client ManagedClustersClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result ManagedClustersUpdateTagsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.UpdateTags") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = client.UpdateTagsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "UpdateTags", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ManagedClustersClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) UpdateTagsSender(req *http.Request) (future ManagedClustersUpdateTagsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) UpdateTagsResponder(resp *http.Response) (result ManagedCluster, 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/containerservice/mgmt/2021-09-01/containerservice/models.go b/services/containerservice/mgmt/2021-09-01/containerservice/models.go new file mode 100644 index 000000000000..a8791ad80988 --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/models.go @@ -0,0 +1,3975 @@ +package containerservice + +// 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/containerservice/mgmt/2021-09-01/containerservice" + +// AccessProfile profile for enabling a user to access a managed cluster. +type AccessProfile struct { + // KubeConfig - Base64-encoded Kubernetes configuration file. + KubeConfig *[]byte `json:"kubeConfig,omitempty"` +} + +// AgentPool agent Pool. +type AgentPool struct { + autorest.Response `json:"-"` + // ManagedClusterAgentPoolProfileProperties - Properties of an agent pool. + *ManagedClusterAgentPoolProfileProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPool. +func (ap AgentPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.ManagedClusterAgentPoolProfileProperties != nil { + objectMap["properties"] = ap.ManagedClusterAgentPoolProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPool struct. +func (ap *AgentPool) 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 managedClusterAgentPoolProfileProperties ManagedClusterAgentPoolProfileProperties + err = json.Unmarshal(*v, &managedClusterAgentPoolProfileProperties) + if err != nil { + return err + } + ap.ManagedClusterAgentPoolProfileProperties = &managedClusterAgentPoolProfileProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ap.Type = &typeVar + } + } + } + + return nil +} + +// AgentPoolAvailableVersions the list of available versions for an agent pool. +type AgentPoolAvailableVersions struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the agent pool version list. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the agent pool version list. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the agent pool version list. + Type *string `json:"type,omitempty"` + // AgentPoolAvailableVersionsProperties - Properties of agent pool available versions. + *AgentPoolAvailableVersionsProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolAvailableVersions. +func (apav AgentPoolAvailableVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apav.AgentPoolAvailableVersionsProperties != nil { + objectMap["properties"] = apav.AgentPoolAvailableVersionsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPoolAvailableVersions struct. +func (apav *AgentPoolAvailableVersions) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + apav.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + apav.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + apav.Type = &typeVar + } + case "properties": + if v != nil { + var agentPoolAvailableVersionsProperties AgentPoolAvailableVersionsProperties + err = json.Unmarshal(*v, &agentPoolAvailableVersionsProperties) + if err != nil { + return err + } + apav.AgentPoolAvailableVersionsProperties = &agentPoolAvailableVersionsProperties + } + } + } + + return nil +} + +// AgentPoolAvailableVersionsProperties the list of available agent pool versions. +type AgentPoolAvailableVersionsProperties struct { + // AgentPoolVersions - List of versions available for agent pool. + AgentPoolVersions *[]AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem `json:"agentPoolVersions,omitempty"` +} + +// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem ... +type AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem struct { + // Default - Whether this version is the default agent pool version. + Default *bool `json:"default,omitempty"` + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // IsPreview - Whether Kubernetes version is currently in preview. + IsPreview *bool `json:"isPreview,omitempty"` +} + +// AgentPoolListResult the response from the List Agent Pools operation. +type AgentPoolListResult struct { + autorest.Response `json:"-"` + // Value - The list of agent pools. + Value *[]AgentPool `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of agent pool results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolListResult. +func (aplr AgentPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aplr.Value != nil { + objectMap["value"] = aplr.Value + } + return json.Marshal(objectMap) +} + +// AgentPoolListResultIterator provides access to a complete listing of AgentPool values. +type AgentPoolListResultIterator struct { + i int + page AgentPoolListResultPage +} + +// 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 *AgentPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultIterator.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 *AgentPoolListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AgentPoolListResultIterator) 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 AgentPoolListResultIterator) Response() AgentPoolListResult { + 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 AgentPoolListResultIterator) Value() AgentPool { + if !iter.page.NotDone() { + return AgentPool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AgentPoolListResultIterator type. +func NewAgentPoolListResultIterator(page AgentPoolListResultPage) AgentPoolListResultIterator { + return AgentPoolListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aplr AgentPoolListResult) IsEmpty() bool { + return aplr.Value == nil || len(*aplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aplr AgentPoolListResult) hasNextLink() bool { + return aplr.NextLink != nil && len(*aplr.NextLink) != 0 +} + +// agentPoolListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aplr AgentPoolListResult) agentPoolListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aplr.NextLink))) +} + +// AgentPoolListResultPage contains a page of AgentPool values. +type AgentPoolListResultPage struct { + fn func(context.Context, AgentPoolListResult) (AgentPoolListResult, error) + aplr AgentPoolListResult +} + +// 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 *AgentPoolListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultPage.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.aplr) + if err != nil { + return err + } + page.aplr = 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 *AgentPoolListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AgentPoolListResultPage) NotDone() bool { + return !page.aplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AgentPoolListResultPage) Response() AgentPoolListResult { + return page.aplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AgentPoolListResultPage) Values() []AgentPool { + if page.aplr.IsEmpty() { + return nil + } + return *page.aplr.Value +} + +// Creates a new instance of the AgentPoolListResultPage type. +func NewAgentPoolListResultPage(cur AgentPoolListResult, getNextPage func(context.Context, AgentPoolListResult) (AgentPoolListResult, error)) AgentPoolListResultPage { + return AgentPoolListResultPage{ + fn: getNextPage, + aplr: cur, + } +} + +// AgentPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AgentPoolsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (AgentPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsCreateOrUpdateFuture) 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 AgentPoolsCreateOrUpdateFuture.Result. +func (future *AgentPoolsCreateOrUpdateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { + ap, err = client.CreateOrUpdateResponder(ap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsCreateOrUpdateFuture", "Result", ap.Response.Response, "Failure responding to request") + } + } + return +} + +// AgentPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AgentPoolsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsDeleteFuture) 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 AgentPoolsDeleteFuture.Result. +func (future *AgentPoolsDeleteFuture) result(client AgentPoolsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AgentPoolsUpgradeNodeImageVersionFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AgentPoolsUpgradeNodeImageVersionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (AgentPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsUpgradeNodeImageVersionFuture) 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 AgentPoolsUpgradeNodeImageVersionFuture.Result. +func (future *AgentPoolsUpgradeNodeImageVersionFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsUpgradeNodeImageVersionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsUpgradeNodeImageVersionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { + ap, err = client.UpgradeNodeImageVersionResponder(ap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsUpgradeNodeImageVersionFuture", "Result", ap.Response.Response, "Failure responding to request") + } + } + return +} + +// AgentPoolUpgradeProfile the list of available upgrades for an agent pool. +type AgentPoolUpgradeProfile struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the agent pool upgrade profile. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the agent pool upgrade profile. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the agent pool upgrade profile. + Type *string `json:"type,omitempty"` + // AgentPoolUpgradeProfileProperties - The properties of the agent pool upgrade profile. + *AgentPoolUpgradeProfileProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolUpgradeProfile. +func (apup AgentPoolUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apup.AgentPoolUpgradeProfileProperties != nil { + objectMap["properties"] = apup.AgentPoolUpgradeProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPoolUpgradeProfile struct. +func (apup *AgentPoolUpgradeProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + apup.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + apup.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + apup.Type = &typeVar + } + case "properties": + if v != nil { + var agentPoolUpgradeProfileProperties AgentPoolUpgradeProfileProperties + err = json.Unmarshal(*v, &agentPoolUpgradeProfileProperties) + if err != nil { + return err + } + apup.AgentPoolUpgradeProfileProperties = &agentPoolUpgradeProfileProperties + } + } + } + + return nil +} + +// AgentPoolUpgradeProfileProperties the list of available upgrade versions. +type AgentPoolUpgradeProfileProperties struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // Upgrades - List of orchestrator types and versions available for upgrade. + Upgrades *[]AgentPoolUpgradeProfilePropertiesUpgradesItem `json:"upgrades,omitempty"` + // LatestNodeImageVersion - The latest AKS supported node image version. + LatestNodeImageVersion *string `json:"latestNodeImageVersion,omitempty"` +} + +// AgentPoolUpgradeProfilePropertiesUpgradesItem ... +type AgentPoolUpgradeProfilePropertiesUpgradesItem struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // IsPreview - Whether the Kubernetes version is currently in preview. + IsPreview *bool `json:"isPreview,omitempty"` +} + +// AgentPoolUpgradeSettings settings for upgrading an agentpool +type AgentPoolUpgradeSettings struct { + // MaxSurge - This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade + MaxSurge *string `json:"maxSurge,omitempty"` +} + +// CloudError an error response from the Container service. +type CloudError struct { + // Error - Details about the error. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the Container service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// CommandResultProperties the results of a run command +type CommandResultProperties struct { + // ProvisioningState - READ-ONLY; provisioning State + ProvisioningState *string `json:"provisioningState,omitempty"` + // ExitCode - READ-ONLY; The exit code of the command + ExitCode *int32 `json:"exitCode,omitempty"` + // StartedAt - READ-ONLY; The time when the command started. + StartedAt *date.Time `json:"startedAt,omitempty"` + // FinishedAt - READ-ONLY; The time when the command finished. + FinishedAt *date.Time `json:"finishedAt,omitempty"` + // Logs - READ-ONLY; The command output. + Logs *string `json:"logs,omitempty"` + // Reason - READ-ONLY; An explanation of why provisioningState is set to failed (if so). + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for CommandResultProperties. +func (crp CommandResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CreationData data used when creating a target resource from a source resource. +type CreationData struct { + // SourceResourceID - This is the ARM ID of the source object to be used to create the target object. + SourceResourceID *string `json:"sourceResourceId,omitempty"` +} + +// CredentialResult the credential result response. +type CredentialResult struct { + // Name - READ-ONLY; The name of the credential. + Name *string `json:"name,omitempty"` + // Value - READ-ONLY; Base64-encoded Kubernetes configuration file. + Value *[]byte `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for CredentialResult. +func (cr CredentialResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CredentialResults the list credential result response. +type CredentialResults struct { + autorest.Response `json:"-"` + // Kubeconfigs - READ-ONLY; Base64-encoded Kubernetes configuration file. + Kubeconfigs *[]CredentialResult `json:"kubeconfigs,omitempty"` +} + +// MarshalJSON is the custom marshaler for CredentialResults. +func (cr CredentialResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DiagnosticsProfile profile for diagnostics on the container service cluster. +type DiagnosticsProfile struct { + // VMDiagnostics - Profile for diagnostics on the container service VMs. + VMDiagnostics *VMDiagnostics `json:"vmDiagnostics,omitempty"` +} + +// EndpointDependency a domain name that AKS agent nodes are reaching at. +type EndpointDependency struct { + // DomainName - The domain name of the dependency. + DomainName *string `json:"domainName,omitempty"` + // EndpointDetails - The Ports and Protocols used when connecting to domainName. + EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` +} + +// EndpointDetail connect information from the AKS agent nodes to a single endpoint. +type EndpointDetail struct { + // IPAddress - An IP Address that Domain Name currently resolves to. + IPAddress *string `json:"ipAddress,omitempty"` + // Port - The port an endpoint is connected to. + Port *int32 `json:"port,omitempty"` + // Protocol - The protocol used for connection + Protocol *string `json:"protocol,omitempty"` + // Description - Description of the detail + Description *string `json:"description,omitempty"` +} + +// ExtendedLocation the complex type of the extended location. +type ExtendedLocation struct { + // Name - The name of the extended location. + Name *string `json:"name,omitempty"` + // Type - The type of the extended location. Possible values include: 'ExtendedLocationTypesEdgeZone' + Type ExtendedLocationTypes `json:"type,omitempty"` +} + +// KubeletConfig see [AKS custom node +// configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. +type KubeletConfig struct { + // CPUManagerPolicy - The default is 'none'. See [Kubernetes CPU management policies](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#cpu-management-policies) for more information. Allowed values are 'none' and 'static'. + CPUManagerPolicy *string `json:"cpuManagerPolicy,omitempty"` + // CPUCfsQuota - The default is true. + CPUCfsQuota *bool `json:"cpuCfsQuota,omitempty"` + // CPUCfsQuotaPeriod - The default is '100ms.' Valid values are a sequence of decimal numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported units are 'ns', 'us', 'ms', 's', 'm', and 'h'. + CPUCfsQuotaPeriod *string `json:"cpuCfsQuotaPeriod,omitempty"` + // ImageGcHighThreshold - To disable image garbage collection, set to 100. The default is 85% + ImageGcHighThreshold *int32 `json:"imageGcHighThreshold,omitempty"` + // ImageGcLowThreshold - This cannot be set higher than imageGcHighThreshold. The default is 80% + ImageGcLowThreshold *int32 `json:"imageGcLowThreshold,omitempty"` + // TopologyManagerPolicy - For more information see [Kubernetes Topology Manager](https://kubernetes.io/docs/tasks/administer-cluster/topology-manager). The default is 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. + TopologyManagerPolicy *string `json:"topologyManagerPolicy,omitempty"` + // AllowedUnsafeSysctls - Allowed list of unsafe sysctls or unsafe sysctl patterns (ending in `*`). + AllowedUnsafeSysctls *[]string `json:"allowedUnsafeSysctls,omitempty"` + // FailSwapOn - If set to true it will make the Kubelet fail to start if swap is enabled on the node. + FailSwapOn *bool `json:"failSwapOn,omitempty"` + // ContainerLogMaxSizeMB - The maximum size (e.g. 10Mi) of container log file before it is rotated. + ContainerLogMaxSizeMB *int32 `json:"containerLogMaxSizeMB,omitempty"` + // ContainerLogMaxFiles - The maximum number of container log files that can be present for a container. The number must be ≥ 2. + ContainerLogMaxFiles *int32 `json:"containerLogMaxFiles,omitempty"` + // PodMaxPids - The maximum number of processes per pod. + PodMaxPids *int32 `json:"podMaxPids,omitempty"` +} + +// LinuxOSConfig see [AKS custom node +// configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. +type LinuxOSConfig struct { + // Sysctls - Sysctl settings for Linux agent nodes. + Sysctls *SysctlConfig `json:"sysctls,omitempty"` + // TransparentHugePageEnabled - Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). + TransparentHugePageEnabled *string `json:"transparentHugePageEnabled,omitempty"` + // TransparentHugePageDefrag - Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). + TransparentHugePageDefrag *string `json:"transparentHugePageDefrag,omitempty"` + // SwapFileSizeMB - The size in MB of a swap file that will be created on each node. + SwapFileSizeMB *int32 `json:"swapFileSizeMB,omitempty"` +} + +// LinuxProfile profile for Linux VMs in the container service cluster. +type LinuxProfile struct { + // AdminUsername - The administrator username to use for Linux VMs. + AdminUsername *string `json:"adminUsername,omitempty"` + // SSH - The SSH configuration for Linux-based VMs running on Azure. + SSH *SSHConfiguration `json:"ssh,omitempty"` +} + +// MaintenanceConfiguration see [planned +// maintenance](https://docs.microsoft.com/azure/aks/planned-maintenance) for more information about +// planned maintenance. +type MaintenanceConfiguration struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // MaintenanceConfigurationProperties - Properties of a default maintenance configuration. + *MaintenanceConfigurationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MaintenanceConfiguration. +func (mc MaintenanceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.MaintenanceConfigurationProperties != nil { + objectMap["properties"] = mc.MaintenanceConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MaintenanceConfiguration struct. +func (mc *MaintenanceConfiguration) 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mc.SystemData = &systemData + } + case "properties": + if v != nil { + var maintenanceConfigurationProperties MaintenanceConfigurationProperties + err = json.Unmarshal(*v, &maintenanceConfigurationProperties) + if err != nil { + return err + } + mc.MaintenanceConfigurationProperties = &maintenanceConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mc.Type = &typeVar + } + } + } + + return nil +} + +// MaintenanceConfigurationListResult the response from the List maintenance configurations operation. +type MaintenanceConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - The list of maintenance configurations. + Value *[]MaintenanceConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of maintenance configuration results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for MaintenanceConfigurationListResult. +func (mclr MaintenanceConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mclr.Value != nil { + objectMap["value"] = mclr.Value + } + return json.Marshal(objectMap) +} + +// MaintenanceConfigurationListResultIterator provides access to a complete listing of +// MaintenanceConfiguration values. +type MaintenanceConfigurationListResultIterator struct { + i int + page MaintenanceConfigurationListResultPage +} + +// 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 *MaintenanceConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationListResultIterator.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 *MaintenanceConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MaintenanceConfigurationListResultIterator) 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 MaintenanceConfigurationListResultIterator) Response() MaintenanceConfigurationListResult { + 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 MaintenanceConfigurationListResultIterator) Value() MaintenanceConfiguration { + if !iter.page.NotDone() { + return MaintenanceConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MaintenanceConfigurationListResultIterator type. +func NewMaintenanceConfigurationListResultIterator(page MaintenanceConfigurationListResultPage) MaintenanceConfigurationListResultIterator { + return MaintenanceConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mclr MaintenanceConfigurationListResult) IsEmpty() bool { + return mclr.Value == nil || len(*mclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mclr MaintenanceConfigurationListResult) hasNextLink() bool { + return mclr.NextLink != nil && len(*mclr.NextLink) != 0 +} + +// maintenanceConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mclr MaintenanceConfigurationListResult) maintenanceConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mclr.NextLink))) +} + +// MaintenanceConfigurationListResultPage contains a page of MaintenanceConfiguration values. +type MaintenanceConfigurationListResultPage struct { + fn func(context.Context, MaintenanceConfigurationListResult) (MaintenanceConfigurationListResult, error) + mclr MaintenanceConfigurationListResult +} + +// 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 *MaintenanceConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationListResultPage.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.mclr) + if err != nil { + return err + } + page.mclr = 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 *MaintenanceConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MaintenanceConfigurationListResultPage) NotDone() bool { + return !page.mclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MaintenanceConfigurationListResultPage) Response() MaintenanceConfigurationListResult { + return page.mclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MaintenanceConfigurationListResultPage) Values() []MaintenanceConfiguration { + if page.mclr.IsEmpty() { + return nil + } + return *page.mclr.Value +} + +// Creates a new instance of the MaintenanceConfigurationListResultPage type. +func NewMaintenanceConfigurationListResultPage(cur MaintenanceConfigurationListResult, getNextPage func(context.Context, MaintenanceConfigurationListResult) (MaintenanceConfigurationListResult, error)) MaintenanceConfigurationListResultPage { + return MaintenanceConfigurationListResultPage{ + fn: getNextPage, + mclr: cur, + } +} + +// MaintenanceConfigurationProperties properties used to configure planned maintenance for a Managed +// Cluster. +type MaintenanceConfigurationProperties struct { + // TimeInWeek - If two array entries specify the same day of the week, the applied configuration is the union of times in both entries. + TimeInWeek *[]TimeInWeek `json:"timeInWeek,omitempty"` + // NotAllowedTime - Time slots on which upgrade is not allowed. + NotAllowedTime *[]TimeSpan `json:"notAllowedTime,omitempty"` +} + +// ManagedCluster managed cluster. +type ManagedCluster struct { + autorest.Response `json:"-"` + // Sku - The managed cluster SKU. + Sku *ManagedClusterSKU `json:"sku,omitempty"` + // ExtendedLocation - The extended location of the Virtual Machine. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Identity - The identity of the managed cluster, if configured. + Identity *ManagedClusterIdentity `json:"identity,omitempty"` + // ManagedClusterProperties - Properties of a managed cluster. + *ManagedClusterProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ManagedCluster. +func (mc ManagedCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.Sku != nil { + objectMap["sku"] = mc.Sku + } + if mc.ExtendedLocation != nil { + objectMap["extendedLocation"] = mc.ExtendedLocation + } + if mc.Identity != nil { + objectMap["identity"] = mc.Identity + } + if mc.ManagedClusterProperties != nil { + objectMap["properties"] = mc.ManagedClusterProperties + } + if mc.Location != nil { + objectMap["location"] = mc.Location + } + if mc.Tags != nil { + objectMap["tags"] = mc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedCluster struct. +func (mc *ManagedCluster) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku ManagedClusterSKU + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + mc.Sku = &sku + } + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + mc.ExtendedLocation = &extendedLocation + } + case "identity": + if v != nil { + var identity ManagedClusterIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + mc.Identity = &identity + } + case "properties": + if v != nil { + var managedClusterProperties ManagedClusterProperties + err = json.Unmarshal(*v, &managedClusterProperties) + if err != nil { + return err + } + mc.ManagedClusterProperties = &managedClusterProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mc.Tags = tags + } + } + } + + return nil +} + +// ManagedClusterAADProfile for more details see [managed AAD on +// AKS](https://docs.microsoft.com/azure/aks/managed-aad). +type ManagedClusterAADProfile struct { + // Managed - Whether to enable managed AAD. + Managed *bool `json:"managed,omitempty"` + // EnableAzureRBAC - Whether to enable Azure RBAC for Kubernetes authorization. + EnableAzureRBAC *bool `json:"enableAzureRBAC,omitempty"` + // AdminGroupObjectIDs - The list of AAD group object IDs that will have admin role of the cluster. + AdminGroupObjectIDs *[]string `json:"adminGroupObjectIDs,omitempty"` + // ClientAppID - The client AAD application ID. + ClientAppID *string `json:"clientAppID,omitempty"` + // ServerAppID - The server AAD application ID. + ServerAppID *string `json:"serverAppID,omitempty"` + // ServerAppSecret - The server AAD application secret. + ServerAppSecret *string `json:"serverAppSecret,omitempty"` + // TenantID - The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. + TenantID *string `json:"tenantID,omitempty"` +} + +// ManagedClusterAccessProfile managed cluster Access Profile. +type ManagedClusterAccessProfile struct { + autorest.Response `json:"-"` + // AccessProfile - AccessProfile of a managed cluster. + *AccessProfile `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAccessProfile. +func (mcap ManagedClusterAccessProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcap.AccessProfile != nil { + objectMap["properties"] = mcap.AccessProfile + } + if mcap.Location != nil { + objectMap["location"] = mcap.Location + } + if mcap.Tags != nil { + objectMap["tags"] = mcap.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedClusterAccessProfile struct. +func (mcap *ManagedClusterAccessProfile) 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 accessProfile AccessProfile + err = json.Unmarshal(*v, &accessProfile) + if err != nil { + return err + } + mcap.AccessProfile = &accessProfile + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mcap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mcap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mcap.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mcap.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mcap.Tags = tags + } + } + } + + return nil +} + +// ManagedClusterAddonProfile a Kubernetes add-on profile for a managed cluster. +type ManagedClusterAddonProfile struct { + // Enabled - Whether the add-on is enabled or not. + Enabled *bool `json:"enabled,omitempty"` + // Config - Key-value pairs for configuring an add-on. + Config map[string]*string `json:"config"` + // Identity - READ-ONLY; Information of user assigned identity used by this add-on. + Identity *ManagedClusterAddonProfileIdentity `json:"identity,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAddonProfile. +func (mcap ManagedClusterAddonProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcap.Enabled != nil { + objectMap["enabled"] = mcap.Enabled + } + if mcap.Config != nil { + objectMap["config"] = mcap.Config + } + return json.Marshal(objectMap) +} + +// ManagedClusterAddonProfileIdentity information of user assigned identity used by this add-on. +type ManagedClusterAddonProfileIdentity struct { + // ResourceID - The resource ID of the user assigned identity. + ResourceID *string `json:"resourceId,omitempty"` + // ClientID - The client ID of the user assigned identity. + ClientID *string `json:"clientId,omitempty"` + // ObjectID - The object ID of the user assigned identity. + ObjectID *string `json:"objectId,omitempty"` +} + +// ManagedClusterAgentPoolProfile profile for the container service agent pool. +type ManagedClusterAgentPoolProfile struct { + // Name - Windows agent pool names must be 6 characters or less. + Name *string `json:"name,omitempty"` + // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + Count *int32 `json:"count,omitempty"` + // VMSize - VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions + VMSize *string `json:"vmSize,omitempty"` + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // OsDiskType - Possible values include: 'OSDiskTypeManaged', 'OSDiskTypeEphemeral' + OsDiskType OSDiskType `json:"osDiskType,omitempty"` + // KubeletDiskType - Possible values include: 'KubeletDiskTypeOS', 'KubeletDiskTypeTemporary' + KubeletDiskType KubeletDiskType `json:"kubeletDiskType,omitempty"` + // WorkloadRuntime - Possible values include: 'WorkloadRuntimeOCIContainer', 'WorkloadRuntimeWasmWasi' + WorkloadRuntime WorkloadRuntime `json:"workloadRuntime,omitempty"` + // VnetSubnetID - If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // PodSubnetID - If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + PodSubnetID *string `json:"podSubnetID,omitempty"` + // MaxPods - The maximum number of pods that can run on a node. + MaxPods *int32 `json:"maxPods,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // OsSKU - Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' + OsSKU OSSKU `json:"osSKU,omitempty"` + // MaxCount - The maximum number of nodes for auto-scaling + MaxCount *int32 `json:"maxCount,omitempty"` + // MinCount - The minimum number of nodes for auto-scaling + MinCount *int32 `json:"minCount,omitempty"` + // EnableAutoScaling - Whether to enable auto-scaler + EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` + // ScaleDownMode - This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. Possible values include: 'ScaleDownModeDelete', 'ScaleDownModeDeallocate' + ScaleDownMode ScaleDownMode `json:"scaleDownMode,omitempty"` + // Type - Possible values include: 'AgentPoolTypeVirtualMachineScaleSets', 'AgentPoolTypeAvailabilitySet' + Type AgentPoolType `json:"type,omitempty"` + // Mode - Possible values include: 'AgentPoolModeSystem', 'AgentPoolModeUser' + Mode AgentPoolMode `json:"mode,omitempty"` + // OrchestratorVersion - As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` + // NodeImageVersion - READ-ONLY; The version of node image + NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // UpgradeSettings - Settings for upgrading the agentpool + UpgradeSettings *AgentPoolUpgradeSettings `json:"upgradeSettings,omitempty"` + // ProvisioningState - READ-ONLY; The current deployment or provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PowerState - When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded + PowerState *PowerState `json:"powerState,omitempty"` + // AvailabilityZones - The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + AvailabilityZones *[]string `json:"availabilityZones,omitempty"` + // EnableNodePublicIP - Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` + // NodePublicIPPrefixID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName} + NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"` + // ScaleSetPriority - The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. Possible values include: 'ScaleSetPrioritySpot', 'ScaleSetPriorityRegular' + ScaleSetPriority ScaleSetPriority `json:"scaleSetPriority,omitempty"` + // ScaleSetEvictionPolicy - This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. Possible values include: 'ScaleSetEvictionPolicyDelete', 'ScaleSetEvictionPolicyDeallocate' + ScaleSetEvictionPolicy ScaleSetEvictionPolicy `json:"scaleSetEvictionPolicy,omitempty"` + // SpotMaxPrice - Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing) + SpotMaxPrice *float64 `json:"spotMaxPrice,omitempty"` + // Tags - The tags to be persisted on the agent pool virtual machine scale set. + Tags map[string]*string `json:"tags"` + // NodeLabels - The node labels to be persisted across all nodes in agent pool. + NodeLabels map[string]*string `json:"nodeLabels"` + // NodeTaints - The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + NodeTaints *[]string `json:"nodeTaints,omitempty"` + // ProximityPlacementGroupID - The ID for Proximity Placement Group. + ProximityPlacementGroupID *string `json:"proximityPlacementGroupID,omitempty"` + // KubeletConfig - The Kubelet configuration on the agent pool nodes. + KubeletConfig *KubeletConfig `json:"kubeletConfig,omitempty"` + // LinuxOSConfig - The OS configuration of Linux agent nodes. + LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"` + // EnableEncryptionAtHost - This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption + EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"` + // EnableUltraSSD - Whether to enable UltraSSD + EnableUltraSSD *bool `json:"enableUltraSSD,omitempty"` + // EnableFIPS - See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + EnableFIPS *bool `json:"enableFIPS,omitempty"` + // GpuInstanceProfile - GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Possible values include: 'GPUInstanceProfileMIG1g', 'GPUInstanceProfileMIG2g', 'GPUInstanceProfileMIG3g', 'GPUInstanceProfileMIG4g', 'GPUInstanceProfileMIG7g' + GpuInstanceProfile GPUInstanceProfile `json:"gpuInstanceProfile,omitempty"` + // CreationData - CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + CreationData *CreationData `json:"creationData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAgentPoolProfile. +func (mcapp ManagedClusterAgentPoolProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcapp.Name != nil { + objectMap["name"] = mcapp.Name + } + if mcapp.Count != nil { + objectMap["count"] = mcapp.Count + } + if mcapp.VMSize != nil { + objectMap["vmSize"] = mcapp.VMSize + } + if mcapp.OsDiskSizeGB != nil { + objectMap["osDiskSizeGB"] = mcapp.OsDiskSizeGB + } + if mcapp.OsDiskType != "" { + objectMap["osDiskType"] = mcapp.OsDiskType + } + if mcapp.KubeletDiskType != "" { + objectMap["kubeletDiskType"] = mcapp.KubeletDiskType + } + if mcapp.WorkloadRuntime != "" { + objectMap["workloadRuntime"] = mcapp.WorkloadRuntime + } + if mcapp.VnetSubnetID != nil { + objectMap["vnetSubnetID"] = mcapp.VnetSubnetID + } + if mcapp.PodSubnetID != nil { + objectMap["podSubnetID"] = mcapp.PodSubnetID + } + if mcapp.MaxPods != nil { + objectMap["maxPods"] = mcapp.MaxPods + } + if mcapp.OsType != "" { + objectMap["osType"] = mcapp.OsType + } + if mcapp.OsSKU != "" { + objectMap["osSKU"] = mcapp.OsSKU + } + if mcapp.MaxCount != nil { + objectMap["maxCount"] = mcapp.MaxCount + } + if mcapp.MinCount != nil { + objectMap["minCount"] = mcapp.MinCount + } + if mcapp.EnableAutoScaling != nil { + objectMap["enableAutoScaling"] = mcapp.EnableAutoScaling + } + if mcapp.ScaleDownMode != "" { + objectMap["scaleDownMode"] = mcapp.ScaleDownMode + } + if mcapp.Type != "" { + objectMap["type"] = mcapp.Type + } + if mcapp.Mode != "" { + objectMap["mode"] = mcapp.Mode + } + if mcapp.OrchestratorVersion != nil { + objectMap["orchestratorVersion"] = mcapp.OrchestratorVersion + } + if mcapp.UpgradeSettings != nil { + objectMap["upgradeSettings"] = mcapp.UpgradeSettings + } + if mcapp.PowerState != nil { + objectMap["powerState"] = mcapp.PowerState + } + if mcapp.AvailabilityZones != nil { + objectMap["availabilityZones"] = mcapp.AvailabilityZones + } + if mcapp.EnableNodePublicIP != nil { + objectMap["enableNodePublicIP"] = mcapp.EnableNodePublicIP + } + if mcapp.NodePublicIPPrefixID != nil { + objectMap["nodePublicIPPrefixID"] = mcapp.NodePublicIPPrefixID + } + if mcapp.ScaleSetPriority != "" { + objectMap["scaleSetPriority"] = mcapp.ScaleSetPriority + } + if mcapp.ScaleSetEvictionPolicy != "" { + objectMap["scaleSetEvictionPolicy"] = mcapp.ScaleSetEvictionPolicy + } + if mcapp.SpotMaxPrice != nil { + objectMap["spotMaxPrice"] = mcapp.SpotMaxPrice + } + if mcapp.Tags != nil { + objectMap["tags"] = mcapp.Tags + } + if mcapp.NodeLabels != nil { + objectMap["nodeLabels"] = mcapp.NodeLabels + } + if mcapp.NodeTaints != nil { + objectMap["nodeTaints"] = mcapp.NodeTaints + } + if mcapp.ProximityPlacementGroupID != nil { + objectMap["proximityPlacementGroupID"] = mcapp.ProximityPlacementGroupID + } + if mcapp.KubeletConfig != nil { + objectMap["kubeletConfig"] = mcapp.KubeletConfig + } + if mcapp.LinuxOSConfig != nil { + objectMap["linuxOSConfig"] = mcapp.LinuxOSConfig + } + if mcapp.EnableEncryptionAtHost != nil { + objectMap["enableEncryptionAtHost"] = mcapp.EnableEncryptionAtHost + } + if mcapp.EnableUltraSSD != nil { + objectMap["enableUltraSSD"] = mcapp.EnableUltraSSD + } + if mcapp.EnableFIPS != nil { + objectMap["enableFIPS"] = mcapp.EnableFIPS + } + if mcapp.GpuInstanceProfile != "" { + objectMap["gpuInstanceProfile"] = mcapp.GpuInstanceProfile + } + if mcapp.CreationData != nil { + objectMap["creationData"] = mcapp.CreationData + } + return json.Marshal(objectMap) +} + +// ManagedClusterAgentPoolProfileProperties properties for the container service agent pool profile. +type ManagedClusterAgentPoolProfileProperties struct { + // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + Count *int32 `json:"count,omitempty"` + // VMSize - VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions + VMSize *string `json:"vmSize,omitempty"` + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // OsDiskType - Possible values include: 'OSDiskTypeManaged', 'OSDiskTypeEphemeral' + OsDiskType OSDiskType `json:"osDiskType,omitempty"` + // KubeletDiskType - Possible values include: 'KubeletDiskTypeOS', 'KubeletDiskTypeTemporary' + KubeletDiskType KubeletDiskType `json:"kubeletDiskType,omitempty"` + // WorkloadRuntime - Possible values include: 'WorkloadRuntimeOCIContainer', 'WorkloadRuntimeWasmWasi' + WorkloadRuntime WorkloadRuntime `json:"workloadRuntime,omitempty"` + // VnetSubnetID - If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // PodSubnetID - If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + PodSubnetID *string `json:"podSubnetID,omitempty"` + // MaxPods - The maximum number of pods that can run on a node. + MaxPods *int32 `json:"maxPods,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // OsSKU - Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' + OsSKU OSSKU `json:"osSKU,omitempty"` + // MaxCount - The maximum number of nodes for auto-scaling + MaxCount *int32 `json:"maxCount,omitempty"` + // MinCount - The minimum number of nodes for auto-scaling + MinCount *int32 `json:"minCount,omitempty"` + // EnableAutoScaling - Whether to enable auto-scaler + EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` + // ScaleDownMode - This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. Possible values include: 'ScaleDownModeDelete', 'ScaleDownModeDeallocate' + ScaleDownMode ScaleDownMode `json:"scaleDownMode,omitempty"` + // Type - Possible values include: 'AgentPoolTypeVirtualMachineScaleSets', 'AgentPoolTypeAvailabilitySet' + Type AgentPoolType `json:"type,omitempty"` + // Mode - Possible values include: 'AgentPoolModeSystem', 'AgentPoolModeUser' + Mode AgentPoolMode `json:"mode,omitempty"` + // OrchestratorVersion - As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` + // NodeImageVersion - READ-ONLY; The version of node image + NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // UpgradeSettings - Settings for upgrading the agentpool + UpgradeSettings *AgentPoolUpgradeSettings `json:"upgradeSettings,omitempty"` + // ProvisioningState - READ-ONLY; The current deployment or provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PowerState - When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded + PowerState *PowerState `json:"powerState,omitempty"` + // AvailabilityZones - The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + AvailabilityZones *[]string `json:"availabilityZones,omitempty"` + // EnableNodePublicIP - Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` + // NodePublicIPPrefixID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName} + NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"` + // ScaleSetPriority - The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. Possible values include: 'ScaleSetPrioritySpot', 'ScaleSetPriorityRegular' + ScaleSetPriority ScaleSetPriority `json:"scaleSetPriority,omitempty"` + // ScaleSetEvictionPolicy - This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. Possible values include: 'ScaleSetEvictionPolicyDelete', 'ScaleSetEvictionPolicyDeallocate' + ScaleSetEvictionPolicy ScaleSetEvictionPolicy `json:"scaleSetEvictionPolicy,omitempty"` + // SpotMaxPrice - Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing) + SpotMaxPrice *float64 `json:"spotMaxPrice,omitempty"` + // Tags - The tags to be persisted on the agent pool virtual machine scale set. + Tags map[string]*string `json:"tags"` + // NodeLabels - The node labels to be persisted across all nodes in agent pool. + NodeLabels map[string]*string `json:"nodeLabels"` + // NodeTaints - The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + NodeTaints *[]string `json:"nodeTaints,omitempty"` + // ProximityPlacementGroupID - The ID for Proximity Placement Group. + ProximityPlacementGroupID *string `json:"proximityPlacementGroupID,omitempty"` + // KubeletConfig - The Kubelet configuration on the agent pool nodes. + KubeletConfig *KubeletConfig `json:"kubeletConfig,omitempty"` + // LinuxOSConfig - The OS configuration of Linux agent nodes. + LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"` + // EnableEncryptionAtHost - This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption + EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"` + // EnableUltraSSD - Whether to enable UltraSSD + EnableUltraSSD *bool `json:"enableUltraSSD,omitempty"` + // EnableFIPS - See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + EnableFIPS *bool `json:"enableFIPS,omitempty"` + // GpuInstanceProfile - GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Possible values include: 'GPUInstanceProfileMIG1g', 'GPUInstanceProfileMIG2g', 'GPUInstanceProfileMIG3g', 'GPUInstanceProfileMIG4g', 'GPUInstanceProfileMIG7g' + GpuInstanceProfile GPUInstanceProfile `json:"gpuInstanceProfile,omitempty"` + // CreationData - CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + CreationData *CreationData `json:"creationData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAgentPoolProfileProperties. +func (mcappp ManagedClusterAgentPoolProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcappp.Count != nil { + objectMap["count"] = mcappp.Count + } + if mcappp.VMSize != nil { + objectMap["vmSize"] = mcappp.VMSize + } + if mcappp.OsDiskSizeGB != nil { + objectMap["osDiskSizeGB"] = mcappp.OsDiskSizeGB + } + if mcappp.OsDiskType != "" { + objectMap["osDiskType"] = mcappp.OsDiskType + } + if mcappp.KubeletDiskType != "" { + objectMap["kubeletDiskType"] = mcappp.KubeletDiskType + } + if mcappp.WorkloadRuntime != "" { + objectMap["workloadRuntime"] = mcappp.WorkloadRuntime + } + if mcappp.VnetSubnetID != nil { + objectMap["vnetSubnetID"] = mcappp.VnetSubnetID + } + if mcappp.PodSubnetID != nil { + objectMap["podSubnetID"] = mcappp.PodSubnetID + } + if mcappp.MaxPods != nil { + objectMap["maxPods"] = mcappp.MaxPods + } + if mcappp.OsType != "" { + objectMap["osType"] = mcappp.OsType + } + if mcappp.OsSKU != "" { + objectMap["osSKU"] = mcappp.OsSKU + } + if mcappp.MaxCount != nil { + objectMap["maxCount"] = mcappp.MaxCount + } + if mcappp.MinCount != nil { + objectMap["minCount"] = mcappp.MinCount + } + if mcappp.EnableAutoScaling != nil { + objectMap["enableAutoScaling"] = mcappp.EnableAutoScaling + } + if mcappp.ScaleDownMode != "" { + objectMap["scaleDownMode"] = mcappp.ScaleDownMode + } + if mcappp.Type != "" { + objectMap["type"] = mcappp.Type + } + if mcappp.Mode != "" { + objectMap["mode"] = mcappp.Mode + } + if mcappp.OrchestratorVersion != nil { + objectMap["orchestratorVersion"] = mcappp.OrchestratorVersion + } + if mcappp.UpgradeSettings != nil { + objectMap["upgradeSettings"] = mcappp.UpgradeSettings + } + if mcappp.PowerState != nil { + objectMap["powerState"] = mcappp.PowerState + } + if mcappp.AvailabilityZones != nil { + objectMap["availabilityZones"] = mcappp.AvailabilityZones + } + if mcappp.EnableNodePublicIP != nil { + objectMap["enableNodePublicIP"] = mcappp.EnableNodePublicIP + } + if mcappp.NodePublicIPPrefixID != nil { + objectMap["nodePublicIPPrefixID"] = mcappp.NodePublicIPPrefixID + } + if mcappp.ScaleSetPriority != "" { + objectMap["scaleSetPriority"] = mcappp.ScaleSetPriority + } + if mcappp.ScaleSetEvictionPolicy != "" { + objectMap["scaleSetEvictionPolicy"] = mcappp.ScaleSetEvictionPolicy + } + if mcappp.SpotMaxPrice != nil { + objectMap["spotMaxPrice"] = mcappp.SpotMaxPrice + } + if mcappp.Tags != nil { + objectMap["tags"] = mcappp.Tags + } + if mcappp.NodeLabels != nil { + objectMap["nodeLabels"] = mcappp.NodeLabels + } + if mcappp.NodeTaints != nil { + objectMap["nodeTaints"] = mcappp.NodeTaints + } + if mcappp.ProximityPlacementGroupID != nil { + objectMap["proximityPlacementGroupID"] = mcappp.ProximityPlacementGroupID + } + if mcappp.KubeletConfig != nil { + objectMap["kubeletConfig"] = mcappp.KubeletConfig + } + if mcappp.LinuxOSConfig != nil { + objectMap["linuxOSConfig"] = mcappp.LinuxOSConfig + } + if mcappp.EnableEncryptionAtHost != nil { + objectMap["enableEncryptionAtHost"] = mcappp.EnableEncryptionAtHost + } + if mcappp.EnableUltraSSD != nil { + objectMap["enableUltraSSD"] = mcappp.EnableUltraSSD + } + if mcappp.EnableFIPS != nil { + objectMap["enableFIPS"] = mcappp.EnableFIPS + } + if mcappp.GpuInstanceProfile != "" { + objectMap["gpuInstanceProfile"] = mcappp.GpuInstanceProfile + } + if mcappp.CreationData != nil { + objectMap["creationData"] = mcappp.CreationData + } + return json.Marshal(objectMap) +} + +// ManagedClusterAPIServerAccessProfile access profile for managed cluster API server. +type ManagedClusterAPIServerAccessProfile struct { + // AuthorizedIPRanges - IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. For more information see [API server authorized IP ranges](https://docs.microsoft.com/azure/aks/api-server-authorized-ip-ranges). + AuthorizedIPRanges *[]string `json:"authorizedIPRanges,omitempty"` + // EnablePrivateCluster - For more details, see [Creating a private AKS cluster](https://docs.microsoft.com/azure/aks/private-clusters). + EnablePrivateCluster *bool `json:"enablePrivateCluster,omitempty"` + // PrivateDNSZone - The default is System. For more details see [configure private DNS zone](https://docs.microsoft.com/azure/aks/private-clusters#configure-private-dns-zone). Allowed values are 'system' and 'none'. + PrivateDNSZone *string `json:"privateDNSZone,omitempty"` + // EnablePrivateClusterPublicFQDN - Whether to create additional public FQDN for private cluster or not. + EnablePrivateClusterPublicFQDN *bool `json:"enablePrivateClusterPublicFQDN,omitempty"` + // DisableRunCommand - Whether to disable run command for the cluster or not. + DisableRunCommand *bool `json:"disableRunCommand,omitempty"` +} + +// ManagedClusterAutoUpgradeProfile auto upgrade profile for a managed cluster. +type ManagedClusterAutoUpgradeProfile struct { + // UpgradeChannel - For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel). Possible values include: 'UpgradeChannelRapid', 'UpgradeChannelStable', 'UpgradeChannelPatch', 'UpgradeChannelNodeImage', 'UpgradeChannelNone' + UpgradeChannel UpgradeChannel `json:"upgradeChannel,omitempty"` +} + +// ManagedClusterHTTPProxyConfig cluster HTTP proxy configuration. +type ManagedClusterHTTPProxyConfig struct { + // HTTPProxy - The HTTP proxy server endpoint to use. + HTTPProxy *string `json:"httpProxy,omitempty"` + // HTTPSProxy - The HTTPS proxy server endpoint to use. + HTTPSProxy *string `json:"httpsProxy,omitempty"` + // NoProxy - The endpoints that should not go through proxy. + NoProxy *[]string `json:"noProxy,omitempty"` + // TrustedCa - Alternative CA cert to use for connecting to proxy servers. + TrustedCa *string `json:"trustedCa,omitempty"` +} + +// ManagedClusterIdentity identity for the managed cluster. +type ManagedClusterIdentity struct { + // PrincipalID - READ-ONLY; The principal id of the system assigned identity which is used by master components. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id of the system assigned identity which is used by master components. + TenantID *string `json:"tenantId,omitempty"` + // Type - For more information see [use managed identities in AKS](https://docs.microsoft.com/azure/aks/use-managed-identity). Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*ManagedClusterIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterIdentity. +func (mci ManagedClusterIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mci.Type != "" { + objectMap["type"] = mci.Type + } + if mci.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = mci.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ManagedClusterIdentityUserAssignedIdentitiesValue ... +type ManagedClusterIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterIdentityUserAssignedIdentitiesValue. +func (mciAiv ManagedClusterIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedClusterListResult the response from the List Managed Clusters operation. +type ManagedClusterListResult struct { + autorest.Response `json:"-"` + // Value - The list of managed clusters. + Value *[]ManagedCluster `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of managed cluster results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterListResult. +func (mclr ManagedClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mclr.Value != nil { + objectMap["value"] = mclr.Value + } + return json.Marshal(objectMap) +} + +// ManagedClusterListResultIterator provides access to a complete listing of ManagedCluster values. +type ManagedClusterListResultIterator struct { + i int + page ManagedClusterListResultPage +} + +// 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 *ManagedClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultIterator.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 *ManagedClusterListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedClusterListResultIterator) 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 ManagedClusterListResultIterator) Response() ManagedClusterListResult { + 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 ManagedClusterListResultIterator) Value() ManagedCluster { + if !iter.page.NotDone() { + return ManagedCluster{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedClusterListResultIterator type. +func NewManagedClusterListResultIterator(page ManagedClusterListResultPage) ManagedClusterListResultIterator { + return ManagedClusterListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mclr ManagedClusterListResult) IsEmpty() bool { + return mclr.Value == nil || len(*mclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mclr ManagedClusterListResult) hasNextLink() bool { + return mclr.NextLink != nil && len(*mclr.NextLink) != 0 +} + +// managedClusterListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mclr ManagedClusterListResult) managedClusterListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mclr.NextLink))) +} + +// ManagedClusterListResultPage contains a page of ManagedCluster values. +type ManagedClusterListResultPage struct { + fn func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error) + mclr ManagedClusterListResult +} + +// 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 *ManagedClusterListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultPage.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.mclr) + if err != nil { + return err + } + page.mclr = 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 *ManagedClusterListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedClusterListResultPage) NotDone() bool { + return !page.mclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedClusterListResultPage) Response() ManagedClusterListResult { + return page.mclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedClusterListResultPage) Values() []ManagedCluster { + if page.mclr.IsEmpty() { + return nil + } + return *page.mclr.Value +} + +// Creates a new instance of the ManagedClusterListResultPage type. +func NewManagedClusterListResultPage(cur ManagedClusterListResult, getNextPage func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error)) ManagedClusterListResultPage { + return ManagedClusterListResultPage{ + fn: getNextPage, + mclr: cur, + } +} + +// ManagedClusterLoadBalancerProfile profile of the managed cluster load balancer. +type ManagedClusterLoadBalancerProfile struct { + // ManagedOutboundIPs - Desired managed outbound IPs for the cluster load balancer. + ManagedOutboundIPs *ManagedClusterLoadBalancerProfileManagedOutboundIPs `json:"managedOutboundIPs,omitempty"` + // OutboundIPPrefixes - Desired outbound IP Prefix resources for the cluster load balancer. + OutboundIPPrefixes *ManagedClusterLoadBalancerProfileOutboundIPPrefixes `json:"outboundIPPrefixes,omitempty"` + // OutboundIPs - Desired outbound IP resources for the cluster load balancer. + OutboundIPs *ManagedClusterLoadBalancerProfileOutboundIPs `json:"outboundIPs,omitempty"` + // EffectiveOutboundIPs - The effective outbound IP resources of the cluster load balancer. + EffectiveOutboundIPs *[]ResourceReference `json:"effectiveOutboundIPs,omitempty"` + // AllocatedOutboundPorts - The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports. + AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` + // IdleTimeoutInMinutes - Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // EnableMultipleStandardLoadBalancers - Enable multiple standard load balancers per AKS cluster or not. + EnableMultipleStandardLoadBalancers *bool `json:"enableMultipleStandardLoadBalancers,omitempty"` +} + +// ManagedClusterLoadBalancerProfileManagedOutboundIPs desired managed outbound IPs for the cluster load +// balancer. +type ManagedClusterLoadBalancerProfileManagedOutboundIPs struct { + // Count - The desired number of outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + Count *int32 `json:"count,omitempty"` +} + +// ManagedClusterLoadBalancerProfileOutboundIPPrefixes desired outbound IP Prefix resources for the cluster +// load balancer. +type ManagedClusterLoadBalancerProfileOutboundIPPrefixes struct { + // PublicIPPrefixes - A list of public IP prefix resources. + PublicIPPrefixes *[]ResourceReference `json:"publicIPPrefixes,omitempty"` +} + +// ManagedClusterLoadBalancerProfileOutboundIPs desired outbound IP resources for the cluster load +// balancer. +type ManagedClusterLoadBalancerProfileOutboundIPs struct { + // PublicIPs - A list of public IP resources. + PublicIPs *[]ResourceReference `json:"publicIPs,omitempty"` +} + +// ManagedClusterManagedOutboundIPProfile profile of the managed outbound IP resources of the managed +// cluster. +type ManagedClusterManagedOutboundIPProfile struct { + // Count - The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. + Count *int32 `json:"count,omitempty"` +} + +// ManagedClusterNATGatewayProfile profile of the managed cluster NAT gateway. +type ManagedClusterNATGatewayProfile struct { + // ManagedOutboundIPProfile - Profile of the managed outbound IP resources of the cluster NAT gateway. + ManagedOutboundIPProfile *ManagedClusterManagedOutboundIPProfile `json:"managedOutboundIPProfile,omitempty"` + // EffectiveOutboundIPs - The effective outbound IP resources of the cluster NAT gateway. + EffectiveOutboundIPs *[]ResourceReference `json:"effectiveOutboundIPs,omitempty"` + // IdleTimeoutInMinutes - Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` +} + +// ManagedClusterPodIdentity details about the pod identity assigned to the Managed Cluster. +type ManagedClusterPodIdentity struct { + // Name - The name of the pod identity. + Name *string `json:"name,omitempty"` + // Namespace - The namespace of the pod identity. + Namespace *string `json:"namespace,omitempty"` + // BindingSelector - The binding selector to use for the AzureIdentityBinding resource. + BindingSelector *string `json:"bindingSelector,omitempty"` + // Identity - The user assigned identity details. + Identity *UserAssignedIdentity `json:"identity,omitempty"` + // ProvisioningState - READ-ONLY; The current provisioning state of the pod identity. Possible values include: 'ManagedClusterPodIdentityProvisioningStateAssigned', 'ManagedClusterPodIdentityProvisioningStateUpdating', 'ManagedClusterPodIdentityProvisioningStateDeleting', 'ManagedClusterPodIdentityProvisioningStateFailed' + ProvisioningState ManagedClusterPodIdentityProvisioningState `json:"provisioningState,omitempty"` + // ProvisioningInfo - READ-ONLY + ProvisioningInfo *ManagedClusterPodIdentityProvisioningInfo `json:"provisioningInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterPodIdentity. +func (mcpi ManagedClusterPodIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcpi.Name != nil { + objectMap["name"] = mcpi.Name + } + if mcpi.Namespace != nil { + objectMap["namespace"] = mcpi.Namespace + } + if mcpi.BindingSelector != nil { + objectMap["bindingSelector"] = mcpi.BindingSelector + } + if mcpi.Identity != nil { + objectMap["identity"] = mcpi.Identity + } + return json.Marshal(objectMap) +} + +// ManagedClusterPodIdentityException see [disable AAD Pod Identity for a specific +// Pod/Application](https://azure.github.io/aad-pod-identity/docs/configure/application_exception/) for +// more details. +type ManagedClusterPodIdentityException struct { + // Name - The name of the pod identity exception. + Name *string `json:"name,omitempty"` + // Namespace - The namespace of the pod identity exception. + Namespace *string `json:"namespace,omitempty"` + // PodLabels - The pod labels to match. + PodLabels map[string]*string `json:"podLabels"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterPodIdentityException. +func (mcpie ManagedClusterPodIdentityException) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcpie.Name != nil { + objectMap["name"] = mcpie.Name + } + if mcpie.Namespace != nil { + objectMap["namespace"] = mcpie.Namespace + } + if mcpie.PodLabels != nil { + objectMap["podLabels"] = mcpie.PodLabels + } + return json.Marshal(objectMap) +} + +// ManagedClusterPodIdentityProfile see [use AAD pod +// identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on pod +// identity integration. +type ManagedClusterPodIdentityProfile struct { + // Enabled - Whether the pod identity addon is enabled. + Enabled *bool `json:"enabled,omitempty"` + // AllowNetworkPluginKubenet - Running in Kubenet is disabled by default due to the security related nature of AAD Pod Identity and the risks of IP spoofing. See [using Kubenet network plugin with AAD Pod Identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity#using-kubenet-network-plugin-with-azure-active-directory-pod-managed-identities) for more information. + AllowNetworkPluginKubenet *bool `json:"allowNetworkPluginKubenet,omitempty"` + // UserAssignedIdentities - The pod identities to use in the cluster. + UserAssignedIdentities *[]ManagedClusterPodIdentity `json:"userAssignedIdentities,omitempty"` + // UserAssignedIdentityExceptions - The pod identity exceptions to allow. + UserAssignedIdentityExceptions *[]ManagedClusterPodIdentityException `json:"userAssignedIdentityExceptions,omitempty"` +} + +// ManagedClusterPodIdentityProvisioningError an error response from the pod identity provisioning. +type ManagedClusterPodIdentityProvisioningError struct { + // Error - Details about the error. + Error *ManagedClusterPodIdentityProvisioningErrorBody `json:"error,omitempty"` +} + +// ManagedClusterPodIdentityProvisioningErrorBody an error response from the pod identity provisioning. +type ManagedClusterPodIdentityProvisioningErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]ManagedClusterPodIdentityProvisioningErrorBody `json:"details,omitempty"` +} + +// ManagedClusterPodIdentityProvisioningInfo ... +type ManagedClusterPodIdentityProvisioningInfo struct { + // Error - Pod identity assignment error (if any). + Error *ManagedClusterPodIdentityProvisioningError `json:"error,omitempty"` +} + +// ManagedClusterPoolUpgradeProfile the list of available upgrade versions. +type ManagedClusterPoolUpgradeProfile struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // Name - The Agent Pool name. + Name *string `json:"name,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // Upgrades - List of orchestrator types and versions available for upgrade. + Upgrades *[]ManagedClusterPoolUpgradeProfileUpgradesItem `json:"upgrades,omitempty"` +} + +// ManagedClusterPoolUpgradeProfileUpgradesItem ... +type ManagedClusterPoolUpgradeProfileUpgradesItem struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // IsPreview - Whether the Kubernetes version is currently in preview. + IsPreview *bool `json:"isPreview,omitempty"` +} + +// ManagedClusterProperties properties of the managed cluster. +type ManagedClusterProperties struct { + // ProvisioningState - READ-ONLY; The current provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PowerState - READ-ONLY; The Power State of the cluster. + PowerState *PowerState `json:"powerState,omitempty"` + // MaxAgentPools - READ-ONLY; The max number of agent pools for the managed cluster. + MaxAgentPools *int32 `json:"maxAgentPools,omitempty"` + // KubernetesVersion - When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details. + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // DNSPrefix - This cannot be updated once the Managed Cluster has been created. + DNSPrefix *string `json:"dnsPrefix,omitempty"` + // FqdnSubdomain - This cannot be updated once the Managed Cluster has been created. + FqdnSubdomain *string `json:"fqdnSubdomain,omitempty"` + // Fqdn - READ-ONLY; The FQDN of the master pool. + Fqdn *string `json:"fqdn,omitempty"` + // PrivateFQDN - READ-ONLY; The FQDN of private cluster. + PrivateFQDN *string `json:"privateFQDN,omitempty"` + // AzurePortalFQDN - READ-ONLY; The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, allowing the Azure Portal to function properly. + AzurePortalFQDN *string `json:"azurePortalFQDN,omitempty"` + // AgentPoolProfiles - The agent pool properties. + AgentPoolProfiles *[]ManagedClusterAgentPoolProfile `json:"agentPoolProfiles,omitempty"` + // LinuxProfile - The profile for Linux VMs in the Managed Cluster. + LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"` + // WindowsProfile - The profile for Windows VMs in the Managed Cluster. + WindowsProfile *ManagedClusterWindowsProfile `json:"windowsProfile,omitempty"` + // ServicePrincipalProfile - Information about a service principal identity for the cluster to use for manipulating Azure APIs. + ServicePrincipalProfile *ManagedClusterServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"` + // AddonProfiles - The profile of managed cluster add-on. + AddonProfiles map[string]*ManagedClusterAddonProfile `json:"addonProfiles"` + // PodIdentityProfile - See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on AAD pod identity integration. + PodIdentityProfile *ManagedClusterPodIdentityProfile `json:"podIdentityProfile,omitempty"` + // NodeResourceGroup - The name of the resource group containing agent pool nodes. + NodeResourceGroup *string `json:"nodeResourceGroup,omitempty"` + // EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. + EnableRBAC *bool `json:"enableRBAC,omitempty"` + // EnablePodSecurityPolicy - (DEPRECATING) Whether to enable Kubernetes pod security policy (preview). This feature is set for removal on October 15th, 2020. Learn more at aka.ms/aks/azpodpolicy. + EnablePodSecurityPolicy *bool `json:"enablePodSecurityPolicy,omitempty"` + // NetworkProfile - The network configuration profile. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // AadProfile - The Azure Active Directory configuration. + AadProfile *ManagedClusterAADProfile `json:"aadProfile,omitempty"` + // AutoUpgradeProfile - The auto upgrade configuration. + AutoUpgradeProfile *ManagedClusterAutoUpgradeProfile `json:"autoUpgradeProfile,omitempty"` + // AutoScalerProfile - Parameters to be applied to the cluster-autoscaler when enabled + AutoScalerProfile *ManagedClusterPropertiesAutoScalerProfile `json:"autoScalerProfile,omitempty"` + // APIServerAccessProfile - The access profile for managed cluster API server. + APIServerAccessProfile *ManagedClusterAPIServerAccessProfile `json:"apiServerAccessProfile,omitempty"` + // DiskEncryptionSetID - This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}' + DiskEncryptionSetID *string `json:"diskEncryptionSetID,omitempty"` + // IdentityProfile - Identities associated with the cluster. + IdentityProfile map[string]*UserAssignedIdentity `json:"identityProfile"` + // PrivateLinkResources - Private link resources associated with the cluster. + PrivateLinkResources *[]PrivateLinkResource `json:"privateLinkResources,omitempty"` + // DisableLocalAccounts - If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see [disable local accounts](https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview). + DisableLocalAccounts *bool `json:"disableLocalAccounts,omitempty"` + // HTTPProxyConfig - Configurations for provisioning the cluster with HTTP proxy servers. + HTTPProxyConfig *ManagedClusterHTTPProxyConfig `json:"httpProxyConfig,omitempty"` + // SecurityProfile - Security profile for the managed cluster. + SecurityProfile *ManagedClusterSecurityProfile `json:"securityProfile,omitempty"` + // PublicNetworkAccess - Default value is 'Enabled' (case insensitive). Could be set to 'Disabled' to enable private cluster. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterProperties. +func (mcp ManagedClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcp.KubernetesVersion != nil { + objectMap["kubernetesVersion"] = mcp.KubernetesVersion + } + if mcp.DNSPrefix != nil { + objectMap["dnsPrefix"] = mcp.DNSPrefix + } + if mcp.FqdnSubdomain != nil { + objectMap["fqdnSubdomain"] = mcp.FqdnSubdomain + } + if mcp.AgentPoolProfiles != nil { + objectMap["agentPoolProfiles"] = mcp.AgentPoolProfiles + } + if mcp.LinuxProfile != nil { + objectMap["linuxProfile"] = mcp.LinuxProfile + } + if mcp.WindowsProfile != nil { + objectMap["windowsProfile"] = mcp.WindowsProfile + } + if mcp.ServicePrincipalProfile != nil { + objectMap["servicePrincipalProfile"] = mcp.ServicePrincipalProfile + } + if mcp.AddonProfiles != nil { + objectMap["addonProfiles"] = mcp.AddonProfiles + } + if mcp.PodIdentityProfile != nil { + objectMap["podIdentityProfile"] = mcp.PodIdentityProfile + } + if mcp.NodeResourceGroup != nil { + objectMap["nodeResourceGroup"] = mcp.NodeResourceGroup + } + if mcp.EnableRBAC != nil { + objectMap["enableRBAC"] = mcp.EnableRBAC + } + if mcp.EnablePodSecurityPolicy != nil { + objectMap["enablePodSecurityPolicy"] = mcp.EnablePodSecurityPolicy + } + if mcp.NetworkProfile != nil { + objectMap["networkProfile"] = mcp.NetworkProfile + } + if mcp.AadProfile != nil { + objectMap["aadProfile"] = mcp.AadProfile + } + if mcp.AutoUpgradeProfile != nil { + objectMap["autoUpgradeProfile"] = mcp.AutoUpgradeProfile + } + if mcp.AutoScalerProfile != nil { + objectMap["autoScalerProfile"] = mcp.AutoScalerProfile + } + if mcp.APIServerAccessProfile != nil { + objectMap["apiServerAccessProfile"] = mcp.APIServerAccessProfile + } + if mcp.DiskEncryptionSetID != nil { + objectMap["diskEncryptionSetID"] = mcp.DiskEncryptionSetID + } + if mcp.IdentityProfile != nil { + objectMap["identityProfile"] = mcp.IdentityProfile + } + if mcp.PrivateLinkResources != nil { + objectMap["privateLinkResources"] = mcp.PrivateLinkResources + } + if mcp.DisableLocalAccounts != nil { + objectMap["disableLocalAccounts"] = mcp.DisableLocalAccounts + } + if mcp.HTTPProxyConfig != nil { + objectMap["httpProxyConfig"] = mcp.HTTPProxyConfig + } + if mcp.SecurityProfile != nil { + objectMap["securityProfile"] = mcp.SecurityProfile + } + if mcp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = mcp.PublicNetworkAccess + } + return json.Marshal(objectMap) +} + +// ManagedClusterPropertiesAutoScalerProfile parameters to be applied to the cluster-autoscaler when +// enabled +type ManagedClusterPropertiesAutoScalerProfile struct { + // BalanceSimilarNodeGroups - Valid values are 'true' and 'false' + BalanceSimilarNodeGroups *string `json:"balance-similar-node-groups,omitempty"` + // Expander - If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information. Possible values include: 'ExpanderLeastWaste', 'ExpanderMostPods', 'ExpanderPriority', 'ExpanderRandom' + Expander Expander `json:"expander,omitempty"` + // MaxEmptyBulkDelete - The default is 10. + MaxEmptyBulkDelete *string `json:"max-empty-bulk-delete,omitempty"` + // MaxGracefulTerminationSec - The default is 600. + MaxGracefulTerminationSec *string `json:"max-graceful-termination-sec,omitempty"` + // MaxNodeProvisionTime - The default is '15m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + MaxNodeProvisionTime *string `json:"max-node-provision-time,omitempty"` + // MaxTotalUnreadyPercentage - The default is 45. The maximum is 100 and the minimum is 0. + MaxTotalUnreadyPercentage *string `json:"max-total-unready-percentage,omitempty"` + // NewPodScaleUpDelay - For scenarios like burst/batch scale where you don't want CA to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). + NewPodScaleUpDelay *string `json:"new-pod-scale-up-delay,omitempty"` + // OkTotalUnreadyCount - This must be an integer. The default is 3. + OkTotalUnreadyCount *string `json:"ok-total-unready-count,omitempty"` + // ScanInterval - The default is '10'. Values must be an integer number of seconds. + ScanInterval *string `json:"scan-interval,omitempty"` + // ScaleDownDelayAfterAdd - The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterAdd *string `json:"scale-down-delay-after-add,omitempty"` + // ScaleDownDelayAfterDelete - The default is the scan-interval. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterDelete *string `json:"scale-down-delay-after-delete,omitempty"` + // ScaleDownDelayAfterFailure - The default is '3m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterFailure *string `json:"scale-down-delay-after-failure,omitempty"` + // ScaleDownUnneededTime - The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownUnneededTime *string `json:"scale-down-unneeded-time,omitempty"` + // ScaleDownUnreadyTime - The default is '20m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownUnreadyTime *string `json:"scale-down-unready-time,omitempty"` + // ScaleDownUtilizationThreshold - The default is '0.5'. + ScaleDownUtilizationThreshold *string `json:"scale-down-utilization-threshold,omitempty"` + // SkipNodesWithLocalStorage - The default is true. + SkipNodesWithLocalStorage *string `json:"skip-nodes-with-local-storage,omitempty"` + // SkipNodesWithSystemPods - The default is true. + SkipNodesWithSystemPods *string `json:"skip-nodes-with-system-pods,omitempty"` +} + +// ManagedClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (ManagedCluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersCreateOrUpdateFuture) 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 ManagedClustersCreateOrUpdateFuture.Result. +func (future *ManagedClustersCreateOrUpdateFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { + mc, err = client.CreateOrUpdateResponder(mc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", mc.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedClustersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersDeleteFuture) 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 ManagedClustersDeleteFuture.Result. +func (future *ManagedClustersDeleteFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClusterSecurityProfile security profile for the container service cluster. +type ManagedClusterSecurityProfile struct { + // AzureDefender - Azure Defender settings for the security profile. + AzureDefender *ManagedClusterSecurityProfileAzureDefender `json:"azureDefender,omitempty"` +} + +// ManagedClusterSecurityProfileAzureDefender azure Defender settings for the security profile. +type ManagedClusterSecurityProfileAzureDefender struct { + // Enabled - Whether to enable Azure Defender + Enabled *bool `json:"enabled,omitempty"` + // LogAnalyticsWorkspaceResourceID - Resource ID of the Log Analytics workspace to be associated with Azure Defender. When Azure Defender is enabled, this field is required and must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. + LogAnalyticsWorkspaceResourceID *string `json:"logAnalyticsWorkspaceResourceId,omitempty"` +} + +// ManagedClusterServicePrincipalProfile information about a service principal identity for the cluster to +// use for manipulating Azure APIs. +type ManagedClusterServicePrincipalProfile struct { + // ClientID - The ID for the service principal. + ClientID *string `json:"clientId,omitempty"` + // Secret - The secret password associated with the service principal in plain text. + Secret *string `json:"secret,omitempty"` +} + +// ManagedClusterSKU the SKU of a Managed Cluster. +type ManagedClusterSKU struct { + // Name - The name of a managed cluster SKU. Possible values include: 'ManagedClusterSKUNameBasic' + Name ManagedClusterSKUName `json:"name,omitempty"` + // Tier - If not specified, the default is 'Free'. See [uptime SLA](https://docs.microsoft.com/azure/aks/uptime-sla) for more details. Possible values include: 'ManagedClusterSKUTierPaid', 'ManagedClusterSKUTierFree' + Tier ManagedClusterSKUTier `json:"tier,omitempty"` +} + +// ManagedClustersResetAADProfileFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersResetAADProfileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersResetAADProfileFuture) 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 ManagedClustersResetAADProfileFuture.Result. +func (future *ManagedClustersResetAADProfileFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersResetAADProfileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersResetAADProfileFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersResetServicePrincipalProfileFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedClustersResetServicePrincipalProfileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersResetServicePrincipalProfileFuture) 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 ManagedClustersResetServicePrincipalProfileFuture.Result. +func (future *ManagedClustersResetServicePrincipalProfileFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersResetServicePrincipalProfileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersResetServicePrincipalProfileFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersRotateClusterCertificatesFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ManagedClustersRotateClusterCertificatesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersRotateClusterCertificatesFuture) 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 ManagedClustersRotateClusterCertificatesFuture.Result. +func (future *ManagedClustersRotateClusterCertificatesFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRotateClusterCertificatesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRotateClusterCertificatesFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersRunCommandFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersRunCommandFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (RunCommandResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersRunCommandFuture) 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 ManagedClustersRunCommandFuture.Result. +func (future *ManagedClustersRunCommandFuture) result(client ManagedClustersClient) (rcr RunCommandResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRunCommandFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rcr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRunCommandFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rcr.Response.Response, err = future.GetResult(sender); err == nil && rcr.Response.Response.StatusCode != http.StatusNoContent { + rcr, err = client.RunCommandResponder(rcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRunCommandFuture", "Result", rcr.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedClustersStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersStartFuture) 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 ManagedClustersStartFuture.Result. +func (future *ManagedClustersStartFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedClustersStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersStopFuture) 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 ManagedClustersStopFuture.Result. +func (future *ManagedClustersStopFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersStopFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (ManagedCluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersUpdateTagsFuture) 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 ManagedClustersUpdateTagsFuture.Result. +func (future *ManagedClustersUpdateTagsFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { + mc, err = client.UpdateTagsResponder(mc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersUpdateTagsFuture", "Result", mc.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedClusterUpgradeProfile the list of available upgrades for compute pools. +type ManagedClusterUpgradeProfile struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the upgrade profile. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the upgrade profile. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the upgrade profile. + Type *string `json:"type,omitempty"` + // ManagedClusterUpgradeProfileProperties - The properties of the upgrade profile. + *ManagedClusterUpgradeProfileProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterUpgradeProfile. +func (mcup ManagedClusterUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcup.ManagedClusterUpgradeProfileProperties != nil { + objectMap["properties"] = mcup.ManagedClusterUpgradeProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedClusterUpgradeProfile struct. +func (mcup *ManagedClusterUpgradeProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mcup.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mcup.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mcup.Type = &typeVar + } + case "properties": + if v != nil { + var managedClusterUpgradeProfileProperties ManagedClusterUpgradeProfileProperties + err = json.Unmarshal(*v, &managedClusterUpgradeProfileProperties) + if err != nil { + return err + } + mcup.ManagedClusterUpgradeProfileProperties = &managedClusterUpgradeProfileProperties + } + } + } + + return nil +} + +// ManagedClusterUpgradeProfileProperties control plane and agent pool upgrade profiles. +type ManagedClusterUpgradeProfileProperties struct { + // ControlPlaneProfile - The list of available upgrade versions for the control plane. + ControlPlaneProfile *ManagedClusterPoolUpgradeProfile `json:"controlPlaneProfile,omitempty"` + // AgentPoolProfiles - The list of available upgrade versions for agent pools. + AgentPoolProfiles *[]ManagedClusterPoolUpgradeProfile `json:"agentPoolProfiles,omitempty"` +} + +// ManagedClusterWindowsProfile profile for Windows VMs in the managed cluster. +type ManagedClusterWindowsProfile struct { + // AdminUsername - Specifies the name of the administrator account.

**Restriction:** Cannot end in "."

**Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".

**Minimum-length:** 1 character

**Max-length:** 20 characters + AdminUsername *string `json:"adminUsername,omitempty"` + // AdminPassword - Specifies the password of the administrator account.

**Minimum-length:** 8 characters

**Max-length:** 123 characters

**Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters
Has upper characters
Has a digit
Has a special character (Regex match [\W_])

**Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" + AdminPassword *string `json:"adminPassword,omitempty"` + // LicenseType - The license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details. Possible values include: 'LicenseTypeNone', 'LicenseTypeWindowsServer' + LicenseType LicenseType `json:"licenseType,omitempty"` + // EnableCSIProxy - For more details on CSI proxy, see the [CSI proxy GitHub repo](https://github.com/kubernetes-csi/csi-proxy). + EnableCSIProxy *bool `json:"enableCSIProxy,omitempty"` + // GmsaProfile - The Windows gMSA Profile in the Managed Cluster. + GmsaProfile *WindowsGmsaProfile `json:"gmsaProfile,omitempty"` +} + +// MasterProfile profile for the container service master. +type MasterProfile struct { + // Count - Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. + Count *int32 `json:"count,omitempty"` + // DNSPrefix - DNS prefix to be used to create the FQDN for the master pool. + DNSPrefix *string `json:"dnsPrefix,omitempty"` + // VMSize - Size of agent VMs. Possible values include: 'VMSizeTypesStandardA1', 'VMSizeTypesStandardA10', 'VMSizeTypesStandardA11', 'VMSizeTypesStandardA1V2', 'VMSizeTypesStandardA2', 'VMSizeTypesStandardA2V2', 'VMSizeTypesStandardA2mV2', 'VMSizeTypesStandardA3', 'VMSizeTypesStandardA4', 'VMSizeTypesStandardA4V2', 'VMSizeTypesStandardA4mV2', 'VMSizeTypesStandardA5', 'VMSizeTypesStandardA6', 'VMSizeTypesStandardA7', 'VMSizeTypesStandardA8', 'VMSizeTypesStandardA8V2', 'VMSizeTypesStandardA8mV2', 'VMSizeTypesStandardA9', 'VMSizeTypesStandardB2ms', 'VMSizeTypesStandardB2s', 'VMSizeTypesStandardB4ms', 'VMSizeTypesStandardB8ms', 'VMSizeTypesStandardD1', 'VMSizeTypesStandardD11', 'VMSizeTypesStandardD11V2', 'VMSizeTypesStandardD11V2Promo', 'VMSizeTypesStandardD12', 'VMSizeTypesStandardD12V2', 'VMSizeTypesStandardD12V2Promo', 'VMSizeTypesStandardD13', 'VMSizeTypesStandardD13V2', 'VMSizeTypesStandardD13V2Promo', 'VMSizeTypesStandardD14', 'VMSizeTypesStandardD14V2', 'VMSizeTypesStandardD14V2Promo', 'VMSizeTypesStandardD15V2', 'VMSizeTypesStandardD16V3', 'VMSizeTypesStandardD16sV3', 'VMSizeTypesStandardD1V2', 'VMSizeTypesStandardD2', 'VMSizeTypesStandardD2V2', 'VMSizeTypesStandardD2V2Promo', 'VMSizeTypesStandardD2V3', 'VMSizeTypesStandardD2sV3', 'VMSizeTypesStandardD3', 'VMSizeTypesStandardD32V3', 'VMSizeTypesStandardD32sV3', 'VMSizeTypesStandardD3V2', 'VMSizeTypesStandardD3V2Promo', 'VMSizeTypesStandardD4', 'VMSizeTypesStandardD4V2', 'VMSizeTypesStandardD4V2Promo', 'VMSizeTypesStandardD4V3', 'VMSizeTypesStandardD4sV3', 'VMSizeTypesStandardD5V2', 'VMSizeTypesStandardD5V2Promo', 'VMSizeTypesStandardD64V3', 'VMSizeTypesStandardD64sV3', 'VMSizeTypesStandardD8V3', 'VMSizeTypesStandardD8sV3', 'VMSizeTypesStandardDS1', 'VMSizeTypesStandardDS11', 'VMSizeTypesStandardDS11V2', 'VMSizeTypesStandardDS11V2Promo', 'VMSizeTypesStandardDS12', 'VMSizeTypesStandardDS12V2', 'VMSizeTypesStandardDS12V2Promo', 'VMSizeTypesStandardDS13', 'VMSizeTypesStandardDS132V2', 'VMSizeTypesStandardDS134V2', 'VMSizeTypesStandardDS13V2', 'VMSizeTypesStandardDS13V2Promo', 'VMSizeTypesStandardDS14', 'VMSizeTypesStandardDS144V2', 'VMSizeTypesStandardDS148V2', 'VMSizeTypesStandardDS14V2', 'VMSizeTypesStandardDS14V2Promo', 'VMSizeTypesStandardDS15V2', 'VMSizeTypesStandardDS1V2', 'VMSizeTypesStandardDS2', 'VMSizeTypesStandardDS2V2', 'VMSizeTypesStandardDS2V2Promo', 'VMSizeTypesStandardDS3', 'VMSizeTypesStandardDS3V2', 'VMSizeTypesStandardDS3V2Promo', 'VMSizeTypesStandardDS4', 'VMSizeTypesStandardDS4V2', 'VMSizeTypesStandardDS4V2Promo', 'VMSizeTypesStandardDS5V2', 'VMSizeTypesStandardDS5V2Promo', 'VMSizeTypesStandardE16V3', 'VMSizeTypesStandardE16sV3', 'VMSizeTypesStandardE2V3', 'VMSizeTypesStandardE2sV3', 'VMSizeTypesStandardE3216sV3', 'VMSizeTypesStandardE328sV3', 'VMSizeTypesStandardE32V3', 'VMSizeTypesStandardE32sV3', 'VMSizeTypesStandardE4V3', 'VMSizeTypesStandardE4sV3', 'VMSizeTypesStandardE6416sV3', 'VMSizeTypesStandardE6432sV3', 'VMSizeTypesStandardE64V3', 'VMSizeTypesStandardE64sV3', 'VMSizeTypesStandardE8V3', 'VMSizeTypesStandardE8sV3', 'VMSizeTypesStandardF1', 'VMSizeTypesStandardF16', 'VMSizeTypesStandardF16s', 'VMSizeTypesStandardF16sV2', 'VMSizeTypesStandardF1s', 'VMSizeTypesStandardF2', 'VMSizeTypesStandardF2s', 'VMSizeTypesStandardF2sV2', 'VMSizeTypesStandardF32sV2', 'VMSizeTypesStandardF4', 'VMSizeTypesStandardF4s', 'VMSizeTypesStandardF4sV2', 'VMSizeTypesStandardF64sV2', 'VMSizeTypesStandardF72sV2', 'VMSizeTypesStandardF8', 'VMSizeTypesStandardF8s', 'VMSizeTypesStandardF8sV2', 'VMSizeTypesStandardG1', 'VMSizeTypesStandardG2', 'VMSizeTypesStandardG3', 'VMSizeTypesStandardG4', 'VMSizeTypesStandardG5', 'VMSizeTypesStandardGS1', 'VMSizeTypesStandardGS2', 'VMSizeTypesStandardGS3', 'VMSizeTypesStandardGS4', 'VMSizeTypesStandardGS44', 'VMSizeTypesStandardGS48', 'VMSizeTypesStandardGS5', 'VMSizeTypesStandardGS516', 'VMSizeTypesStandardGS58', 'VMSizeTypesStandardH16', 'VMSizeTypesStandardH16m', 'VMSizeTypesStandardH16mr', 'VMSizeTypesStandardH16r', 'VMSizeTypesStandardH8', 'VMSizeTypesStandardH8m', 'VMSizeTypesStandardL16s', 'VMSizeTypesStandardL32s', 'VMSizeTypesStandardL4s', 'VMSizeTypesStandardL8s', 'VMSizeTypesStandardM12832ms', 'VMSizeTypesStandardM12864ms', 'VMSizeTypesStandardM128ms', 'VMSizeTypesStandardM128s', 'VMSizeTypesStandardM6416ms', 'VMSizeTypesStandardM6432ms', 'VMSizeTypesStandardM64ms', 'VMSizeTypesStandardM64s', 'VMSizeTypesStandardNC12', 'VMSizeTypesStandardNC12sV2', 'VMSizeTypesStandardNC12sV3', 'VMSizeTypesStandardNC24', 'VMSizeTypesStandardNC24r', 'VMSizeTypesStandardNC24rsV2', 'VMSizeTypesStandardNC24rsV3', 'VMSizeTypesStandardNC24sV2', 'VMSizeTypesStandardNC24sV3', 'VMSizeTypesStandardNC6', 'VMSizeTypesStandardNC6sV2', 'VMSizeTypesStandardNC6sV3', 'VMSizeTypesStandardND12s', 'VMSizeTypesStandardND24rs', 'VMSizeTypesStandardND24s', 'VMSizeTypesStandardND6s', 'VMSizeTypesStandardNV12', 'VMSizeTypesStandardNV24', 'VMSizeTypesStandardNV6' + VMSize VMSizeTypes `json:"vmSize,omitempty"` + // OsDiskSizeGB - OS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // VnetSubnetID - VNet SubnetID specifies the VNet's subnet identifier. + VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // FirstConsecutiveStaticIP - FirstConsecutiveStaticIP used to specify the first static ip of masters. + FirstConsecutiveStaticIP *string `json:"firstConsecutiveStaticIP,omitempty"` + // StorageProfile - Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. Possible values include: 'StorageProfileTypesStorageAccount', 'StorageProfileTypesManagedDisks' + StorageProfile StorageProfileTypes `json:"storageProfile,omitempty"` + // Fqdn - READ-ONLY; FQDN for the master pool. + Fqdn *string `json:"fqdn,omitempty"` +} + +// MarshalJSON is the custom marshaler for MasterProfile. +func (mp MasterProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.Count != nil { + objectMap["count"] = mp.Count + } + if mp.DNSPrefix != nil { + objectMap["dnsPrefix"] = mp.DNSPrefix + } + if mp.VMSize != "" { + objectMap["vmSize"] = mp.VMSize + } + if mp.OsDiskSizeGB != nil { + objectMap["osDiskSizeGB"] = mp.OsDiskSizeGB + } + if mp.VnetSubnetID != nil { + objectMap["vnetSubnetID"] = mp.VnetSubnetID + } + if mp.FirstConsecutiveStaticIP != nil { + objectMap["firstConsecutiveStaticIP"] = mp.FirstConsecutiveStaticIP + } + if mp.StorageProfile != "" { + objectMap["storageProfile"] = mp.StorageProfile + } + return json.Marshal(objectMap) +} + +// NetworkProfile profile of network configuration. +type NetworkProfile struct { + // NetworkPlugin - Network plugin used for building the Kubernetes network. Possible values include: 'NetworkPluginAzure', 'NetworkPluginKubenet' + NetworkPlugin NetworkPlugin `json:"networkPlugin,omitempty"` + // NetworkPolicy - Network policy used for building the Kubernetes network. Possible values include: 'NetworkPolicyCalico', 'NetworkPolicyAzure' + NetworkPolicy NetworkPolicy `json:"networkPolicy,omitempty"` + // NetworkMode - This cannot be specified if networkPlugin is anything other than 'azure'. Possible values include: 'NetworkModeTransparent', 'NetworkModeBridge' + NetworkMode NetworkMode `json:"networkMode,omitempty"` + // PodCidr - A CIDR notation IP range from which to assign pod IPs when kubenet is used. + PodCidr *string `json:"podCidr,omitempty"` + // ServiceCidr - A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. + ServiceCidr *string `json:"serviceCidr,omitempty"` + // DNSServiceIP - An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. + DNSServiceIP *string `json:"dnsServiceIP,omitempty"` + // DockerBridgeCidr - A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. + DockerBridgeCidr *string `json:"dockerBridgeCidr,omitempty"` + // OutboundType - This can only be set at cluster creation time and cannot be changed later. For more information see [egress outbound type](https://docs.microsoft.com/azure/aks/egress-outboundtype). Possible values include: 'OutboundTypeLoadBalancer', 'OutboundTypeUserDefinedRouting', 'OutboundTypeManagedNATGateway', 'OutboundTypeUserAssignedNATGateway' + OutboundType OutboundType `json:"outboundType,omitempty"` + // LoadBalancerSku - The default is 'standard'. See [Azure Load Balancer SKUs](https://docs.microsoft.com/azure/load-balancer/skus) for more information about the differences between load balancer SKUs. Possible values include: 'LoadBalancerSkuStandard', 'LoadBalancerSkuBasic' + LoadBalancerSku LoadBalancerSku `json:"loadBalancerSku,omitempty"` + // LoadBalancerProfile - Profile of the cluster load balancer. + LoadBalancerProfile *ManagedClusterLoadBalancerProfile `json:"loadBalancerProfile,omitempty"` + // NatGatewayProfile - Profile of the cluster NAT gateway. + NatGatewayProfile *ManagedClusterNATGatewayProfile `json:"natGatewayProfile,omitempty"` +} + +// OperationListResult the List Operation response. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of operations + Value *[]OperationValue `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationValue describes the properties of a Operation value. +type OperationValue struct { + // Origin - READ-ONLY; The origin of the operation. + Origin *string `json:"origin,omitempty"` + // Name - READ-ONLY; The name of the operation. + Name *string `json:"name,omitempty"` + // OperationValueDisplay - Describes the properties of a Operation Value Display. + *OperationValueDisplay `json:"display,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationValue. +func (ov OperationValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ov.OperationValueDisplay != nil { + objectMap["display"] = ov.OperationValueDisplay + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OperationValue struct. +func (ov *OperationValue) 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 "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + ov.Origin = &origin + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ov.Name = &name + } + case "display": + if v != nil { + var operationValueDisplay OperationValueDisplay + err = json.Unmarshal(*v, &operationValueDisplay) + if err != nil { + return err + } + ov.OperationValueDisplay = &operationValueDisplay + } + } + } + + return nil +} + +// OperationValueDisplay describes the properties of a Operation Value Display. +type OperationValueDisplay struct { + // Operation - READ-ONLY; The display name of the operation. + Operation *string `json:"operation,omitempty"` + // Resource - READ-ONLY; The display name of the resource the operation applies to. + Resource *string `json:"resource,omitempty"` + // Description - READ-ONLY; The description of the operation. + Description *string `json:"description,omitempty"` + // Provider - READ-ONLY; The resource provider for the operation. + Provider *string `json:"provider,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationValueDisplay. +func (ovd OperationValueDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OSOptionProfile the OS option profile. +type OSOptionProfile struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the OS option resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the OS option resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the OS option resource. + Type *string `json:"type,omitempty"` + // OSOptionPropertyList - The list of OS options. + *OSOptionPropertyList `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for OSOptionProfile. +func (oop OSOptionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oop.OSOptionPropertyList != nil { + objectMap["properties"] = oop.OSOptionPropertyList + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OSOptionProfile struct. +func (oop *OSOptionProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + oop.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + oop.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + oop.Type = &typeVar + } + case "properties": + if v != nil { + var oSOptionPropertyList OSOptionPropertyList + err = json.Unmarshal(*v, &oSOptionPropertyList) + if err != nil { + return err + } + oop.OSOptionPropertyList = &oSOptionPropertyList + } + } + } + + return nil +} + +// OSOptionProperty OS option property. +type OSOptionProperty struct { + // OsType - The OS type. + OsType *string `json:"os-type,omitempty"` + // EnableFipsImage - Whether the image is FIPS-enabled. + EnableFipsImage *bool `json:"enable-fips-image,omitempty"` +} + +// OSOptionPropertyList the list of OS option properties. +type OSOptionPropertyList struct { + // OsOptionPropertyList - The list of OS options. + OsOptionPropertyList *[]OSOptionProperty `json:"osOptionPropertyList,omitempty"` +} + +// OutboundEnvironmentEndpoint egress endpoints which AKS agent nodes connect to for common purpose. +type OutboundEnvironmentEndpoint struct { + // Category - The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc. + Category *string `json:"category,omitempty"` + // Endpoints - The endpoints that AKS agent nodes connect to + Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` +} + +// OutboundEnvironmentEndpointCollection collection of OutboundEnvironmentEndpoint +type OutboundEnvironmentEndpointCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]OutboundEnvironmentEndpoint `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpointCollection. +func (oeec OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oeec.Value != nil { + objectMap["value"] = oeec.Value + } + return json.Marshal(objectMap) +} + +// OutboundEnvironmentEndpointCollectionIterator provides access to a complete listing of +// OutboundEnvironmentEndpoint values. +type OutboundEnvironmentEndpointCollectionIterator struct { + i int + page OutboundEnvironmentEndpointCollectionPage +} + +// 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 *OutboundEnvironmentEndpointCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionIterator.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 *OutboundEnvironmentEndpointCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OutboundEnvironmentEndpointCollectionIterator) 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 OutboundEnvironmentEndpointCollectionIterator) Response() OutboundEnvironmentEndpointCollection { + 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 OutboundEnvironmentEndpointCollectionIterator) Value() OutboundEnvironmentEndpoint { + if !iter.page.NotDone() { + return OutboundEnvironmentEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OutboundEnvironmentEndpointCollectionIterator type. +func NewOutboundEnvironmentEndpointCollectionIterator(page OutboundEnvironmentEndpointCollectionPage) OutboundEnvironmentEndpointCollectionIterator { + return OutboundEnvironmentEndpointCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oeec OutboundEnvironmentEndpointCollection) IsEmpty() bool { + return oeec.Value == nil || len(*oeec.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (oeec OutboundEnvironmentEndpointCollection) hasNextLink() bool { + return oeec.NextLink != nil && len(*oeec.NextLink) != 0 +} + +// outboundEnvironmentEndpointCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oeec OutboundEnvironmentEndpointCollection) outboundEnvironmentEndpointCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !oeec.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oeec.NextLink))) +} + +// OutboundEnvironmentEndpointCollectionPage contains a page of OutboundEnvironmentEndpoint values. +type OutboundEnvironmentEndpointCollectionPage struct { + fn func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error) + oeec OutboundEnvironmentEndpointCollection +} + +// 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 *OutboundEnvironmentEndpointCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionPage.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.oeec) + if err != nil { + return err + } + page.oeec = 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 *OutboundEnvironmentEndpointCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OutboundEnvironmentEndpointCollectionPage) NotDone() bool { + return !page.oeec.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OutboundEnvironmentEndpointCollectionPage) Response() OutboundEnvironmentEndpointCollection { + return page.oeec +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OutboundEnvironmentEndpointCollectionPage) Values() []OutboundEnvironmentEndpoint { + if page.oeec.IsEmpty() { + return nil + } + return *page.oeec.Value +} + +// Creates a new instance of the OutboundEnvironmentEndpointCollectionPage type. +func NewOutboundEnvironmentEndpointCollectionPage(cur OutboundEnvironmentEndpointCollection, getNextPage func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error)) OutboundEnvironmentEndpointCollectionPage { + return OutboundEnvironmentEndpointCollectionPage{ + fn: getNextPage, + oeec: cur, + } +} + +// PowerState describes the Power State of the cluster +type PowerState struct { + // Code - Tells whether the cluster is Running or Stopped. Possible values include: 'CodeRunning', 'CodeStopped' + Code Code `json:"code,omitempty"` +} + +// PrivateEndpoint private endpoint which a connection belongs to. +type PrivateEndpoint struct { + // ID - The resource ID of the private endpoint + ID *string `json:"id,omitempty"` +} + +// PrivateEndpointConnection a private endpoint connection +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the private endpoint connection. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the private endpoint connection. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // PrivateEndpointConnectionProperties - The properties of a private endpoint connection. + *PrivateEndpointConnectionProperties `json:"properties,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 "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 + } + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult a list of private endpoint connections +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} + +// PrivateEndpointConnectionProperties properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // ProvisioningState - READ-ONLY; The current provisioning state. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` + // PrivateEndpoint - The resource of private endpoint. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = pecp.PrivateEndpoint + } + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// 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, "containerservice.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + autorest.Response `json:"-"` + // ID - The ID of the private link resource. + ID *string `json:"id,omitempty"` + // Name - The name of the private link resource. + Name *string `json:"name,omitempty"` + // Type - The resource type. + Type *string `json:"type,omitempty"` + // GroupID - The group ID of the resource. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - The RequiredMembers of the resource + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // PrivateLinkServiceID - READ-ONLY; The private link service ID of the resource, this field is exposed only to NRP internally. + PrivateLinkServiceID *string `json:"privateLinkServiceID,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.ID != nil { + objectMap["id"] = plr.ID + } + if plr.Name != nil { + objectMap["name"] = plr.Name + } + if plr.Type != nil { + objectMap["type"] = plr.Type + } + if plr.GroupID != nil { + objectMap["groupId"] = plr.GroupID + } + if plr.RequiredMembers != nil { + objectMap["requiredMembers"] = plr.RequiredMembers + } + return json.Marshal(objectMap) +} + +// PrivateLinkResourcesListResult a list of private link resources +type PrivateLinkResourcesListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]PrivateLinkResource `json:"value,omitempty"` +} + +// PrivateLinkServiceConnectionState the state of a private link service connection. +type PrivateLinkServiceConnectionState struct { + // Status - The private link service connection status. Possible values include: 'ConnectionStatusPending', 'ConnectionStatusApproved', 'ConnectionStatusRejected', 'ConnectionStatusDisconnected' + Status ConnectionStatus `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` +} + +// Resource the Resource model definition. +type Resource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// ResourceReference a reference to an Azure resource. +type ResourceReference struct { + // ID - The fully qualified Azure resource id. + ID *string `json:"id,omitempty"` +} + +// RunCommandRequest a run command request +type RunCommandRequest struct { + // Command - The command to run. + Command *string `json:"command,omitempty"` + // Context - A base64 encoded zip file containing the files required by the command. + Context *string `json:"context,omitempty"` + // ClusterToken - AuthToken issued for AKS AAD Server App. + ClusterToken *string `json:"clusterToken,omitempty"` +} + +// RunCommandResult run command result. +type RunCommandResult struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The command id. + ID *string `json:"id,omitempty"` + // CommandResultProperties - Properties of command result. + *CommandResultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RunCommandResult. +func (rcr RunCommandResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rcr.CommandResultProperties != nil { + objectMap["properties"] = rcr.CommandResultProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RunCommandResult struct. +func (rcr *RunCommandResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rcr.ID = &ID + } + case "properties": + if v != nil { + var commandResultProperties CommandResultProperties + err = json.Unmarshal(*v, &commandResultProperties) + if err != nil { + return err + } + rcr.CommandResultProperties = &commandResultProperties + } + } + } + + return nil +} + +// Snapshot a node pool snapshot resource. +type Snapshot struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; The system metadata relating to this snapshot. + SystemData *SystemData `json:"systemData,omitempty"` + // SnapshotProperties - Properties of a snapshot. + *SnapshotProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Snapshot. +func (s Snapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SnapshotProperties != nil { + objectMap["properties"] = s.SnapshotProperties + } + if s.Location != nil { + objectMap["location"] = s.Location + } + if s.Tags != nil { + objectMap["tags"] = s.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Snapshot struct. +func (s *Snapshot) 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + s.SystemData = &systemData + } + case "properties": + if v != nil { + var snapshotProperties SnapshotProperties + err = json.Unmarshal(*v, &snapshotProperties) + if err != nil { + return err + } + s.SnapshotProperties = &snapshotProperties + } + 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 + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + s.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + s.Tags = tags + } + } + } + + return nil +} + +// SnapshotListResult the response from the List Snapshots operation. +type SnapshotListResult struct { + autorest.Response `json:"-"` + // Value - The list of snapshots. + Value *[]Snapshot `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of snapshot results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotListResult. +func (slr SnapshotListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if slr.Value != nil { + objectMap["value"] = slr.Value + } + return json.Marshal(objectMap) +} + +// SnapshotListResultIterator provides access to a complete listing of Snapshot values. +type SnapshotListResultIterator struct { + i int + page SnapshotListResultPage +} + +// 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 *SnapshotListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListResultIterator.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 *SnapshotListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SnapshotListResultIterator) 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 SnapshotListResultIterator) Response() SnapshotListResult { + 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 SnapshotListResultIterator) Value() Snapshot { + if !iter.page.NotDone() { + return Snapshot{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SnapshotListResultIterator type. +func NewSnapshotListResultIterator(page SnapshotListResultPage) SnapshotListResultIterator { + return SnapshotListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (slr SnapshotListResult) IsEmpty() bool { + return slr.Value == nil || len(*slr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (slr SnapshotListResult) hasNextLink() bool { + return slr.NextLink != nil && len(*slr.NextLink) != 0 +} + +// snapshotListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (slr SnapshotListResult) snapshotListResultPreparer(ctx context.Context) (*http.Request, error) { + if !slr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(slr.NextLink))) +} + +// SnapshotListResultPage contains a page of Snapshot values. +type SnapshotListResultPage struct { + fn func(context.Context, SnapshotListResult) (SnapshotListResult, error) + slr SnapshotListResult +} + +// 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 *SnapshotListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListResultPage.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.slr) + if err != nil { + return err + } + page.slr = 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 *SnapshotListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SnapshotListResultPage) NotDone() bool { + return !page.slr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SnapshotListResultPage) Response() SnapshotListResult { + return page.slr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SnapshotListResultPage) Values() []Snapshot { + if page.slr.IsEmpty() { + return nil + } + return *page.slr.Value +} + +// Creates a new instance of the SnapshotListResultPage type. +func NewSnapshotListResultPage(cur SnapshotListResult, getNextPage func(context.Context, SnapshotListResult) (SnapshotListResult, error)) SnapshotListResultPage { + return SnapshotListResultPage{ + fn: getNextPage, + slr: cur, + } +} + +// SnapshotProperties properties used to configure a node pool snapshot. +type SnapshotProperties struct { + // CreationData - CreationData to be used to specify the source agent pool resource ID to create this snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // SnapshotType - Possible values include: 'SnapshotTypeNodePool' + SnapshotType SnapshotType `json:"snapshotType,omitempty"` + // KubernetesVersion - READ-ONLY; The version of Kubernetes. + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // NodeImageVersion - READ-ONLY; The version of node image. + NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // OsType - READ-ONLY; Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // OsSku - READ-ONLY; Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' + OsSku OSSKU `json:"osSku,omitempty"` + // VMSize - READ-ONLY; The size of the VM. + VMSize *string `json:"vmSize,omitempty"` + // EnableFIPS - READ-ONLY; Whether to use a FIPS-enabled OS. + EnableFIPS *bool `json:"enableFIPS,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotProperties. +func (sp SnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.CreationData != nil { + objectMap["creationData"] = sp.CreationData + } + if sp.SnapshotType != "" { + objectMap["snapshotType"] = sp.SnapshotType + } + return json.Marshal(objectMap) +} + +// SSHConfiguration SSH configuration for Linux-based VMs running on Azure. +type SSHConfiguration struct { + // PublicKeys - The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. + PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` +} + +// SSHPublicKey contains information about SSH certificate public key data. +type SSHPublicKey struct { + // KeyData - Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. + KeyData *string `json:"keyData,omitempty"` +} + +// SubResource reference to another subresource. +type SubResource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubResource. +func (sr SubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SysctlConfig sysctl settings for Linux agent nodes. +type SysctlConfig struct { + // NetCoreSomaxconn - Sysctl setting net.core.somaxconn. + NetCoreSomaxconn *int32 `json:"netCoreSomaxconn,omitempty"` + // NetCoreNetdevMaxBacklog - Sysctl setting net.core.netdev_max_backlog. + NetCoreNetdevMaxBacklog *int32 `json:"netCoreNetdevMaxBacklog,omitempty"` + // NetCoreRmemDefault - Sysctl setting net.core.rmem_default. + NetCoreRmemDefault *int32 `json:"netCoreRmemDefault,omitempty"` + // NetCoreRmemMax - Sysctl setting net.core.rmem_max. + NetCoreRmemMax *int32 `json:"netCoreRmemMax,omitempty"` + // NetCoreWmemDefault - Sysctl setting net.core.wmem_default. + NetCoreWmemDefault *int32 `json:"netCoreWmemDefault,omitempty"` + // NetCoreWmemMax - Sysctl setting net.core.wmem_max. + NetCoreWmemMax *int32 `json:"netCoreWmemMax,omitempty"` + // NetCoreOptmemMax - Sysctl setting net.core.optmem_max. + NetCoreOptmemMax *int32 `json:"netCoreOptmemMax,omitempty"` + // NetIpv4TCPMaxSynBacklog - Sysctl setting net.ipv4.tcp_max_syn_backlog. + NetIpv4TCPMaxSynBacklog *int32 `json:"netIpv4TcpMaxSynBacklog,omitempty"` + // NetIpv4TCPMaxTwBuckets - Sysctl setting net.ipv4.tcp_max_tw_buckets. + NetIpv4TCPMaxTwBuckets *int32 `json:"netIpv4TcpMaxTwBuckets,omitempty"` + // NetIpv4TCPFinTimeout - Sysctl setting net.ipv4.tcp_fin_timeout. + NetIpv4TCPFinTimeout *int32 `json:"netIpv4TcpFinTimeout,omitempty"` + // NetIpv4TCPKeepaliveTime - Sysctl setting net.ipv4.tcp_keepalive_time. + NetIpv4TCPKeepaliveTime *int32 `json:"netIpv4TcpKeepaliveTime,omitempty"` + // NetIpv4TCPKeepaliveProbes - Sysctl setting net.ipv4.tcp_keepalive_probes. + NetIpv4TCPKeepaliveProbes *int32 `json:"netIpv4TcpKeepaliveProbes,omitempty"` + // NetIpv4TcpkeepaliveIntvl - Sysctl setting net.ipv4.tcp_keepalive_intvl. + NetIpv4TcpkeepaliveIntvl *int32 `json:"netIpv4TcpkeepaliveIntvl,omitempty"` + // NetIpv4TCPTwReuse - Sysctl setting net.ipv4.tcp_tw_reuse. + NetIpv4TCPTwReuse *bool `json:"netIpv4TcpTwReuse,omitempty"` + // NetIpv4IPLocalPortRange - Sysctl setting net.ipv4.ip_local_port_range. + NetIpv4IPLocalPortRange *string `json:"netIpv4IpLocalPortRange,omitempty"` + // NetIpv4NeighDefaultGcThresh1 - Sysctl setting net.ipv4.neigh.default.gc_thresh1. + NetIpv4NeighDefaultGcThresh1 *int32 `json:"netIpv4NeighDefaultGcThresh1,omitempty"` + // NetIpv4NeighDefaultGcThresh2 - Sysctl setting net.ipv4.neigh.default.gc_thresh2. + NetIpv4NeighDefaultGcThresh2 *int32 `json:"netIpv4NeighDefaultGcThresh2,omitempty"` + // NetIpv4NeighDefaultGcThresh3 - Sysctl setting net.ipv4.neigh.default.gc_thresh3. + NetIpv4NeighDefaultGcThresh3 *int32 `json:"netIpv4NeighDefaultGcThresh3,omitempty"` + // NetNetfilterNfConntrackMax - Sysctl setting net.netfilter.nf_conntrack_max. + NetNetfilterNfConntrackMax *int32 `json:"netNetfilterNfConntrackMax,omitempty"` + // NetNetfilterNfConntrackBuckets - Sysctl setting net.netfilter.nf_conntrack_buckets. + NetNetfilterNfConntrackBuckets *int32 `json:"netNetfilterNfConntrackBuckets,omitempty"` + // FsInotifyMaxUserWatches - Sysctl setting fs.inotify.max_user_watches. + FsInotifyMaxUserWatches *int32 `json:"fsInotifyMaxUserWatches,omitempty"` + // FsFileMax - Sysctl setting fs.file-max. + FsFileMax *int32 `json:"fsFileMax,omitempty"` + // FsAioMaxNr - Sysctl setting fs.aio-max-nr. + FsAioMaxNr *int32 `json:"fsAioMaxNr,omitempty"` + // FsNrOpen - Sysctl setting fs.nr_open. + FsNrOpen *int32 `json:"fsNrOpen,omitempty"` + // KernelThreadsMax - Sysctl setting kernel.threads-max. + KernelThreadsMax *int32 `json:"kernelThreadsMax,omitempty"` + // VMMaxMapCount - Sysctl setting vm.max_map_count. + VMMaxMapCount *int32 `json:"vmMaxMapCount,omitempty"` + // VMSwappiness - Sysctl setting vm.swappiness. + VMSwappiness *int32 `json:"vmSwappiness,omitempty"` + // VMVfsCachePressure - Sysctl setting vm.vfs_cache_pressure. + VMVfsCachePressure *int32 `json:"vmVfsCachePressure,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 UTC timestamp of resource creation. + 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 type of identity that last modified the resource. + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TagsObject tags object for patch operations. +type TagsObject struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TagsObject. +func (toVar TagsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if toVar.Tags != nil { + objectMap["tags"] = toVar.Tags + } + return json.Marshal(objectMap) +} + +// TimeInWeek time in a week. +type TimeInWeek struct { + // Day - The day of the week. Possible values include: 'WeekDaySunday', 'WeekDayMonday', 'WeekDayTuesday', 'WeekDayWednesday', 'WeekDayThursday', 'WeekDayFriday', 'WeekDaySaturday' + Day WeekDay `json:"day,omitempty"` + // HourSlots - Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. + HourSlots *[]int32 `json:"hourSlots,omitempty"` +} + +// TimeSpan for example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. +type TimeSpan struct { + // Start - The start of a time span + Start *date.Time `json:"start,omitempty"` + // End - The end of a time span + End *date.Time `json:"end,omitempty"` +} + +// UserAssignedIdentity details about a user assigned identity. +type UserAssignedIdentity struct { + // ResourceID - The resource ID of the user assigned identity. + ResourceID *string `json:"resourceId,omitempty"` + // ClientID - The client ID of the user assigned identity. + ClientID *string `json:"clientId,omitempty"` + // ObjectID - The object ID of the user assigned identity. + ObjectID *string `json:"objectId,omitempty"` +} + +// VMDiagnostics profile for diagnostics on the container service VMs. +type VMDiagnostics struct { + // Enabled - Whether the VM diagnostic agent is provisioned on the VM. + Enabled *bool `json:"enabled,omitempty"` + // StorageURI - READ-ONLY; The URI of the storage account where diagnostics are stored. + StorageURI *string `json:"storageUri,omitempty"` +} + +// MarshalJSON is the custom marshaler for VMDiagnostics. +func (vd VMDiagnostics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vd.Enabled != nil { + objectMap["enabled"] = vd.Enabled + } + return json.Marshal(objectMap) +} + +// WindowsGmsaProfile windows gMSA Profile in the managed cluster. +type WindowsGmsaProfile struct { + // Enabled - Specifies whether to enable Windows gMSA in the managed cluster. + Enabled *bool `json:"enabled,omitempty"` + // DNSServer - Specifies the DNS server for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. + DNSServer *string `json:"dnsServer,omitempty"` + // RootDomainName - Specifies the root domain name for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. + RootDomainName *string `json:"rootDomainName,omitempty"` +} diff --git a/services/containerservice/mgmt/2021-09-01/containerservice/operations.go b/services/containerservice/mgmt/2021-09-01/containerservice/operations.go new file mode 100644 index 000000000000..7e17297707a9 --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/operations.go @@ -0,0 +1,98 @@ +package containerservice + +// 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 Container Service 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 sends the list request. +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.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, "containerservice.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.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-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ContainerService/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerservice/mgmt/2021-09-01/containerservice/privateendpointconnections.go b/services/containerservice/mgmt/2021-09-01/containerservice/privateendpointconnections.go new file mode 100644 index 000000000000..8b437b304d4c --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/privateendpointconnections.go @@ -0,0 +1,394 @@ +package containerservice + +// 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 Container Service 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 sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, resourceName 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.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, "containerservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/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 to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/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 PrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +// parameters - the updated private endpoint connection. +func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.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.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) UpdateResponder(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 +} diff --git a/services/containerservice/mgmt/2021-09-01/containerservice/privatelinkresources.go b/services/containerservice/mgmt/2021-09-01/containerservice/privatelinkresources.go new file mode 100644 index 000000000000..742808e37fe2 --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/privatelinkresources.go @@ -0,0 +1,119 @@ +package containerservice + +// 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 Container Service 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)} +} + +// List to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateLinkResourcesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateLinkResourcesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/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 PrivateLinkResourcesListResult, 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/containerservice/mgmt/2021-09-01/containerservice/resolveprivatelinkserviceid.go b/services/containerservice/mgmt/2021-09-01/containerservice/resolveprivatelinkserviceid.go new file mode 100644 index 000000000000..ee5392cf6bf6 --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/resolveprivatelinkserviceid.go @@ -0,0 +1,123 @@ +package containerservice + +// 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" +) + +// ResolvePrivateLinkServiceIDClient is the the Container Service Client. +type ResolvePrivateLinkServiceIDClient struct { + BaseClient +} + +// NewResolvePrivateLinkServiceIDClient creates an instance of the ResolvePrivateLinkServiceIDClient client. +func NewResolvePrivateLinkServiceIDClient(subscriptionID string) ResolvePrivateLinkServiceIDClient { + return NewResolvePrivateLinkServiceIDClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResolvePrivateLinkServiceIDClientWithBaseURI creates an instance of the ResolvePrivateLinkServiceIDClient 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 NewResolvePrivateLinkServiceIDClientWithBaseURI(baseURI string, subscriptionID string) ResolvePrivateLinkServiceIDClient { + return ResolvePrivateLinkServiceIDClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// POST sends the post request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// parameters - parameters required in order to resolve a private link service ID. +func (client ResolvePrivateLinkServiceIDClient) POST(ctx context.Context, resourceGroupName string, resourceName string, parameters PrivateLinkResource) (result PrivateLinkResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResolvePrivateLinkServiceIDClient.POST") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ResolvePrivateLinkServiceIDClient", "POST", err.Error()) + } + + req, err := client.POSTPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ResolvePrivateLinkServiceIDClient", "POST", nil, "Failure preparing request") + return + } + + resp, err := client.POSTSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ResolvePrivateLinkServiceIDClient", "POST", resp, "Failure sending request") + return + } + + result, err = client.POSTResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ResolvePrivateLinkServiceIDClient", "POST", resp, "Failure responding to request") + return + } + + return +} + +// POSTPreparer prepares the POST request. +func (client ResolvePrivateLinkServiceIDClient) POSTPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters PrivateLinkResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.PrivateLinkServiceID = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// POSTSender sends the POST request. The method will close the +// http.Response Body if it receives an error. +func (client ResolvePrivateLinkServiceIDClient) POSTSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// POSTResponder handles the response to the POST request. The method always +// closes the http.Response Body. +func (client ResolvePrivateLinkServiceIDClient) POSTResponder(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 +} diff --git a/services/containerservice/mgmt/2021-09-01/containerservice/snapshots.go b/services/containerservice/mgmt/2021-09-01/containerservice/snapshots.go new file mode 100644 index 000000000000..f30b6b074c4b --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/snapshots.go @@ -0,0 +1,617 @@ +package containerservice + +// 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" +) + +// SnapshotsClient is the the Container Service Client. +type SnapshotsClient struct { + BaseClient +} + +// NewSnapshotsClient creates an instance of the SnapshotsClient client. +func NewSnapshotsClient(subscriptionID string) SnapshotsClient { + return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient 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 NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { + return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// parameters - the snapshot to create or update. +func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + 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.ContainerService/snapshots/{resourceName}", 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 SnapshotsClient) 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 SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", 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 SnapshotsClient) 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 SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", 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 SnapshotsClient) 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 SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client SnapshotsClient) List(ctx context.Context) (result SnapshotListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", resp, "Failure sending request") + return + } + + result.slr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots", 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 SnapshotsClient) 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 SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotListResult, 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 SnapshotsClient) listNextResults(ctx context.Context, lastResults SnapshotListResult) (result SnapshotListResult, err error) { + req, err := lastResults.snapshotListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "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, "containerservice.SnapshotsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SnapshotsClient) ListComplete(ctx context.Context) (result SnapshotListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client SnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SnapshotListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.slr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client SnapshotsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", 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 SnapshotsClient) 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 SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotListResult, 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 SnapshotsClient) listByResourceGroupNextResults(ctx context.Context, lastResults SnapshotListResult) (result SnapshotListResult, err error) { + req, err := lastResults.snapshotListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "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, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SnapshotListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags sends the update tags request. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the managed cluster resource. +// parameters - parameters supplied to the Update snapshot Tags operation. +func (client SnapshotsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client SnapshotsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-09-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) UpdateTagsResponder(resp *http.Response) (result Snapshot, 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/containerservice/mgmt/2021-09-01/containerservice/version.go b/services/containerservice/mgmt/2021-09-01/containerservice/version.go new file mode 100644 index 000000000000..2c4d45fd3eca --- /dev/null +++ b/services/containerservice/mgmt/2021-09-01/containerservice/version.go @@ -0,0 +1,19 @@ +package containerservice + +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() + " containerservice/2021-09-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/eventgrid/mgmt/2021-12-01/eventgrid/CHANGELOG.md b/services/eventgrid/mgmt/2021-12-01/eventgrid/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/eventgrid/mgmt/2021-12-01/eventgrid/_meta.json b/services/eventgrid/mgmt/2021-12-01/eventgrid/_meta.json new file mode 100644 index 000000000000..04bbd898146c --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "769e09cac92c50b1f9fa6468775b7cb7de16bb06", + "readme": "/_/azure-rest-api-specs/specification/eventgrid/resource-manager/readme.md", + "tag": "package-2021-12", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-12 --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/eventgrid/mgmt/2021-12-01/eventgrid/client.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/client.go new file mode 100644 index 000000000000..d116496e6a6a --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/client.go @@ -0,0 +1,41 @@ +// Package eventgrid implements the Azure ARM Eventgrid service API version 2021-12-01. +// +// 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/eventgrid/mgmt/2021-12-01/eventgrid/domains.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/domains.go new file mode 100644 index 000000000000..cd1afdb51173 --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/domains.go @@ -0,0 +1,770 @@ +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", result.Response(), "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-12-01" + 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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client 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", result.Response(), "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-12-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.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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client 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-12-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.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-12-01" + 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-12-01" + 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-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", result.Response(), "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-12-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.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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client 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/eventgrid/mgmt/2021-12-01/eventgrid/domaintopics.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/domaintopics.go new file mode 100644 index 000000000000..e635d3215f08 --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/domaintopics.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" +) + +// 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", result.Response(), "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-12-01" + 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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client 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", result.Response(), "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-12-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.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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client 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-12-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.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-12-01" + 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/eventgrid/mgmt/2021-12-01/eventgrid/enums.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/enums.go new file mode 100644 index 000000000000..0332f3de754b --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/enums.go @@ -0,0 +1,408 @@ +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} +} + +// 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" + // OperatorTypeNumberGreaterThan ... + OperatorTypeNumberGreaterThan OperatorType = "NumberGreaterThan" + // OperatorTypeNumberGreaterThanOrEquals ... + OperatorTypeNumberGreaterThanOrEquals OperatorType = "NumberGreaterThanOrEquals" + // OperatorTypeNumberIn ... + OperatorTypeNumberIn OperatorType = "NumberIn" + // OperatorTypeNumberLessThan ... + OperatorTypeNumberLessThan OperatorType = "NumberLessThan" + // OperatorTypeNumberLessThanOrEquals ... + OperatorTypeNumberLessThanOrEquals OperatorType = "NumberLessThanOrEquals" + // OperatorTypeNumberNotIn ... + OperatorTypeNumberNotIn OperatorType = "NumberNotIn" + // OperatorTypeStringBeginsWith ... + OperatorTypeStringBeginsWith OperatorType = "StringBeginsWith" + // OperatorTypeStringContains ... + OperatorTypeStringContains OperatorType = "StringContains" + // OperatorTypeStringEndsWith ... + OperatorTypeStringEndsWith OperatorType = "StringEndsWith" + // OperatorTypeStringIn ... + OperatorTypeStringIn OperatorType = "StringIn" + // OperatorTypeStringNotIn ... + OperatorTypeStringNotIn OperatorType = "StringNotIn" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{OperatorTypeAdvancedFilter, OperatorTypeBoolEquals, OperatorTypeNumberGreaterThan, OperatorTypeNumberGreaterThanOrEquals, OperatorTypeNumberIn, OperatorTypeNumberLessThan, OperatorTypeNumberLessThanOrEquals, OperatorTypeNumberNotIn, OperatorTypeStringBeginsWith, OperatorTypeStringContains, OperatorTypeStringEndsWith, OperatorTypeStringIn, OperatorTypeStringNotIn} +} + +// 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} +} + +// 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} +} + +// 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/eventgrid/mgmt/2021-12-01/eventgrid/eventgridapi/interfaces.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/eventgridapi/interfaces.go new file mode 100644 index 000000000000..31c70c6c6ad6 --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/eventgridapi/interfaces.go @@ -0,0 +1,159 @@ +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/eventgrid/mgmt/2021-12-01/eventgrid" +) + +// 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) + +// 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) + +// 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) + +// 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) + +// 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) + +// 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/eventgrid/mgmt/2021-12-01/eventgrid/eventsubscriptions.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/eventsubscriptions.go new file mode 100644 index 000000000000..039f7e08f68a --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/eventsubscriptions.go @@ -0,0 +1,1865 @@ +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", result.Response(), "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-12-01" + 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 + future.FutureAPI = &azure.Future{} + 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", result.Response(), "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-12-01" + 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 + future.FutureAPI = &azure.Future{} + 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-12-01" + 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-12-01" + 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-12-01" + 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-12-01" + 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-12-01" + 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-12-01" + 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-12-01" + 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-12-01" + 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-12-01" + 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-12-01" + 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-12-01" + 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-12-01" + 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-12-01" + 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", result.Response(), "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-12-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("/{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 + future.FutureAPI = &azure.Future{} + 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/eventgrid/mgmt/2021-12-01/eventgrid/extensiontopics.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/extensiontopics.go new file mode 100644 index 000000000000..7ea57ba9004b --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/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-12-01" + 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/eventgrid/mgmt/2021-12-01/eventgrid/models.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/models.go new file mode 100644 index 000000000000..21ab1fdc5aa6 --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/models.go @@ -0,0 +1,7346 @@ +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/eventgrid/mgmt/2021-12-01/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) + 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' + 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 + 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 +} + +// 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' + 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 +} + +// 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"` + // SystemData - READ-ONLY; The system metadata relating to Domain resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Identity - Identity information for the Event Grid Domain 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 Domain. +func (d Domain) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.DomainProperties != nil { + objectMap["properties"] = d.DomainProperties + } + 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + d.SystemData = &systemData + } + case "identity": + if v != nil { + var identity IdentityInfo + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + d.Identity = &identity + } + 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 domain. + Endpoint *string `json:"endpoint,omitempty"` + // InputSchema - This determines the format that Event Grid should expect for incoming events published to the domain. 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 domain. + 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"` +} + +// 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 + } + 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 + } + } + } + + 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"` +} + +// 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. + 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 DeadLetter destination of the event subscription. + 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. + 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 DeadLetter destination of the event subscription. + 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"` +} + +// 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"` + // SystemData - READ-ONLY; The system metadata relating to the Extension 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 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + et.SystemData = &systemData + } + 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 +} + +// 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' + 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 +} + +// 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' + 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 +} + +// 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' + 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 +} + +// 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 +} + +// 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' + 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 +} + +// 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' + 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 +} + +// 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' + 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 +} + +// 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 +} + +// 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"` + // 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"` +} + +// 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) +} + +// 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' + 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 +} + +// 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' + 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 +} + +// 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' + 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 +} + +// 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' + 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 +} + +// 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 +} + +// 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' + 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 +} + +// 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"` + // Identity - Identity information for the resource. + Identity *IdentityInfo `json:"identity,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to System 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 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 "identity": + if v != nil { + var identity IdentityInfo + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + st.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + st.SystemData = &systemData + } + 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"` + // Identity - Identity information for the resource. + Identity *IdentityInfo `json:"identity,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.Identity != nil { + objectMap["identity"] = t.Identity + } + 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 "identity": + if v != nil { + var identity IdentityInfo + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + t.Identity = &identity + } + 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 resource. + Tags map[string]*string `json:"tags"` + // Identity - Topic resource identity information. + Identity *IdentityInfo `json:"identity,omitempty"` + // TopicUpdateParameterProperties - Properties of the resource. + *TopicUpdateParameterProperties `json:"properties,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 + } + 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 + } + } + } + + 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/eventgrid/mgmt/2021-12-01/eventgrid/operations.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/operations.go new file mode 100644 index 000000000000..11feaacc7f84 --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/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-12-01" + 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/eventgrid/mgmt/2021-12-01/eventgrid/privateendpointconnections.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/privateendpointconnections.go new file mode 100644 index 000000000000..221360736584 --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/privateendpointconnections.go @@ -0,0 +1,414 @@ +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 or domain. +// 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\' or \'domains\'. +// parentName - the name of the parent resource (namely, either, the topic name or domain 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", result.Response(), "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-12-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.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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a specific private endpoint connection under a topic or domain. +// 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\' or \'domains\'. +// parentName - the name of the parent resource (namely, either, the topic name or domain 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-12-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.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 or domain. +// 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\' or \'domains\'. +// parentName - the name of the parent resource (namely, either, the topic name or 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 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-12-01" + 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 or domain. +// 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\' or \'domains\'. +// parentName - the name of the parent resource (namely, either, the topic name or domain 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", result.Response(), "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-12-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.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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client 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/eventgrid/mgmt/2021-12-01/eventgrid/privatelinkresources.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/privatelinkresources.go new file mode 100644 index 000000000000..0f2970b6af09 --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/privatelinkresources.go @@ -0,0 +1,246 @@ +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\' or \'domains\'. +// parentName - the name of the parent resource (namely, either, the topic name or domain 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-12-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.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 or domain. +// 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\' or \'domains\'. +// parentName - the name of the parent resource (namely, either, the topic name or 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 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-12-01" + 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/eventgrid/mgmt/2021-12-01/eventgrid/systemtopiceventsubscriptions.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/systemtopiceventsubscriptions.go new file mode 100644 index 000000000000..b80b62c9e74c --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/systemtopiceventsubscriptions.go @@ -0,0 +1,654 @@ +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", result.Response(), "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-12-01" + 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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client 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", result.Response(), "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-12-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.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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client 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-12-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.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-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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-12-01" + 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", result.Response(), "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-12-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.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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client 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/eventgrid/mgmt/2021-12-01/eventgrid/systemtopics.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/systemtopics.go new file mode 100644 index 000000000000..4317f61d69ff --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/systemtopics.go @@ -0,0 +1,608 @@ +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", result.Response(), "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-12-01" + 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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client 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", result.Response(), "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-12-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.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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client 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-12-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.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-12-01" + 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-12-01" + 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", result.Response(), "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-12-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.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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client 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/eventgrid/mgmt/2021-12-01/eventgrid/topics.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/topics.go new file mode 100644 index 000000000000..1a841b02881e --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/eventgrid/topics.go @@ -0,0 +1,853 @@ +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", result.Response(), "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-12-01" + 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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client 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", result.Response(), "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-12-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.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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client 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-12-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.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-12-01" + 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-12-01" + 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-12-01" + 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-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", result.Response(), "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-12-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// 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), + 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", result.Response(), "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-12-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.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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client 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/eventgrid/mgmt/2021-12-01/eventgrid/topictypes.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/topictypes.go new file mode 100644 index 000000000000..45b60db99885 --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/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-12-01" + 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-12-01" + 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-12-01" + 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/eventgrid/mgmt/2021-12-01/eventgrid/version.go b/services/eventgrid/mgmt/2021-12-01/eventgrid/version.go new file mode 100644 index 000000000000..157be2a592d8 --- /dev/null +++ b/services/eventgrid/mgmt/2021-12-01/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-12-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/CHANGELOG.md b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/CHANGELOG.md index 52911e4cc5e4..0712386d8839 100644 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/CHANGELOG.md +++ b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/CHANGELOG.md @@ -1,2 +1,27 @@ # Change History +## Breaking Changes + +### Struct Changes + +#### Removed Structs + +1. StorageAccountProperties + +#### Removed Struct Fields + +1. RegistryProperties.StorageAccount + +## Additive Changes + +### Struct Changes + +#### New Structs + +1. OperationLogSpecificationDefinition + +#### New Struct Fields + +1. OperationServiceSpecificationDefinition.LogSpecifications +1. RegistryProperties.AnonymousPullEnabled +1. RegistryPropertiesUpdateParameters.AnonymousPullEnabled diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/_meta.json b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/_meta.json index cbc4bca8cef5..c4fdc43985bb 100644 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/_meta.json +++ b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "769e09cac92c50b1f9fa6468775b7cb7de16bb06", "readme": "/_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", "tag": "package-2020-11-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/models.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/models.go index 9b628495e992..5bbd67e27655 100644 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/models.go +++ b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/models.go @@ -3442,6 +3442,16 @@ func NewOperationListResultPage(cur OperationListResult, getNextPage func(contex } } +// OperationLogSpecificationDefinition the definition of Azure Monitoring log. +type OperationLogSpecificationDefinition struct { + // Name - Log name. + Name *string `json:"name,omitempty"` + // DisplayName - Log display name. + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Log blob duration. + BlobDuration *string `json:"blobDuration,omitempty"` +} + // OperationMetricSpecificationDefinition the definition of Azure Monitoring metric. type OperationMetricSpecificationDefinition struct { // Name - Metric name. @@ -3468,6 +3478,8 @@ type OperationPropertiesDefinition struct { type OperationServiceSpecificationDefinition struct { // MetricSpecifications - A list of Azure Monitoring metrics definition. MetricSpecifications *[]OperationMetricSpecificationDefinition `json:"metricSpecifications,omitempty"` + // LogSpecifications - A list of Azure Monitoring log definitions. + LogSpecifications *[]OperationLogSpecificationDefinition `json:"logSpecifications,omitempty"` } // OverrideTaskStepProperties ... @@ -5196,8 +5208,6 @@ type RegistryProperties struct { Status *Status `json:"status,omitempty"` // AdminUserEnabled - The value that indicates whether the admin user is enabled. AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` - // StorageAccount - The properties of the storage account for the container registry. Only applicable to Classic SKU. - StorageAccount *StorageAccountProperties `json:"storageAccount,omitempty"` // NetworkRuleSet - The network rule set for a container registry. NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` // Policies - The policies for a container registry. @@ -5216,6 +5226,8 @@ type RegistryProperties struct { NetworkRuleBypassOptions NetworkRuleBypassOptions `json:"networkRuleBypassOptions,omitempty"` // ZoneRedundancy - Whether or not zone redundancy is enabled for this container registry. Possible values include: 'ZoneRedundancyEnabled', 'ZoneRedundancyDisabled' ZoneRedundancy ZoneRedundancy `json:"zoneRedundancy,omitempty"` + // AnonymousPullEnabled - Enables registry-wide pull from unauthenticated clients. + AnonymousPullEnabled *bool `json:"anonymousPullEnabled,omitempty"` } // MarshalJSON is the custom marshaler for RegistryProperties. @@ -5224,9 +5236,6 @@ func (rp RegistryProperties) MarshalJSON() ([]byte, error) { if rp.AdminUserEnabled != nil { objectMap["adminUserEnabled"] = rp.AdminUserEnabled } - if rp.StorageAccount != nil { - objectMap["storageAccount"] = rp.StorageAccount - } if rp.NetworkRuleSet != nil { objectMap["networkRuleSet"] = rp.NetworkRuleSet } @@ -5248,6 +5257,9 @@ func (rp RegistryProperties) MarshalJSON() ([]byte, error) { if rp.ZoneRedundancy != "" { objectMap["zoneRedundancy"] = rp.ZoneRedundancy } + if rp.AnonymousPullEnabled != nil { + objectMap["anonymousPullEnabled"] = rp.AnonymousPullEnabled + } return json.Marshal(objectMap) } @@ -5267,16 +5279,18 @@ type RegistryPropertiesUpdateParameters struct { PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` // NetworkRuleBypassOptions - Whether to allow trusted Azure services to access a network restricted registry. Possible values include: 'NetworkRuleBypassOptionsAzureServices', 'NetworkRuleBypassOptionsNone' NetworkRuleBypassOptions NetworkRuleBypassOptions `json:"networkRuleBypassOptions,omitempty"` + // AnonymousPullEnabled - Enables registry-wide pull from unauthenticated clients. + AnonymousPullEnabled *bool `json:"anonymousPullEnabled,omitempty"` } // RegistryUpdateParameters the parameters for updating a container registry. type RegistryUpdateParameters struct { + // Identity - The identity of the container registry. + Identity *IdentityProperties `json:"identity,omitempty"` // Tags - The tags for the container registry. Tags map[string]*string `json:"tags"` // Sku - The SKU of the container registry. Sku *Sku `json:"sku,omitempty"` - // Identity - The identity of the container registry. - Identity *IdentityProperties `json:"identity,omitempty"` // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` } @@ -5284,15 +5298,15 @@ type RegistryUpdateParameters struct { // MarshalJSON is the custom marshaler for RegistryUpdateParameters. func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if rup.Identity != nil { + objectMap["identity"] = rup.Identity + } if rup.Tags != nil { objectMap["tags"] = rup.Tags } if rup.Sku != nil { objectMap["sku"] = rup.Sku } - if rup.Identity != nil { - objectMap["identity"] = rup.Identity - } if rup.RegistryPropertiesUpdateParameters != nil { objectMap["properties"] = rup.RegistryPropertiesUpdateParameters } @@ -5308,6 +5322,15 @@ func (rup *RegistryUpdateParameters) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { + case "identity": + if v != nil { + var identity IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + rup.Identity = &identity + } case "tags": if v != nil { var tags map[string]*string @@ -5326,15 +5349,6 @@ func (rup *RegistryUpdateParameters) UnmarshalJSON(body []byte) error { } rup.Sku = &sku } - case "identity": - if v != nil { - var identity IdentityProperties - err = json.Unmarshal(*v, &identity) - if err != nil { - return err - } - rup.Identity = &identity - } case "properties": if v != nil { var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters @@ -7113,13 +7127,6 @@ func (sdp StatusDetailProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// StorageAccountProperties the properties of a storage account for a container registry. Only applicable -// to Classic SKU. -type StorageAccountProperties struct { - // ID - The resource ID of the storage account. - ID *string `json:"id,omitempty"` -} - // SyncProperties the sync properties of the connected registry with its parent. type SyncProperties struct { // TokenID - The resource ID of the ACR token used to authenticate the connected registry to its parent during sync. diff --git a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/registries.go b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/registries.go index 8c74c83a497b..9545b6f84de4 100644 --- a/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/registries.go +++ b/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry/registries.go @@ -142,11 +142,7 @@ func (client RegistriesClient) Create(ctx context.Context, resourceGroupName str {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, {TargetValue: registry, - Constraints: []validation.Constraint{{Target: "registry.Sku", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "registry.RegistryProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "registry.RegistryProperties.StorageAccount.ID", Name: validation.Null, Rule: true, Chain: nil}}}, - }}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "registry.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("containerregistry.RegistriesClient", "Create", err.Error()) } diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/CHANGELOG.md b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/_meta.json b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/_meta.json new file mode 100644 index 000000000000..f4c99b54728f --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "769e09cac92c50b1f9fa6468775b7cb7de16bb06", + "readme": "/_/azure-rest-api-specs/specification/containerregistry/resource-manager/readme.md", + "tag": "package-2021-06-preview", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-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/containerregistry/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/containerregistry/mgmt/2021-06-01-preview/containerregistry/agentpools.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/agentpools.go new file mode 100644 index 000000000000..1ae5928434f8 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/agentpools.go @@ -0,0 +1,634 @@ +package containerregistry + +// 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" +) + +// AgentPoolsClient is the client for the AgentPools methods of the Containerregistry service. +type AgentPoolsClient struct { + BaseClient +} + +// NewAgentPoolsClient creates an instance of the AgentPoolsClient client. +func NewAgentPoolsClient(subscriptionID string) AgentPoolsClient { + return NewAgentPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAgentPoolsClientWithBaseURI creates an instance of the AgentPoolsClient 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 NewAgentPoolsClientWithBaseURI(baseURI string, subscriptionID string) AgentPoolsClient { + return AgentPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates an agent pool for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// agentPoolName - the name of the agent pool. +// agentPool - the parameters of an agent pool that needs to scheduled. +func (client AgentPoolsClient) Create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool) (result AgentPoolsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: agentPoolName, + Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, + {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.AgentPoolsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, agentPoolName, agentPool) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client AgentPoolsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool AgentPool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", pathParameters), + autorest.WithJSON(agentPool), + 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 AgentPoolsClient) CreateSender(req *http.Request) (future AgentPoolsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) CreateResponder(resp *http.Response) (result AgentPool, 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 specified agent pool resource. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPoolsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: agentPoolName, + Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, + {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.AgentPoolsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AgentPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) DeleteSender(req *http.Request) (future AgentPoolsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) 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 detailed information for a given agent pool. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: agentPoolName, + Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, + {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.AgentPoolsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AgentPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", 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 AgentPoolsClient) 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 AgentPoolsClient) GetResponder(resp *http.Response) (result AgentPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetQueueStatus gets the count of queued runs for a given agent pool. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result AgentPoolQueueStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetQueueStatus") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: agentPoolName, + Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, + {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.AgentPoolsClient", "GetQueueStatus", err.Error()) + } + + req, err := client.GetQueueStatusPreparer(ctx, resourceGroupName, registryName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", nil, "Failure preparing request") + return + } + + resp, err := client.GetQueueStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", resp, "Failure sending request") + return + } + + result, err = client.GetQueueStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "GetQueueStatus", resp, "Failure responding to request") + return + } + + return +} + +// GetQueueStatusPreparer prepares the GetQueueStatus request. +func (client AgentPoolsClient) GetQueueStatusPreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}/listQueueStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetQueueStatusSender sends the GetQueueStatus request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) GetQueueStatusSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetQueueStatusResponder handles the response to the GetQueueStatus request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) GetQueueStatusResponder(resp *http.Response) (result AgentPoolQueueStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the agent pools for a specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client AgentPoolsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result AgentPoolListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.List") + defer func() { + sc := -1 + if result.aplr.Response.Response != nil { + sc = result.aplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.AgentPoolsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", resp, "Failure sending request") + return + } + + result.aplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "List", resp, "Failure responding to request") + return + } + if result.aplr.hasNextLink() && result.aplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AgentPoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/agentPools", 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 AgentPoolsClient) 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 AgentPoolsClient) ListResponder(resp *http.Response) (result AgentPoolListResult, 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 AgentPoolsClient) listNextResults(ctx context.Context, lastResults AgentPoolListResult) (result AgentPoolListResult, err error) { + req, err := lastResults.agentPoolListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "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, "containerregistry.AgentPoolsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AgentPoolsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result AgentPoolListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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, registryName) + return +} + +// Update updates an agent pool with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// agentPoolName - the name of the agent pool. +// updateParameters - the parameters for updating an agent pool. +func (client AgentPoolsClient) Update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters) (result AgentPoolsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: agentPoolName, + Constraints: []validation.Constraint{{Target: "agentPoolName", Name: validation.MaxLength, Rule: 20, Chain: nil}, + {Target: "agentPoolName", Name: validation.MinLength, Rule: 3, Chain: nil}, + {Target: "agentPoolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.AgentPoolsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, agentPoolName, updateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AgentPoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters AgentPoolUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}", pathParameters), + autorest.WithJSON(updateParameters), + 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 AgentPoolsClient) UpdateSender(req *http.Request) (future AgentPoolsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) UpdateResponder(resp *http.Response) (result AgentPool, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/client.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/client.go new file mode 100644 index 000000000000..79937e123765 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/client.go @@ -0,0 +1,41 @@ +// Package containerregistry implements the Azure ARM Containerregistry service API version . +// +// +package containerregistry + +// 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 Containerregistry + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Containerregistry. +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/containerregistry/mgmt/2021-06-01-preview/containerregistry/connectedregistries.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/connectedregistries.go new file mode 100644 index 000000000000..ebdb3001cd94 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/connectedregistries.go @@ -0,0 +1,652 @@ +package containerregistry + +// 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" +) + +// ConnectedRegistriesClient is the client for the ConnectedRegistries methods of the Containerregistry service. +type ConnectedRegistriesClient struct { + BaseClient +} + +// NewConnectedRegistriesClient creates an instance of the ConnectedRegistriesClient client. +func NewConnectedRegistriesClient(subscriptionID string) ConnectedRegistriesClient { + return NewConnectedRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConnectedRegistriesClientWithBaseURI creates an instance of the ConnectedRegistriesClient 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 NewConnectedRegistriesClientWithBaseURI(baseURI string, subscriptionID string) ConnectedRegistriesClient { + return ConnectedRegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a connected registry for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// connectedRegistryName - the name of the connected registry. +// connectedRegistryCreateParameters - the parameters for creating a connectedRegistry. +func (client ConnectedRegistriesClient) Create(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry) (result ConnectedRegistriesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: connectedRegistryName, + Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: connectedRegistryCreateParameters, + Constraints: []validation.Constraint{{Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties.Parent", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties.Parent.SyncProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties.Parent.SyncProperties.TokenID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "connectedRegistryCreateParameters.ConnectedRegistryProperties.Parent.SyncProperties.MessageTTL", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryCreateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ConnectedRegistriesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters ConnectedRegistry) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectedRegistryName": autorest.Encode("path", connectedRegistryName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}", pathParameters), + autorest.WithJSON(connectedRegistryCreateParameters), + 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 ConnectedRegistriesClient) CreateSender(req *http.Request) (future ConnectedRegistriesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ConnectedRegistriesClient) CreateResponder(resp *http.Response) (result ConnectedRegistry, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Deactivate deactivates the connected registry instance. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// connectedRegistryName - the name of the connected registry. +func (client ConnectedRegistriesClient) Deactivate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result ConnectedRegistriesDeactivateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.Deactivate") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: connectedRegistryName, + Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Deactivate", err.Error()) + } + + req, err := client.DeactivatePreparer(ctx, resourceGroupName, registryName, connectedRegistryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Deactivate", nil, "Failure preparing request") + return + } + + result, err = client.DeactivateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Deactivate", result.Response(), "Failure sending request") + return + } + + return +} + +// DeactivatePreparer prepares the Deactivate request. +func (client ConnectedRegistriesClient) DeactivatePreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectedRegistryName": autorest.Encode("path", connectedRegistryName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/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 ConnectedRegistriesClient) DeactivateSender(req *http.Request) (future ConnectedRegistriesDeactivateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeactivateResponder handles the response to the Deactivate request. The method always +// closes the http.Response Body. +func (client ConnectedRegistriesClient) DeactivateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes a connected registry from a container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// connectedRegistryName - the name of the connected registry. +func (client ConnectedRegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result ConnectedRegistriesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: connectedRegistryName, + Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, connectedRegistryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConnectedRegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectedRegistryName": autorest.Encode("path", connectedRegistryName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}", 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 ConnectedRegistriesClient) DeleteSender(req *http.Request) (future ConnectedRegistriesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ConnectedRegistriesClient) 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 properties of the connected registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// connectedRegistryName - the name of the connected registry. +func (client ConnectedRegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result ConnectedRegistry, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: connectedRegistryName, + Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, connectedRegistryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConnectedRegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectedRegistryName": autorest.Encode("path", connectedRegistryName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}", 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 ConnectedRegistriesClient) 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 ConnectedRegistriesClient) GetResponder(resp *http.Response) (result ConnectedRegistry, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all connected registries for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// filter - an OData filter expression that describes a subset of connectedRegistries to return. The parameters +// that can be filtered are parent.id (the resource id of the connectedRegistry parent), mode, and +// connectionState. The supported operator is eq. +func (client ConnectedRegistriesClient) List(ctx context.Context, resourceGroupName string, registryName string, filter string) (result ConnectedRegistryListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.List") + defer func() { + sc := -1 + if result.crlr.Response.Response != nil { + sc = result.crlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.crlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "List", resp, "Failure sending request") + return + } + + result.crlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "List", resp, "Failure responding to request") + return + } + if result.crlr.hasNextLink() && result.crlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ConnectedRegistriesClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries", 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 ConnectedRegistriesClient) 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 ConnectedRegistriesClient) ListResponder(resp *http.Response) (result ConnectedRegistryListResult, 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 ConnectedRegistriesClient) listNextResults(ctx context.Context, lastResults ConnectedRegistryListResult) (result ConnectedRegistryListResult, err error) { + req, err := lastResults.connectedRegistryListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "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, "containerregistry.ConnectedRegistriesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ConnectedRegistriesClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string) (result ConnectedRegistryListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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, registryName, filter) + return +} + +// Update updates a connected registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// connectedRegistryName - the name of the connected registry. +// connectedRegistryUpdateParameters - the parameters for updating a connectedRegistry. +func (client ConnectedRegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters) (result ConnectedRegistriesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: connectedRegistryName, + Constraints: []validation.Constraint{{Target: "connectedRegistryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "connectedRegistryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "connectedRegistryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ConnectedRegistriesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, connectedRegistryName, connectedRegistryUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ConnectedRegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters ConnectedRegistryUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectedRegistryName": autorest.Encode("path", connectedRegistryName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}", pathParameters), + autorest.WithJSON(connectedRegistryUpdateParameters), + 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 ConnectedRegistriesClient) UpdateSender(req *http.Request) (future ConnectedRegistriesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ConnectedRegistriesClient) UpdateResponder(resp *http.Response) (result ConnectedRegistry, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/containerregistryapi/interfaces.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/containerregistryapi/interfaces.go new file mode 100644 index 000000000000..d822af89deb3 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/containerregistryapi/interfaces.go @@ -0,0 +1,204 @@ +package containerregistryapi + +// 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/containerregistry/mgmt/2021-06-01-preview/containerregistry" +) + +// ConnectedRegistriesClientAPI contains the set of methods on the ConnectedRegistriesClient type. +type ConnectedRegistriesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryCreateParameters containerregistry.ConnectedRegistry) (result containerregistry.ConnectedRegistriesCreateFuture, err error) + Deactivate(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result containerregistry.ConnectedRegistriesDeactivateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result containerregistry.ConnectedRegistriesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string) (result containerregistry.ConnectedRegistry, err error) + List(ctx context.Context, resourceGroupName string, registryName string, filter string) (result containerregistry.ConnectedRegistryListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string) (result containerregistry.ConnectedRegistryListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, connectedRegistryUpdateParameters containerregistry.ConnectedRegistryUpdateParameters) (result containerregistry.ConnectedRegistriesUpdateFuture, err error) +} + +var _ ConnectedRegistriesClientAPI = (*containerregistry.ConnectedRegistriesClient)(nil) + +// ExportPipelinesClientAPI contains the set of methods on the ExportPipelinesClient type. +type ExportPipelinesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters containerregistry.ExportPipeline) (result containerregistry.ExportPipelinesCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result containerregistry.ExportPipelinesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result containerregistry.ExportPipeline, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ExportPipelineListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ExportPipelineListResultIterator, err error) +} + +var _ ExportPipelinesClientAPI = (*containerregistry.ExportPipelinesClient)(nil) + +// RegistriesClientAPI contains the set of methods on the RegistriesClient type. +type RegistriesClientAPI interface { + CheckNameAvailability(ctx context.Context, registryNameCheckRequest containerregistry.RegistryNameCheckRequest) (result containerregistry.RegistryNameStatus, err error) + Create(ctx context.Context, resourceGroupName string, registryName string, registry containerregistry.Registry) (result containerregistry.RegistriesCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistriesDeleteFuture, err error) + GenerateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters containerregistry.GenerateCredentialsParameters) (result containerregistry.RegistriesGenerateCredentialsFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.Registry, err error) + GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.SourceUploadDefinition, err error) + ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters containerregistry.ImportImageParameters) (result containerregistry.RegistriesImportImageFuture, err error) + List(ctx context.Context) (result containerregistry.RegistryListResultPage, err error) + ListComplete(ctx context.Context) (result containerregistry.RegistryListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerregistry.RegistryListResultIterator, err error) + ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryListCredentialsResult, err error) + ListPrivateLinkResources(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateLinkResourceListResultPage, err error) + ListPrivateLinkResourcesComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateLinkResourceListResultIterator, err error) + ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.RegistryUsageListResult, err error) + RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters containerregistry.RegenerateCredentialParameters) (result containerregistry.RegistryListCredentialsResult, err error) + ScheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest containerregistry.BasicRunRequest) (result containerregistry.RegistriesScheduleRunFuture, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters containerregistry.RegistryUpdateParameters) (result containerregistry.RegistriesUpdateFuture, err error) +} + +var _ RegistriesClientAPI = (*containerregistry.RegistriesClient)(nil) + +// ImportPipelinesClientAPI contains the set of methods on the ImportPipelinesClient type. +type ImportPipelinesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters containerregistry.ImportPipeline) (result containerregistry.ImportPipelinesCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result containerregistry.ImportPipelinesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result containerregistry.ImportPipeline, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ImportPipelineListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ImportPipelineListResultIterator, err error) +} + +var _ ImportPipelinesClientAPI = (*containerregistry.ImportPipelinesClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result containerregistry.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result containerregistry.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*containerregistry.OperationsClient)(nil) + +// PipelineRunsClientAPI contains the set of methods on the PipelineRunsClient type. +type PipelineRunsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters containerregistry.PipelineRun) (result containerregistry.PipelineRunsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result containerregistry.PipelineRunsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result containerregistry.PipelineRun, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PipelineRunListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PipelineRunListResultIterator, err error) +} + +var _ PipelineRunsClientAPI = (*containerregistry.PipelineRunsClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection containerregistry.PrivateEndpointConnection) (result containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result containerregistry.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (result containerregistry.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateEndpointConnectionListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.PrivateEndpointConnectionListResultIterator, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*containerregistry.PrivateEndpointConnectionsClient)(nil) + +// ReplicationsClientAPI contains the set of methods on the ReplicationsClient type. +type ReplicationsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication containerregistry.Replication) (result containerregistry.ReplicationsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.ReplicationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result containerregistry.Replication, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ReplicationListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters containerregistry.ReplicationUpdateParameters) (result containerregistry.ReplicationsUpdateFuture, err error) +} + +var _ ReplicationsClientAPI = (*containerregistry.ReplicationsClient)(nil) + +// ScopeMapsClientAPI contains the set of methods on the ScopeMapsClient type. +type ScopeMapsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters containerregistry.ScopeMap) (result containerregistry.ScopeMapsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result containerregistry.ScopeMapsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result containerregistry.ScopeMap, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ScopeMapListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.ScopeMapListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters containerregistry.ScopeMapUpdateParameters) (result containerregistry.ScopeMapsUpdateFuture, err error) +} + +var _ ScopeMapsClientAPI = (*containerregistry.ScopeMapsClient)(nil) + +// TokensClientAPI contains the set of methods on the TokensClient type. +type TokensClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters containerregistry.Token) (result containerregistry.TokensCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result containerregistry.TokensDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result containerregistry.Token, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TokenListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TokenListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters containerregistry.TokenUpdateParameters) (result containerregistry.TokensUpdateFuture, err error) +} + +var _ TokensClientAPI = (*containerregistry.TokensClient)(nil) + +// WebhooksClientAPI contains the set of methods on the WebhooksClient type. +type WebhooksClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters containerregistry.WebhookCreateParameters) (result containerregistry.WebhooksCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.WebhooksDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.Webhook, err error) + GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.CallbackConfig, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.WebhookListResultIterator, err error) + ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultPage, err error) + ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventListResultIterator, err error) + Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result containerregistry.EventInfo, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters containerregistry.WebhookUpdateParameters) (result containerregistry.WebhooksUpdateFuture, err error) +} + +var _ WebhooksClientAPI = (*containerregistry.WebhooksClient)(nil) + +// AgentPoolsClientAPI contains the set of methods on the AgentPoolsClient type. +type AgentPoolsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, agentPool containerregistry.AgentPool) (result containerregistry.AgentPoolsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPoolsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPool, err error) + GetQueueStatus(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string) (result containerregistry.AgentPoolQueueStatus, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.AgentPoolListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.AgentPoolListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, agentPoolName string, updateParameters containerregistry.AgentPoolUpdateParameters) (result containerregistry.AgentPoolsUpdateFuture, err error) +} + +var _ AgentPoolsClientAPI = (*containerregistry.AgentPoolsClient)(nil) + +// RunsClientAPI contains the set of methods on the RunsClient type. +type RunsClientAPI interface { + Cancel(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.RunsCancelFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.Run, err error) + GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string) (result containerregistry.RunGetLogResult, err error) + List(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result containerregistry.RunListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result containerregistry.RunListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters containerregistry.RunUpdateParameters) (result containerregistry.RunsUpdateFuture, err error) +} + +var _ RunsClientAPI = (*containerregistry.RunsClient)(nil) + +// TaskRunsClientAPI contains the set of methods on the TaskRunsClient type. +type TaskRunsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun containerregistry.TaskRun) (result containerregistry.TaskRunsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRunsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRun, err error) + GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result containerregistry.TaskRun, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskRunListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskRunListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters containerregistry.TaskRunUpdateParameters) (result containerregistry.TaskRunsUpdateFuture, err error) +} + +var _ TaskRunsClientAPI = (*containerregistry.TaskRunsClient)(nil) + +// TasksClientAPI contains the set of methods on the TasksClient type. +type TasksClientAPI interface { + Create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters containerregistry.Task) (result containerregistry.TasksCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.TasksDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.Task, err error) + GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result containerregistry.Task, err error) + List(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result containerregistry.TaskListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters containerregistry.TaskUpdateParameters) (result containerregistry.TasksUpdateFuture, err error) +} + +var _ TasksClientAPI = (*containerregistry.TasksClient)(nil) diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/enums.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/enums.go new file mode 100644 index 000000000000..0719013c14e9 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/enums.go @@ -0,0 +1,895 @@ +package containerregistry + +// 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. + +// Action enumerates the values for action. +type Action string + +const ( + // ActionAllow ... + ActionAllow Action = "Allow" +) + +// PossibleActionValues returns an array of possible values for the Action const type. +func PossibleActionValues() []Action { + return []Action{ActionAllow} +} + +// ActionsRequired enumerates the values for actions required. +type ActionsRequired string + +const ( + // ActionsRequiredNone ... + ActionsRequiredNone ActionsRequired = "None" + // ActionsRequiredRecreate ... + ActionsRequiredRecreate ActionsRequired = "Recreate" +) + +// PossibleActionsRequiredValues returns an array of possible values for the ActionsRequired const type. +func PossibleActionsRequiredValues() []ActionsRequired { + return []ActionsRequired{ActionsRequiredNone, ActionsRequiredRecreate} +} + +// ActivationStatus enumerates the values for activation status. +type ActivationStatus string + +const ( + // ActivationStatusActive ... + ActivationStatusActive ActivationStatus = "Active" + // ActivationStatusInactive ... + ActivationStatusInactive ActivationStatus = "Inactive" +) + +// PossibleActivationStatusValues returns an array of possible values for the ActivationStatus const type. +func PossibleActivationStatusValues() []ActivationStatus { + return []ActivationStatus{ActivationStatusActive, ActivationStatusInactive} +} + +// Architecture enumerates the values for architecture. +type Architecture string + +const ( + // ArchitectureAmd64 ... + ArchitectureAmd64 Architecture = "amd64" + // ArchitectureArm ... + ArchitectureArm Architecture = "arm" + // ArchitectureArm64 ... + ArchitectureArm64 Architecture = "arm64" + // ArchitectureThreeEightSix ... + ArchitectureThreeEightSix Architecture = "386" + // ArchitectureX86 ... + ArchitectureX86 Architecture = "x86" +) + +// PossibleArchitectureValues returns an array of possible values for the Architecture const type. +func PossibleArchitectureValues() []Architecture { + return []Architecture{ArchitectureAmd64, ArchitectureArm, ArchitectureArm64, ArchitectureThreeEightSix, ArchitectureX86} +} + +// AuditLogStatus enumerates the values for audit log status. +type AuditLogStatus string + +const ( + // AuditLogStatusDisabled ... + AuditLogStatusDisabled AuditLogStatus = "Disabled" + // AuditLogStatusEnabled ... + AuditLogStatusEnabled AuditLogStatus = "Enabled" +) + +// PossibleAuditLogStatusValues returns an array of possible values for the AuditLogStatus const type. +func PossibleAuditLogStatusValues() []AuditLogStatus { + return []AuditLogStatus{AuditLogStatusDisabled, AuditLogStatusEnabled} +} + +// BaseImageDependencyType enumerates the values for base image dependency type. +type BaseImageDependencyType string + +const ( + // BaseImageDependencyTypeBuildTime ... + BaseImageDependencyTypeBuildTime BaseImageDependencyType = "BuildTime" + // BaseImageDependencyTypeRunTime ... + BaseImageDependencyTypeRunTime BaseImageDependencyType = "RunTime" +) + +// PossibleBaseImageDependencyTypeValues returns an array of possible values for the BaseImageDependencyType const type. +func PossibleBaseImageDependencyTypeValues() []BaseImageDependencyType { + return []BaseImageDependencyType{BaseImageDependencyTypeBuildTime, BaseImageDependencyTypeRunTime} +} + +// BaseImageTriggerType enumerates the values for base image trigger type. +type BaseImageTriggerType string + +const ( + // BaseImageTriggerTypeAll ... + BaseImageTriggerTypeAll BaseImageTriggerType = "All" + // BaseImageTriggerTypeRuntime ... + BaseImageTriggerTypeRuntime BaseImageTriggerType = "Runtime" +) + +// PossibleBaseImageTriggerTypeValues returns an array of possible values for the BaseImageTriggerType const type. +func PossibleBaseImageTriggerTypeValues() []BaseImageTriggerType { + return []BaseImageTriggerType{BaseImageTriggerTypeAll, BaseImageTriggerTypeRuntime} +} + +// CertificateType enumerates the values for certificate type. +type CertificateType string + +const ( + // CertificateTypeLocalDirectory ... + CertificateTypeLocalDirectory CertificateType = "LocalDirectory" +) + +// PossibleCertificateTypeValues returns an array of possible values for the CertificateType const type. +func PossibleCertificateTypeValues() []CertificateType { + return []CertificateType{CertificateTypeLocalDirectory} +} + +// ConnectedRegistryMode enumerates the values for connected registry mode. +type ConnectedRegistryMode string + +const ( + // ConnectedRegistryModeMirror ... + ConnectedRegistryModeMirror ConnectedRegistryMode = "Mirror" + // ConnectedRegistryModeRegistry ... + ConnectedRegistryModeRegistry ConnectedRegistryMode = "Registry" +) + +// PossibleConnectedRegistryModeValues returns an array of possible values for the ConnectedRegistryMode const type. +func PossibleConnectedRegistryModeValues() []ConnectedRegistryMode { + return []ConnectedRegistryMode{ConnectedRegistryModeMirror, ConnectedRegistryModeRegistry} +} + +// ConnectionState enumerates the values for connection state. +type ConnectionState string + +const ( + // ConnectionStateOffline ... + ConnectionStateOffline ConnectionState = "Offline" + // ConnectionStateOnline ... + ConnectionStateOnline ConnectionState = "Online" + // ConnectionStateSyncing ... + ConnectionStateSyncing ConnectionState = "Syncing" + // ConnectionStateUnhealthy ... + ConnectionStateUnhealthy ConnectionState = "Unhealthy" +) + +// PossibleConnectionStateValues returns an array of possible values for the ConnectionState const type. +func PossibleConnectionStateValues() []ConnectionState { + return []ConnectionState{ConnectionStateOffline, ConnectionStateOnline, ConnectionStateSyncing, ConnectionStateUnhealthy} +} + +// ConnectionStatus enumerates the values for connection status. +type ConnectionStatus string + +const ( + // ConnectionStatusApproved ... + ConnectionStatusApproved ConnectionStatus = "Approved" + // ConnectionStatusDisconnected ... + ConnectionStatusDisconnected ConnectionStatus = "Disconnected" + // ConnectionStatusPending ... + ConnectionStatusPending ConnectionStatus = "Pending" + // ConnectionStatusRejected ... + ConnectionStatusRejected ConnectionStatus = "Rejected" +) + +// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. +func PossibleConnectionStatusValues() []ConnectionStatus { + return []ConnectionStatus{ConnectionStatusApproved, ConnectionStatusDisconnected, ConnectionStatusPending, ConnectionStatusRejected} +} + +// 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} +} + +// DefaultAction enumerates the values for default action. +type DefaultAction string + +const ( + // DefaultActionAllow ... + DefaultActionAllow DefaultAction = "Allow" + // DefaultActionDeny ... + DefaultActionDeny DefaultAction = "Deny" +) + +// PossibleDefaultActionValues returns an array of possible values for the DefaultAction const type. +func PossibleDefaultActionValues() []DefaultAction { + return []DefaultAction{DefaultActionAllow, DefaultActionDeny} +} + +// EncryptionStatus enumerates the values for encryption status. +type EncryptionStatus string + +const ( + // EncryptionStatusDisabled ... + EncryptionStatusDisabled EncryptionStatus = "disabled" + // EncryptionStatusEnabled ... + EncryptionStatusEnabled EncryptionStatus = "enabled" +) + +// PossibleEncryptionStatusValues returns an array of possible values for the EncryptionStatus const type. +func PossibleEncryptionStatusValues() []EncryptionStatus { + return []EncryptionStatus{EncryptionStatusDisabled, EncryptionStatusEnabled} +} + +// ExportPolicyStatus enumerates the values for export policy status. +type ExportPolicyStatus string + +const ( + // ExportPolicyStatusDisabled ... + ExportPolicyStatusDisabled ExportPolicyStatus = "disabled" + // ExportPolicyStatusEnabled ... + ExportPolicyStatusEnabled ExportPolicyStatus = "enabled" +) + +// PossibleExportPolicyStatusValues returns an array of possible values for the ExportPolicyStatus const type. +func PossibleExportPolicyStatusValues() []ExportPolicyStatus { + return []ExportPolicyStatus{ExportPolicyStatusDisabled, ExportPolicyStatusEnabled} +} + +// ImportMode enumerates the values for import mode. +type ImportMode string + +const ( + // ImportModeForce ... + ImportModeForce ImportMode = "Force" + // ImportModeNoForce ... + ImportModeNoForce ImportMode = "NoForce" +) + +// PossibleImportModeValues returns an array of possible values for the ImportMode const type. +func PossibleImportModeValues() []ImportMode { + return []ImportMode{ImportModeForce, ImportModeNoForce} +} + +// LastModifiedByType enumerates the values for last modified by type. +type LastModifiedByType string + +const ( + // LastModifiedByTypeApplication ... + LastModifiedByTypeApplication LastModifiedByType = "Application" + // LastModifiedByTypeKey ... + LastModifiedByTypeKey LastModifiedByType = "Key" + // LastModifiedByTypeManagedIdentity ... + LastModifiedByTypeManagedIdentity LastModifiedByType = "ManagedIdentity" + // LastModifiedByTypeUser ... + LastModifiedByTypeUser LastModifiedByType = "User" +) + +// PossibleLastModifiedByTypeValues returns an array of possible values for the LastModifiedByType const type. +func PossibleLastModifiedByTypeValues() []LastModifiedByType { + return []LastModifiedByType{LastModifiedByTypeApplication, LastModifiedByTypeKey, LastModifiedByTypeManagedIdentity, LastModifiedByTypeUser} +} + +// LogLevel enumerates the values for log level. +type LogLevel string + +const ( + // LogLevelDebug ... + LogLevelDebug LogLevel = "Debug" + // LogLevelError ... + LogLevelError LogLevel = "Error" + // LogLevelInformation ... + LogLevelInformation LogLevel = "Information" + // LogLevelNone ... + LogLevelNone LogLevel = "None" + // LogLevelWarning ... + LogLevelWarning LogLevel = "Warning" +) + +// PossibleLogLevelValues returns an array of possible values for the LogLevel const type. +func PossibleLogLevelValues() []LogLevel { + return []LogLevel{LogLevelDebug, LogLevelError, LogLevelInformation, LogLevelNone, LogLevelWarning} +} + +// NetworkRuleBypassOptions enumerates the values for network rule bypass options. +type NetworkRuleBypassOptions string + +const ( + // NetworkRuleBypassOptionsAzureServices ... + NetworkRuleBypassOptionsAzureServices NetworkRuleBypassOptions = "AzureServices" + // NetworkRuleBypassOptionsNone ... + NetworkRuleBypassOptionsNone NetworkRuleBypassOptions = "None" +) + +// PossibleNetworkRuleBypassOptionsValues returns an array of possible values for the NetworkRuleBypassOptions const type. +func PossibleNetworkRuleBypassOptionsValues() []NetworkRuleBypassOptions { + return []NetworkRuleBypassOptions{NetworkRuleBypassOptionsAzureServices, NetworkRuleBypassOptionsNone} +} + +// OS enumerates the values for os. +type OS string + +const ( + // OSLinux ... + OSLinux OS = "Linux" + // OSWindows ... + OSWindows OS = "Windows" +) + +// PossibleOSValues returns an array of possible values for the OS const type. +func PossibleOSValues() []OS { + return []OS{OSLinux, OSWindows} +} + +// PasswordName enumerates the values for password name. +type PasswordName string + +const ( + // PasswordNamePassword ... + PasswordNamePassword PasswordName = "password" + // PasswordNamePassword2 ... + PasswordNamePassword2 PasswordName = "password2" +) + +// PossiblePasswordNameValues returns an array of possible values for the PasswordName const type. +func PossiblePasswordNameValues() []PasswordName { + return []PasswordName{PasswordNamePassword, PasswordNamePassword2} +} + +// PipelineOptions enumerates the values for pipeline options. +type PipelineOptions string + +const ( + // PipelineOptionsContinueOnErrors ... + PipelineOptionsContinueOnErrors PipelineOptions = "ContinueOnErrors" + // PipelineOptionsDeleteSourceBlobOnSuccess ... + PipelineOptionsDeleteSourceBlobOnSuccess PipelineOptions = "DeleteSourceBlobOnSuccess" + // PipelineOptionsOverwriteBlobs ... + PipelineOptionsOverwriteBlobs PipelineOptions = "OverwriteBlobs" + // PipelineOptionsOverwriteTags ... + PipelineOptionsOverwriteTags PipelineOptions = "OverwriteTags" +) + +// PossiblePipelineOptionsValues returns an array of possible values for the PipelineOptions const type. +func PossiblePipelineOptionsValues() []PipelineOptions { + return []PipelineOptions{PipelineOptionsContinueOnErrors, PipelineOptionsDeleteSourceBlobOnSuccess, PipelineOptionsOverwriteBlobs, PipelineOptionsOverwriteTags} +} + +// PipelineRunSourceType enumerates the values for pipeline run source type. +type PipelineRunSourceType string + +const ( + // PipelineRunSourceTypeAzureStorageBlob ... + PipelineRunSourceTypeAzureStorageBlob PipelineRunSourceType = "AzureStorageBlob" +) + +// PossiblePipelineRunSourceTypeValues returns an array of possible values for the PipelineRunSourceType const type. +func PossiblePipelineRunSourceTypeValues() []PipelineRunSourceType { + return []PipelineRunSourceType{PipelineRunSourceTypeAzureStorageBlob} +} + +// PipelineRunTargetType enumerates the values for pipeline run target type. +type PipelineRunTargetType string + +const ( + // PipelineRunTargetTypeAzureStorageBlob ... + PipelineRunTargetTypeAzureStorageBlob PipelineRunTargetType = "AzureStorageBlob" +) + +// PossiblePipelineRunTargetTypeValues returns an array of possible values for the PipelineRunTargetType const type. +func PossiblePipelineRunTargetTypeValues() []PipelineRunTargetType { + return []PipelineRunTargetType{PipelineRunTargetTypeAzureStorageBlob} +} + +// PipelineSourceType enumerates the values for pipeline source type. +type PipelineSourceType string + +const ( + // PipelineSourceTypeAzureStorageBlobContainer ... + PipelineSourceTypeAzureStorageBlobContainer PipelineSourceType = "AzureStorageBlobContainer" +) + +// PossiblePipelineSourceTypeValues returns an array of possible values for the PipelineSourceType const type. +func PossiblePipelineSourceTypeValues() []PipelineSourceType { + return []PipelineSourceType{PipelineSourceTypeAzureStorageBlobContainer} +} + +// PolicyStatus enumerates the values for policy status. +type PolicyStatus string + +const ( + // PolicyStatusDisabled ... + PolicyStatusDisabled PolicyStatus = "disabled" + // PolicyStatusEnabled ... + PolicyStatusEnabled PolicyStatus = "enabled" +) + +// PossiblePolicyStatusValues returns an array of possible values for the PolicyStatus const type. +func PossiblePolicyStatusValues() []PolicyStatus { + return []PolicyStatus{PolicyStatusDisabled, PolicyStatusEnabled} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // 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{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, 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} +} + +// RegistryUsageUnit enumerates the values for registry usage unit. +type RegistryUsageUnit string + +const ( + // RegistryUsageUnitBytes ... + RegistryUsageUnitBytes RegistryUsageUnit = "Bytes" + // RegistryUsageUnitCount ... + RegistryUsageUnitCount RegistryUsageUnit = "Count" +) + +// PossibleRegistryUsageUnitValues returns an array of possible values for the RegistryUsageUnit const type. +func PossibleRegistryUsageUnitValues() []RegistryUsageUnit { + return []RegistryUsageUnit{RegistryUsageUnitBytes, RegistryUsageUnitCount} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone ... + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned ... + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeSystemAssignedUserAssigned ... + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + // ResourceIdentityTypeUserAssigned ... + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} +} + +// RunStatus enumerates the values for run status. +type RunStatus string + +const ( + // RunStatusCanceled ... + RunStatusCanceled RunStatus = "Canceled" + // RunStatusError ... + RunStatusError RunStatus = "Error" + // RunStatusFailed ... + RunStatusFailed RunStatus = "Failed" + // RunStatusQueued ... + RunStatusQueued RunStatus = "Queued" + // RunStatusRunning ... + RunStatusRunning RunStatus = "Running" + // RunStatusStarted ... + RunStatusStarted RunStatus = "Started" + // RunStatusSucceeded ... + RunStatusSucceeded RunStatus = "Succeeded" + // RunStatusTimeout ... + RunStatusTimeout RunStatus = "Timeout" +) + +// PossibleRunStatusValues returns an array of possible values for the RunStatus const type. +func PossibleRunStatusValues() []RunStatus { + return []RunStatus{RunStatusCanceled, RunStatusError, RunStatusFailed, RunStatusQueued, RunStatusRunning, RunStatusStarted, RunStatusSucceeded, RunStatusTimeout} +} + +// RunType enumerates the values for run type. +type RunType string + +const ( + // RunTypeAutoBuild ... + RunTypeAutoBuild RunType = "AutoBuild" + // RunTypeAutoRun ... + RunTypeAutoRun RunType = "AutoRun" + // RunTypeQuickBuild ... + RunTypeQuickBuild RunType = "QuickBuild" + // RunTypeQuickRun ... + RunTypeQuickRun RunType = "QuickRun" +) + +// PossibleRunTypeValues returns an array of possible values for the RunType const type. +func PossibleRunTypeValues() []RunType { + return []RunType{RunTypeAutoBuild, RunTypeAutoRun, RunTypeQuickBuild, RunTypeQuickRun} +} + +// SecretObjectType enumerates the values for secret object type. +type SecretObjectType string + +const ( + // SecretObjectTypeOpaque ... + SecretObjectTypeOpaque SecretObjectType = "Opaque" + // SecretObjectTypeVaultsecret ... + SecretObjectTypeVaultsecret SecretObjectType = "Vaultsecret" +) + +// PossibleSecretObjectTypeValues returns an array of possible values for the SecretObjectType const type. +func PossibleSecretObjectTypeValues() []SecretObjectType { + return []SecretObjectType{SecretObjectTypeOpaque, SecretObjectTypeVaultsecret} +} + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // SkuNameBasic ... + SkuNameBasic SkuName = "Basic" + // SkuNameClassic ... + SkuNameClassic SkuName = "Classic" + // SkuNamePremium ... + SkuNamePremium SkuName = "Premium" + // SkuNameStandard ... + SkuNameStandard SkuName = "Standard" +) + +// PossibleSkuNameValues returns an array of possible values for the SkuName const type. +func PossibleSkuNameValues() []SkuName { + return []SkuName{SkuNameBasic, SkuNameClassic, SkuNamePremium, SkuNameStandard} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // SkuTierBasic ... + SkuTierBasic SkuTier = "Basic" + // SkuTierClassic ... + SkuTierClassic SkuTier = "Classic" + // SkuTierPremium ... + SkuTierPremium SkuTier = "Premium" + // SkuTierStandard ... + SkuTierStandard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{SkuTierBasic, SkuTierClassic, SkuTierPremium, SkuTierStandard} +} + +// SourceControlType enumerates the values for source control type. +type SourceControlType string + +const ( + // SourceControlTypeGithub ... + SourceControlTypeGithub SourceControlType = "Github" + // SourceControlTypeVisualStudioTeamService ... + SourceControlTypeVisualStudioTeamService SourceControlType = "VisualStudioTeamService" +) + +// PossibleSourceControlTypeValues returns an array of possible values for the SourceControlType const type. +func PossibleSourceControlTypeValues() []SourceControlType { + return []SourceControlType{SourceControlTypeGithub, SourceControlTypeVisualStudioTeamService} +} + +// SourceRegistryLoginMode enumerates the values for source registry login mode. +type SourceRegistryLoginMode string + +const ( + // SourceRegistryLoginModeDefault ... + SourceRegistryLoginModeDefault SourceRegistryLoginMode = "Default" + // SourceRegistryLoginModeNone ... + SourceRegistryLoginModeNone SourceRegistryLoginMode = "None" +) + +// PossibleSourceRegistryLoginModeValues returns an array of possible values for the SourceRegistryLoginMode const type. +func PossibleSourceRegistryLoginModeValues() []SourceRegistryLoginMode { + return []SourceRegistryLoginMode{SourceRegistryLoginModeDefault, SourceRegistryLoginModeNone} +} + +// SourceTriggerEvent enumerates the values for source trigger event. +type SourceTriggerEvent string + +const ( + // SourceTriggerEventCommit ... + SourceTriggerEventCommit SourceTriggerEvent = "commit" + // SourceTriggerEventPullrequest ... + SourceTriggerEventPullrequest SourceTriggerEvent = "pullrequest" +) + +// PossibleSourceTriggerEventValues returns an array of possible values for the SourceTriggerEvent const type. +func PossibleSourceTriggerEventValues() []SourceTriggerEvent { + return []SourceTriggerEvent{SourceTriggerEventCommit, SourceTriggerEventPullrequest} +} + +// TaskStatus enumerates the values for task status. +type TaskStatus string + +const ( + // TaskStatusDisabled ... + TaskStatusDisabled TaskStatus = "Disabled" + // TaskStatusEnabled ... + TaskStatusEnabled TaskStatus = "Enabled" +) + +// PossibleTaskStatusValues returns an array of possible values for the TaskStatus const type. +func PossibleTaskStatusValues() []TaskStatus { + return []TaskStatus{TaskStatusDisabled, TaskStatusEnabled} +} + +// TLSStatus enumerates the values for tls status. +type TLSStatus string + +const ( + // TLSStatusDisabled ... + TLSStatusDisabled TLSStatus = "Disabled" + // TLSStatusEnabled ... + TLSStatusEnabled TLSStatus = "Enabled" +) + +// PossibleTLSStatusValues returns an array of possible values for the TLSStatus const type. +func PossibleTLSStatusValues() []TLSStatus { + return []TLSStatus{TLSStatusDisabled, TLSStatusEnabled} +} + +// TokenCertificateName enumerates the values for token certificate name. +type TokenCertificateName string + +const ( + // TokenCertificateNameCertificate1 ... + TokenCertificateNameCertificate1 TokenCertificateName = "certificate1" + // TokenCertificateNameCertificate2 ... + TokenCertificateNameCertificate2 TokenCertificateName = "certificate2" +) + +// PossibleTokenCertificateNameValues returns an array of possible values for the TokenCertificateName const type. +func PossibleTokenCertificateNameValues() []TokenCertificateName { + return []TokenCertificateName{TokenCertificateNameCertificate1, TokenCertificateNameCertificate2} +} + +// TokenPasswordName enumerates the values for token password name. +type TokenPasswordName string + +const ( + // TokenPasswordNamePassword1 ... + TokenPasswordNamePassword1 TokenPasswordName = "password1" + // TokenPasswordNamePassword2 ... + TokenPasswordNamePassword2 TokenPasswordName = "password2" +) + +// PossibleTokenPasswordNameValues returns an array of possible values for the TokenPasswordName const type. +func PossibleTokenPasswordNameValues() []TokenPasswordName { + return []TokenPasswordName{TokenPasswordNamePassword1, TokenPasswordNamePassword2} +} + +// TokenStatus enumerates the values for token status. +type TokenStatus string + +const ( + // TokenStatusDisabled ... + TokenStatusDisabled TokenStatus = "disabled" + // TokenStatusEnabled ... + TokenStatusEnabled TokenStatus = "enabled" +) + +// PossibleTokenStatusValues returns an array of possible values for the TokenStatus const type. +func PossibleTokenStatusValues() []TokenStatus { + return []TokenStatus{TokenStatusDisabled, TokenStatusEnabled} +} + +// TokenType enumerates the values for token type. +type TokenType string + +const ( + // TokenTypeOAuth ... + TokenTypeOAuth TokenType = "OAuth" + // TokenTypePAT ... + TokenTypePAT TokenType = "PAT" +) + +// PossibleTokenTypeValues returns an array of possible values for the TokenType const type. +func PossibleTokenTypeValues() []TokenType { + return []TokenType{TokenTypeOAuth, TokenTypePAT} +} + +// TriggerStatus enumerates the values for trigger status. +type TriggerStatus string + +const ( + // TriggerStatusDisabled ... + TriggerStatusDisabled TriggerStatus = "Disabled" + // TriggerStatusEnabled ... + TriggerStatusEnabled TriggerStatus = "Enabled" +) + +// PossibleTriggerStatusValues returns an array of possible values for the TriggerStatus const type. +func PossibleTriggerStatusValues() []TriggerStatus { + return []TriggerStatus{TriggerStatusDisabled, TriggerStatusEnabled} +} + +// TrustPolicyType enumerates the values for trust policy type. +type TrustPolicyType string + +const ( + // TrustPolicyTypeNotary ... + TrustPolicyTypeNotary TrustPolicyType = "Notary" +) + +// PossibleTrustPolicyTypeValues returns an array of possible values for the TrustPolicyType const type. +func PossibleTrustPolicyTypeValues() []TrustPolicyType { + return []TrustPolicyType{TrustPolicyTypeNotary} +} + +// Type enumerates the values for type. +type Type string + +const ( + // TypeDockerBuildRequest ... + TypeDockerBuildRequest Type = "DockerBuildRequest" + // TypeEncodedTaskRunRequest ... + TypeEncodedTaskRunRequest Type = "EncodedTaskRunRequest" + // TypeFileTaskRunRequest ... + TypeFileTaskRunRequest Type = "FileTaskRunRequest" + // TypeRunRequest ... + TypeRunRequest Type = "RunRequest" + // TypeTaskRunRequest ... + TypeTaskRunRequest Type = "TaskRunRequest" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{TypeDockerBuildRequest, TypeEncodedTaskRunRequest, TypeFileTaskRunRequest, TypeRunRequest, TypeTaskRunRequest} +} + +// TypeBasicTaskStepProperties enumerates the values for type basic task step properties. +type TypeBasicTaskStepProperties string + +const ( + // TypeBasicTaskStepPropertiesTypeDocker ... + TypeBasicTaskStepPropertiesTypeDocker TypeBasicTaskStepProperties = "Docker" + // TypeBasicTaskStepPropertiesTypeEncodedTask ... + TypeBasicTaskStepPropertiesTypeEncodedTask TypeBasicTaskStepProperties = "EncodedTask" + // TypeBasicTaskStepPropertiesTypeFileTask ... + TypeBasicTaskStepPropertiesTypeFileTask TypeBasicTaskStepProperties = "FileTask" + // TypeBasicTaskStepPropertiesTypeTaskStepProperties ... + TypeBasicTaskStepPropertiesTypeTaskStepProperties TypeBasicTaskStepProperties = "TaskStepProperties" +) + +// PossibleTypeBasicTaskStepPropertiesValues returns an array of possible values for the TypeBasicTaskStepProperties const type. +func PossibleTypeBasicTaskStepPropertiesValues() []TypeBasicTaskStepProperties { + return []TypeBasicTaskStepProperties{TypeBasicTaskStepPropertiesTypeDocker, TypeBasicTaskStepPropertiesTypeEncodedTask, TypeBasicTaskStepPropertiesTypeFileTask, TypeBasicTaskStepPropertiesTypeTaskStepProperties} +} + +// TypeBasicTaskStepUpdateParameters enumerates the values for type basic task step update parameters. +type TypeBasicTaskStepUpdateParameters string + +const ( + // TypeBasicTaskStepUpdateParametersTypeDocker ... + TypeBasicTaskStepUpdateParametersTypeDocker TypeBasicTaskStepUpdateParameters = "Docker" + // TypeBasicTaskStepUpdateParametersTypeEncodedTask ... + TypeBasicTaskStepUpdateParametersTypeEncodedTask TypeBasicTaskStepUpdateParameters = "EncodedTask" + // TypeBasicTaskStepUpdateParametersTypeFileTask ... + TypeBasicTaskStepUpdateParametersTypeFileTask TypeBasicTaskStepUpdateParameters = "FileTask" + // TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters ... + TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters TypeBasicTaskStepUpdateParameters = "TaskStepUpdateParameters" +) + +// PossibleTypeBasicTaskStepUpdateParametersValues returns an array of possible values for the TypeBasicTaskStepUpdateParameters const type. +func PossibleTypeBasicTaskStepUpdateParametersValues() []TypeBasicTaskStepUpdateParameters { + return []TypeBasicTaskStepUpdateParameters{TypeBasicTaskStepUpdateParametersTypeDocker, TypeBasicTaskStepUpdateParametersTypeEncodedTask, TypeBasicTaskStepUpdateParametersTypeFileTask, TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters} +} + +// UpdateTriggerPayloadType enumerates the values for update trigger payload type. +type UpdateTriggerPayloadType string + +const ( + // UpdateTriggerPayloadTypeDefault ... + UpdateTriggerPayloadTypeDefault UpdateTriggerPayloadType = "Default" + // UpdateTriggerPayloadTypeToken ... + UpdateTriggerPayloadTypeToken UpdateTriggerPayloadType = "Token" +) + +// PossibleUpdateTriggerPayloadTypeValues returns an array of possible values for the UpdateTriggerPayloadType const type. +func PossibleUpdateTriggerPayloadTypeValues() []UpdateTriggerPayloadType { + return []UpdateTriggerPayloadType{UpdateTriggerPayloadTypeDefault, UpdateTriggerPayloadTypeToken} +} + +// Variant enumerates the values for variant. +type Variant string + +const ( + // VariantV6 ... + VariantV6 Variant = "v6" + // VariantV7 ... + VariantV7 Variant = "v7" + // VariantV8 ... + VariantV8 Variant = "v8" +) + +// PossibleVariantValues returns an array of possible values for the Variant const type. +func PossibleVariantValues() []Variant { + return []Variant{VariantV6, VariantV7, VariantV8} +} + +// WebhookAction enumerates the values for webhook action. +type WebhookAction string + +const ( + // WebhookActionChartDelete ... + WebhookActionChartDelete WebhookAction = "chart_delete" + // WebhookActionChartPush ... + WebhookActionChartPush WebhookAction = "chart_push" + // WebhookActionDelete ... + WebhookActionDelete WebhookAction = "delete" + // WebhookActionPush ... + WebhookActionPush WebhookAction = "push" + // WebhookActionQuarantine ... + WebhookActionQuarantine WebhookAction = "quarantine" +) + +// PossibleWebhookActionValues returns an array of possible values for the WebhookAction const type. +func PossibleWebhookActionValues() []WebhookAction { + return []WebhookAction{WebhookActionChartDelete, WebhookActionChartPush, WebhookActionDelete, WebhookActionPush, WebhookActionQuarantine} +} + +// WebhookStatus enumerates the values for webhook status. +type WebhookStatus string + +const ( + // WebhookStatusDisabled ... + WebhookStatusDisabled WebhookStatus = "disabled" + // WebhookStatusEnabled ... + WebhookStatusEnabled WebhookStatus = "enabled" +) + +// PossibleWebhookStatusValues returns an array of possible values for the WebhookStatus const type. +func PossibleWebhookStatusValues() []WebhookStatus { + return []WebhookStatus{WebhookStatusDisabled, WebhookStatusEnabled} +} + +// ZoneRedundancy enumerates the values for zone redundancy. +type ZoneRedundancy string + +const ( + // ZoneRedundancyDisabled ... + ZoneRedundancyDisabled ZoneRedundancy = "Disabled" + // ZoneRedundancyEnabled ... + ZoneRedundancyEnabled ZoneRedundancy = "Enabled" +) + +// PossibleZoneRedundancyValues returns an array of possible values for the ZoneRedundancy const type. +func PossibleZoneRedundancyValues() []ZoneRedundancy { + return []ZoneRedundancy{ZoneRedundancyDisabled, ZoneRedundancyEnabled} +} diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/exportpipelines.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/exportpipelines.go new file mode 100644 index 000000000000..9c05b9b9f82d --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/exportpipelines.go @@ -0,0 +1,449 @@ +package containerregistry + +// 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" +) + +// ExportPipelinesClient is the client for the ExportPipelines methods of the Containerregistry service. +type ExportPipelinesClient struct { + BaseClient +} + +// NewExportPipelinesClient creates an instance of the ExportPipelinesClient client. +func NewExportPipelinesClient(subscriptionID string) ExportPipelinesClient { + return NewExportPipelinesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExportPipelinesClientWithBaseURI creates an instance of the ExportPipelinesClient 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 NewExportPipelinesClientWithBaseURI(baseURI string, subscriptionID string) ExportPipelinesClient { + return ExportPipelinesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates an export pipeline for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// exportPipelineName - the name of the export pipeline. +// exportPipelineCreateParameters - the parameters for creating an export pipeline. +func (client ExportPipelinesClient) Create(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline) (result ExportPipelinesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: exportPipelineName, + Constraints: []validation.Constraint{{Target: "exportPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "exportPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "exportPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: exportPipelineCreateParameters, + Constraints: []validation.Constraint{{Target: "exportPipelineCreateParameters.ExportPipelineProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "exportPipelineCreateParameters.ExportPipelineProperties.Target", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "exportPipelineCreateParameters.ExportPipelineProperties.Target.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("containerregistry.ExportPipelinesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, exportPipelineName, exportPipelineCreateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExportPipelinesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string, exportPipelineCreateParameters ExportPipeline) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "exportPipelineName": autorest.Encode("path", exportPipelineName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}", pathParameters), + autorest.WithJSON(exportPipelineCreateParameters), + 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 ExportPipelinesClient) CreateSender(req *http.Request) (future ExportPipelinesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExportPipelinesClient) CreateResponder(resp *http.Response) (result ExportPipeline, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an export pipeline from a container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// exportPipelineName - the name of the export pipeline. +func (client ExportPipelinesClient) Delete(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result ExportPipelinesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: exportPipelineName, + Constraints: []validation.Constraint{{Target: "exportPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "exportPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "exportPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ExportPipelinesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, exportPipelineName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExportPipelinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "exportPipelineName": autorest.Encode("path", exportPipelineName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}", 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 ExportPipelinesClient) DeleteSender(req *http.Request) (future ExportPipelinesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExportPipelinesClient) 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 properties of the export pipeline. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// exportPipelineName - the name of the export pipeline. +func (client ExportPipelinesClient) Get(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (result ExportPipeline, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: exportPipelineName, + Constraints: []validation.Constraint{{Target: "exportPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "exportPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "exportPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ExportPipelinesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, exportPipelineName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExportPipelinesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, exportPipelineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "exportPipelineName": autorest.Encode("path", exportPipelineName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/exportPipelines/{exportPipelineName}", 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 ExportPipelinesClient) 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 ExportPipelinesClient) GetResponder(resp *http.Response) (result ExportPipeline, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all export pipelines for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client ExportPipelinesClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ExportPipelineListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.List") + defer func() { + sc := -1 + if result.eplr.Response.Response != nil { + sc = result.eplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ExportPipelinesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.eplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "List", resp, "Failure sending request") + return + } + + result.eplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "List", resp, "Failure responding to request") + return + } + if result.eplr.hasNextLink() && result.eplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExportPipelinesClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/exportPipelines", 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 ExportPipelinesClient) 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 ExportPipelinesClient) ListResponder(resp *http.Response) (result ExportPipelineListResult, 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 ExportPipelinesClient) listNextResults(ctx context.Context, lastResults ExportPipelineListResult) (result ExportPipelineListResult, err error) { + req, err := lastResults.exportPipelineListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "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, "containerregistry.ExportPipelinesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExportPipelinesClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ExportPipelineListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelinesClient.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, registryName) + return +} diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/importpipelines.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/importpipelines.go new file mode 100644 index 000000000000..0ddc4126b720 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/importpipelines.go @@ -0,0 +1,449 @@ +package containerregistry + +// 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" +) + +// ImportPipelinesClient is the client for the ImportPipelines methods of the Containerregistry service. +type ImportPipelinesClient struct { + BaseClient +} + +// NewImportPipelinesClient creates an instance of the ImportPipelinesClient client. +func NewImportPipelinesClient(subscriptionID string) ImportPipelinesClient { + return NewImportPipelinesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewImportPipelinesClientWithBaseURI creates an instance of the ImportPipelinesClient 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 NewImportPipelinesClientWithBaseURI(baseURI string, subscriptionID string) ImportPipelinesClient { + return ImportPipelinesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates an import pipeline for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// importPipelineName - the name of the import pipeline. +// importPipelineCreateParameters - the parameters for creating an import pipeline. +func (client ImportPipelinesClient) Create(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline) (result ImportPipelinesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: importPipelineName, + Constraints: []validation.Constraint{{Target: "importPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "importPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "importPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: importPipelineCreateParameters, + Constraints: []validation.Constraint{{Target: "importPipelineCreateParameters.ImportPipelineProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "importPipelineCreateParameters.ImportPipelineProperties.Source", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "importPipelineCreateParameters.ImportPipelineProperties.Source.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("containerregistry.ImportPipelinesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, importPipelineName, importPipelineCreateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ImportPipelinesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string, importPipelineCreateParameters ImportPipeline) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "importPipelineName": autorest.Encode("path", importPipelineName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}", pathParameters), + autorest.WithJSON(importPipelineCreateParameters), + 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 ImportPipelinesClient) CreateSender(req *http.Request) (future ImportPipelinesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ImportPipelinesClient) CreateResponder(resp *http.Response) (result ImportPipeline, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes an import pipeline from a container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// importPipelineName - the name of the import pipeline. +func (client ImportPipelinesClient) Delete(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result ImportPipelinesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: importPipelineName, + Constraints: []validation.Constraint{{Target: "importPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "importPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "importPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ImportPipelinesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, importPipelineName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ImportPipelinesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "importPipelineName": autorest.Encode("path", importPipelineName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}", 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 ImportPipelinesClient) DeleteSender(req *http.Request) (future ImportPipelinesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ImportPipelinesClient) 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 properties of the import pipeline. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// importPipelineName - the name of the import pipeline. +func (client ImportPipelinesClient) Get(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (result ImportPipeline, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: importPipelineName, + Constraints: []validation.Constraint{{Target: "importPipelineName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "importPipelineName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "importPipelineName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ImportPipelinesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, importPipelineName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ImportPipelinesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, importPipelineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "importPipelineName": autorest.Encode("path", importPipelineName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/importPipelines/{importPipelineName}", 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 ImportPipelinesClient) 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 ImportPipelinesClient) GetResponder(resp *http.Response) (result ImportPipeline, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all import pipelines for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client ImportPipelinesClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ImportPipelineListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.List") + defer func() { + sc := -1 + if result.iplr.Response.Response != nil { + sc = result.iplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ImportPipelinesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.iplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "List", resp, "Failure sending request") + return + } + + result.iplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "List", resp, "Failure responding to request") + return + } + if result.iplr.hasNextLink() && result.iplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ImportPipelinesClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/importPipelines", 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 ImportPipelinesClient) 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 ImportPipelinesClient) ListResponder(resp *http.Response) (result ImportPipelineListResult, 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 ImportPipelinesClient) listNextResults(ctx context.Context, lastResults ImportPipelineListResult) (result ImportPipelineListResult, err error) { + req, err := lastResults.importPipelineListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "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, "containerregistry.ImportPipelinesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ImportPipelinesClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ImportPipelineListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelinesClient.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, registryName) + return +} diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/models.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/models.go new file mode 100644 index 000000000000..37f38718b481 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/models.go @@ -0,0 +1,10075 @@ +package containerregistry + +// 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/containerregistry/mgmt/2021-06-01-preview/containerregistry" + +// ActivationProperties the activation properties of the connected registry. +type ActivationProperties struct { + // Status - READ-ONLY; The activation status of the connected registry. Possible values include: 'ActivationStatusActive', 'ActivationStatusInactive' + Status ActivationStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for ActivationProperties. +func (ap ActivationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ActiveDirectoryObject the Active Directory Object that will be used for authenticating the token of a +// container registry. +type ActiveDirectoryObject struct { + // ObjectID - The user/group/application object ID for Active Directory Object that will be used for authenticating the token of a container registry. + ObjectID *string `json:"objectId,omitempty"` + // TenantID - The tenant ID of user/group/application object Active Directory Object that will be used for authenticating the token of a container registry. + TenantID *string `json:"tenantId,omitempty"` +} + +// Actor the agent that initiated the event. For most situations, this could be from the authorization +// context of the request. +type Actor struct { + // Name - The subject or username associated with the request context that generated the event. + Name *string `json:"name,omitempty"` +} + +// AgentPool the agentpool that has the ARM resource and properties. +// The agentpool will have all information to create an agent pool. +type AgentPool struct { + autorest.Response `json:"-"` + // AgentPoolProperties - The properties associated with the agent pool + *AgentPoolProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. This cannot be changed after the resource is created. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPool. +func (ap AgentPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.AgentPoolProperties != nil { + objectMap["properties"] = ap.AgentPoolProperties + } + if ap.Location != nil { + objectMap["location"] = ap.Location + } + if ap.Tags != nil { + objectMap["tags"] = ap.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPool struct. +func (ap *AgentPool) 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 agentPoolProperties AgentPoolProperties + err = json.Unmarshal(*v, &agentPoolProperties) + if err != nil { + return err + } + ap.AgentPoolProperties = &agentPoolProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ap.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ap.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ap.Tags = tags + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ap.SystemData = &systemData + } + } + } + + return nil +} + +// AgentPoolListResult the collection of agent pools. +type AgentPoolListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]AgentPool `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next set of paged results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AgentPoolListResultIterator provides access to a complete listing of AgentPool values. +type AgentPoolListResultIterator struct { + i int + page AgentPoolListResultPage +} + +// 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 *AgentPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultIterator.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 *AgentPoolListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AgentPoolListResultIterator) 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 AgentPoolListResultIterator) Response() AgentPoolListResult { + 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 AgentPoolListResultIterator) Value() AgentPool { + if !iter.page.NotDone() { + return AgentPool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AgentPoolListResultIterator type. +func NewAgentPoolListResultIterator(page AgentPoolListResultPage) AgentPoolListResultIterator { + return AgentPoolListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aplr AgentPoolListResult) IsEmpty() bool { + return aplr.Value == nil || len(*aplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aplr AgentPoolListResult) hasNextLink() bool { + return aplr.NextLink != nil && len(*aplr.NextLink) != 0 +} + +// agentPoolListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aplr AgentPoolListResult) agentPoolListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aplr.NextLink))) +} + +// AgentPoolListResultPage contains a page of AgentPool values. +type AgentPoolListResultPage struct { + fn func(context.Context, AgentPoolListResult) (AgentPoolListResult, error) + aplr AgentPoolListResult +} + +// 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 *AgentPoolListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultPage.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.aplr) + if err != nil { + return err + } + page.aplr = 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 *AgentPoolListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AgentPoolListResultPage) NotDone() bool { + return !page.aplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AgentPoolListResultPage) Response() AgentPoolListResult { + return page.aplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AgentPoolListResultPage) Values() []AgentPool { + if page.aplr.IsEmpty() { + return nil + } + return *page.aplr.Value +} + +// Creates a new instance of the AgentPoolListResultPage type. +func NewAgentPoolListResultPage(cur AgentPoolListResult, getNextPage func(context.Context, AgentPoolListResult) (AgentPoolListResult, error)) AgentPoolListResultPage { + return AgentPoolListResultPage{ + fn: getNextPage, + aplr: cur, + } +} + +// AgentPoolProperties the properties of agent pool. +type AgentPoolProperties struct { + // Count - The count of agent machine + Count *int32 `json:"count,omitempty"` + // Tier - The Tier of agent machine + Tier *string `json:"tier,omitempty"` + // Os - The OS of agent machine. Possible values include: 'OSWindows', 'OSLinux' + Os OS `json:"os,omitempty"` + // VirtualNetworkSubnetResourceID - The Virtual Network Subnet Resource Id of the agent machine + VirtualNetworkSubnetResourceID *string `json:"virtualNetworkSubnetResourceId,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of this agent pool. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolProperties. +func (app AgentPoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if app.Count != nil { + objectMap["count"] = app.Count + } + if app.Tier != nil { + objectMap["tier"] = app.Tier + } + if app.Os != "" { + objectMap["os"] = app.Os + } + if app.VirtualNetworkSubnetResourceID != nil { + objectMap["virtualNetworkSubnetResourceId"] = app.VirtualNetworkSubnetResourceID + } + return json.Marshal(objectMap) +} + +// AgentPoolPropertiesUpdateParameters ... +type AgentPoolPropertiesUpdateParameters struct { + // Count - The count of agent machine + Count *int32 `json:"count,omitempty"` +} + +// AgentPoolQueueStatus the QueueStatus of Agent Pool +type AgentPoolQueueStatus struct { + autorest.Response `json:"-"` + // Count - The number of pending runs in the queue + Count *int32 `json:"count,omitempty"` +} + +// AgentPoolsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AgentPoolsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (AgentPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsCreateFuture) 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 AgentPoolsCreateFuture.Result. +func (future *AgentPoolsCreateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { + ap, err = client.CreateResponder(ap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsCreateFuture", "Result", ap.Response.Response, "Failure responding to request") + } + } + return +} + +// AgentPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AgentPoolsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsDeleteFuture) 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 AgentPoolsDeleteFuture.Result. +func (future *AgentPoolsDeleteFuture) result(client AgentPoolsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AgentPoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AgentPoolsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (AgentPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsUpdateFuture) 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 AgentPoolsUpdateFuture.Result. +func (future *AgentPoolsUpdateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.AgentPoolsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { + ap, err = client.UpdateResponder(ap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.AgentPoolsUpdateFuture", "Result", ap.Response.Response, "Failure responding to request") + } + } + return +} + +// AgentPoolUpdateParameters the parameters for updating an agent pool. +type AgentPoolUpdateParameters struct { + // AgentPoolPropertiesUpdateParameters - The properties associated with the agent pool + *AgentPoolPropertiesUpdateParameters `json:"properties,omitempty"` + // Tags - The ARM resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AgentPoolUpdateParameters. +func (apup AgentPoolUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apup.AgentPoolPropertiesUpdateParameters != nil { + objectMap["properties"] = apup.AgentPoolPropertiesUpdateParameters + } + if apup.Tags != nil { + objectMap["tags"] = apup.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPoolUpdateParameters struct. +func (apup *AgentPoolUpdateParameters) 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 agentPoolPropertiesUpdateParameters AgentPoolPropertiesUpdateParameters + err = json.Unmarshal(*v, &agentPoolPropertiesUpdateParameters) + if err != nil { + return err + } + apup.AgentPoolPropertiesUpdateParameters = &agentPoolPropertiesUpdateParameters + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + apup.Tags = tags + } + } + } + + return nil +} + +// AgentProperties the properties that determine the run agent configuration. +type AgentProperties struct { + // CPU - The CPU configuration in terms of number of cores required for the run. + CPU *int32 `json:"cpu,omitempty"` +} + +// Argument the properties of a run argument. +type Argument struct { + // Name - The name of the argument. + Name *string `json:"name,omitempty"` + // Value - The value of the argument. + Value *string `json:"value,omitempty"` + // IsSecret - Flag to indicate whether the argument represents a secret and want to be removed from build logs. + IsSecret *bool `json:"isSecret,omitempty"` +} + +// AuthInfo the authorization properties for accessing the source code repository. +type AuthInfo struct { + // TokenType - The type of Auth token. Possible values include: 'TokenTypePAT', 'TokenTypeOAuth' + TokenType TokenType `json:"tokenType,omitempty"` + // Token - The access token used to access the source control provider. + Token *string `json:"token,omitempty"` + // RefreshToken - The refresh token used to refresh the access token. + RefreshToken *string `json:"refreshToken,omitempty"` + // Scope - The scope of the access token. + Scope *string `json:"scope,omitempty"` + // ExpiresIn - Time in seconds that the token remains valid + ExpiresIn *int32 `json:"expiresIn,omitempty"` +} + +// AuthInfoUpdateParameters the authorization properties for accessing the source code repository. +type AuthInfoUpdateParameters struct { + // TokenType - The type of Auth token. Possible values include: 'TokenTypePAT', 'TokenTypeOAuth' + TokenType TokenType `json:"tokenType,omitempty"` + // Token - The access token used to access the source control provider. + Token *string `json:"token,omitempty"` + // RefreshToken - The refresh token used to refresh the access token. + RefreshToken *string `json:"refreshToken,omitempty"` + // Scope - The scope of the access token. + Scope *string `json:"scope,omitempty"` + // ExpiresIn - Time in seconds that the token remains valid + ExpiresIn *int32 `json:"expiresIn,omitempty"` +} + +// BaseImageDependency properties that describe a base image dependency. +type BaseImageDependency struct { + // Type - The type of the base image dependency. Possible values include: 'BaseImageDependencyTypeBuildTime', 'BaseImageDependencyTypeRunTime' + Type BaseImageDependencyType `json:"type,omitempty"` + // Registry - The registry login server. + Registry *string `json:"registry,omitempty"` + // Repository - The repository name. + Repository *string `json:"repository,omitempty"` + // Tag - The tag name. + Tag *string `json:"tag,omitempty"` + // Digest - The sha256-based digest of the image manifest. + Digest *string `json:"digest,omitempty"` +} + +// BaseImageTrigger the trigger based on base image dependency. +type BaseImageTrigger struct { + // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'BaseImageTriggerTypeAll', 'BaseImageTriggerTypeRuntime' + BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` + // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. + UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` + // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' + UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` + // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' + Status TriggerStatus `json:"status,omitempty"` + // Name - The name of the trigger. + Name *string `json:"name,omitempty"` +} + +// BaseImageTriggerUpdateParameters the properties for updating base image dependency trigger. +type BaseImageTriggerUpdateParameters struct { + // BaseImageTriggerType - The type of the auto trigger for base image dependency updates. Possible values include: 'BaseImageTriggerTypeAll', 'BaseImageTriggerTypeRuntime' + BaseImageTriggerType BaseImageTriggerType `json:"baseImageTriggerType,omitempty"` + // UpdateTriggerEndpoint - The endpoint URL for receiving update triggers. + UpdateTriggerEndpoint *string `json:"updateTriggerEndpoint,omitempty"` + // UpdateTriggerPayloadType - Type of Payload body for Base image update triggers. Possible values include: 'UpdateTriggerPayloadTypeDefault', 'UpdateTriggerPayloadTypeToken' + UpdateTriggerPayloadType UpdateTriggerPayloadType `json:"updateTriggerPayloadType,omitempty"` + // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' + Status TriggerStatus `json:"status,omitempty"` + // Name - The name of the trigger. + Name *string `json:"name,omitempty"` +} + +// CallbackConfig the configuration of service URI and custom headers for the webhook. +type CallbackConfig struct { + autorest.Response `json:"-"` + // ServiceURI - The service URI for the webhook to post notifications. + ServiceURI *string `json:"serviceUri,omitempty"` + // CustomHeaders - Custom headers that will be added to the webhook notifications. + CustomHeaders map[string]*string `json:"customHeaders"` +} + +// MarshalJSON is the custom marshaler for CallbackConfig. +func (cc CallbackConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cc.ServiceURI != nil { + objectMap["serviceUri"] = cc.ServiceURI + } + if cc.CustomHeaders != nil { + objectMap["customHeaders"] = cc.CustomHeaders + } + return json.Marshal(objectMap) +} + +// ConnectedRegistriesCreateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConnectedRegistriesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectedRegistriesClient) (ConnectedRegistry, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectedRegistriesCreateFuture) 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 ConnectedRegistriesCreateFuture.Result. +func (future *ConnectedRegistriesCreateFuture) result(client ConnectedRegistriesClient) (cr ConnectedRegistry, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ConnectedRegistriesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { + cr, err = client.CreateResponder(cr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesCreateFuture", "Result", cr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConnectedRegistriesDeactivateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConnectedRegistriesDeactivateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectedRegistriesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectedRegistriesDeactivateFuture) 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 ConnectedRegistriesDeactivateFuture.Result. +func (future *ConnectedRegistriesDeactivateFuture) result(client ConnectedRegistriesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesDeactivateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ConnectedRegistriesDeactivateFuture") + return + } + ar.Response = future.Response() + return +} + +// ConnectedRegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConnectedRegistriesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectedRegistriesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectedRegistriesDeleteFuture) 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 ConnectedRegistriesDeleteFuture.Result. +func (future *ConnectedRegistriesDeleteFuture) result(client ConnectedRegistriesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ConnectedRegistriesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ConnectedRegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConnectedRegistriesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectedRegistriesClient) (ConnectedRegistry, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectedRegistriesUpdateFuture) 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 ConnectedRegistriesUpdateFuture.Result. +func (future *ConnectedRegistriesUpdateFuture) result(client ConnectedRegistriesClient) (cr ConnectedRegistry, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ConnectedRegistriesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { + cr, err = client.UpdateResponder(cr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ConnectedRegistriesUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConnectedRegistry an object that represents a connected registry for a container registry. +type ConnectedRegistry struct { + autorest.Response `json:"-"` + // ConnectedRegistryProperties - The properties of the connected registry. + *ConnectedRegistryProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectedRegistry. +func (cr ConnectedRegistry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cr.ConnectedRegistryProperties != nil { + objectMap["properties"] = cr.ConnectedRegistryProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ConnectedRegistry struct. +func (cr *ConnectedRegistry) 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 connectedRegistryProperties ConnectedRegistryProperties + err = json.Unmarshal(*v, &connectedRegistryProperties) + if err != nil { + return err + } + cr.ConnectedRegistryProperties = &connectedRegistryProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cr.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cr.SystemData = &systemData + } + } + } + + return nil +} + +// ConnectedRegistryListResult the result of a request to list connected registries for a container +// registry. +type ConnectedRegistryListResult struct { + autorest.Response `json:"-"` + // Value - The list of connected registries. Since this list may be incomplete, the nextLink field should be used to request the next list of connected registries. + Value *[]ConnectedRegistry `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of connected registries. + NextLink *string `json:"nextLink,omitempty"` +} + +// ConnectedRegistryListResultIterator provides access to a complete listing of ConnectedRegistry values. +type ConnectedRegistryListResultIterator struct { + i int + page ConnectedRegistryListResultPage +} + +// 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 *ConnectedRegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistryListResultIterator.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 *ConnectedRegistryListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ConnectedRegistryListResultIterator) 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 ConnectedRegistryListResultIterator) Response() ConnectedRegistryListResult { + 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 ConnectedRegistryListResultIterator) Value() ConnectedRegistry { + if !iter.page.NotDone() { + return ConnectedRegistry{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ConnectedRegistryListResultIterator type. +func NewConnectedRegistryListResultIterator(page ConnectedRegistryListResultPage) ConnectedRegistryListResultIterator { + return ConnectedRegistryListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (crlr ConnectedRegistryListResult) IsEmpty() bool { + return crlr.Value == nil || len(*crlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (crlr ConnectedRegistryListResult) hasNextLink() bool { + return crlr.NextLink != nil && len(*crlr.NextLink) != 0 +} + +// connectedRegistryListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (crlr ConnectedRegistryListResult) connectedRegistryListResultPreparer(ctx context.Context) (*http.Request, error) { + if !crlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(crlr.NextLink))) +} + +// ConnectedRegistryListResultPage contains a page of ConnectedRegistry values. +type ConnectedRegistryListResultPage struct { + fn func(context.Context, ConnectedRegistryListResult) (ConnectedRegistryListResult, error) + crlr ConnectedRegistryListResult +} + +// 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 *ConnectedRegistryListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectedRegistryListResultPage.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.crlr) + if err != nil { + return err + } + page.crlr = 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 *ConnectedRegistryListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ConnectedRegistryListResultPage) NotDone() bool { + return !page.crlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ConnectedRegistryListResultPage) Response() ConnectedRegistryListResult { + return page.crlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ConnectedRegistryListResultPage) Values() []ConnectedRegistry { + if page.crlr.IsEmpty() { + return nil + } + return *page.crlr.Value +} + +// Creates a new instance of the ConnectedRegistryListResultPage type. +func NewConnectedRegistryListResultPage(cur ConnectedRegistryListResult, getNextPage func(context.Context, ConnectedRegistryListResult) (ConnectedRegistryListResult, error)) ConnectedRegistryListResultPage { + return ConnectedRegistryListResultPage{ + fn: getNextPage, + crlr: cur, + } +} + +// ConnectedRegistryProperties the properties of a connected registry. +type ConnectedRegistryProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Mode - The mode of the connected registry resource that indicates the permissions of the registry. Possible values include: 'ConnectedRegistryModeRegistry', 'ConnectedRegistryModeMirror' + Mode ConnectedRegistryMode `json:"mode,omitempty"` + // Version - READ-ONLY; The current version of ACR runtime on the connected registry. + Version *string `json:"version,omitempty"` + // ConnectionState - READ-ONLY; The current connection state of the connected registry. Possible values include: 'ConnectionStateOnline', 'ConnectionStateOffline', 'ConnectionStateSyncing', 'ConnectionStateUnhealthy' + ConnectionState ConnectionState `json:"connectionState,omitempty"` + // LastActivityTime - READ-ONLY; The last activity time of the connected registry. + LastActivityTime *date.Time `json:"lastActivityTime,omitempty"` + // Activation - READ-ONLY; The activation properties of the connected registry. + Activation *ActivationProperties `json:"activation,omitempty"` + // Parent - The parent of the connected registry. + Parent *ParentProperties `json:"parent,omitempty"` + // ClientTokenIds - The list of the ACR token resource IDs used to authenticate clients to the connected registry. + ClientTokenIds *[]string `json:"clientTokenIds,omitempty"` + // LoginServer - The login server properties of the connected registry. + LoginServer *LoginServerProperties `json:"loginServer,omitempty"` + // Logging - The logging properties of the connected registry. + Logging *LoggingProperties `json:"logging,omitempty"` + // StatusDetails - READ-ONLY; The list of current statuses of the connected registry. + StatusDetails *[]StatusDetailProperties `json:"statusDetails,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectedRegistryProperties. +func (crp ConnectedRegistryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if crp.Mode != "" { + objectMap["mode"] = crp.Mode + } + if crp.Parent != nil { + objectMap["parent"] = crp.Parent + } + if crp.ClientTokenIds != nil { + objectMap["clientTokenIds"] = crp.ClientTokenIds + } + if crp.LoginServer != nil { + objectMap["loginServer"] = crp.LoginServer + } + if crp.Logging != nil { + objectMap["logging"] = crp.Logging + } + return json.Marshal(objectMap) +} + +// ConnectedRegistryUpdateParameters the parameters for updating a connected registry. +type ConnectedRegistryUpdateParameters struct { + // ConnectedRegistryUpdateProperties - The properties of the connected registry update parameters. + *ConnectedRegistryUpdateProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectedRegistryUpdateParameters. +func (crup ConnectedRegistryUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if crup.ConnectedRegistryUpdateProperties != nil { + objectMap["properties"] = crup.ConnectedRegistryUpdateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ConnectedRegistryUpdateParameters struct. +func (crup *ConnectedRegistryUpdateParameters) 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 connectedRegistryUpdateProperties ConnectedRegistryUpdateProperties + err = json.Unmarshal(*v, &connectedRegistryUpdateProperties) + if err != nil { + return err + } + crup.ConnectedRegistryUpdateProperties = &connectedRegistryUpdateProperties + } + } + } + + return nil +} + +// ConnectedRegistryUpdateProperties the parameters for updating token properties. +type ConnectedRegistryUpdateProperties struct { + // SyncProperties - The sync properties of the connected registry with its parent. + SyncProperties *SyncUpdateProperties `json:"syncProperties,omitempty"` + // Logging - The logging properties of the connected registry. + Logging *LoggingProperties `json:"logging,omitempty"` + // ClientTokenIds - The list of the ACR token resource IDs used to authenticate clients to the connected registry. + ClientTokenIds *[]string `json:"clientTokenIds,omitempty"` +} + +// Credentials the parameters that describes a set of credentials that will be used when a run is invoked. +type Credentials struct { + // SourceRegistry - Describes the credential parameters for accessing the source registry. + SourceRegistry *SourceRegistryCredentials `json:"sourceRegistry,omitempty"` + // CustomRegistries - Describes the credential parameters for accessing other custom registries. The key + // for the dictionary item will be the registry login server (myregistry.azurecr.io) and + // the value of the item will be the registry credentials for accessing the registry. + CustomRegistries map[string]*CustomRegistryCredentials `json:"customRegistries"` +} + +// MarshalJSON is the custom marshaler for Credentials. +func (c Credentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.SourceRegistry != nil { + objectMap["sourceRegistry"] = c.SourceRegistry + } + if c.CustomRegistries != nil { + objectMap["customRegistries"] = c.CustomRegistries + } + return json.Marshal(objectMap) +} + +// CustomRegistryCredentials describes the credentials that will be used to access a custom registry during +// a run. +type CustomRegistryCredentials struct { + // UserName - The username for logging into the custom registry. + UserName *SecretObject `json:"userName,omitempty"` + // Password - The password for logging into the custom registry. The password is a secret + // object that allows multiple ways of providing the value for it. + Password *SecretObject `json:"password,omitempty"` + // Identity - Indicates the managed identity assigned to the custom credential. If a user-assigned identity + // this value is the Client ID. If a system-assigned identity, the value will be `system`. In + // the case of a system-assigned identity, the Client ID will be determined by the runner. This + // identity may be used to authenticate to key vault to retrieve credentials or it may be the only + // source of authentication used for accessing the registry. + Identity *string `json:"identity,omitempty"` +} + +// DockerBuildRequest the parameters for a docker quick build. +type DockerBuildRequest struct { + // ImageNames - The fully qualified image names including the repository and tag. + ImageNames *[]string `json:"imageNames,omitempty"` + // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. + IsPushEnabled *bool `json:"isPushEnabled,omitempty"` + // NoCache - The value of this property indicates whether the image cache is enabled or not. + NoCache *bool `json:"noCache,omitempty"` + // DockerFilePath - The Docker file path relative to the source location. + DockerFilePath *string `json:"dockerFilePath,omitempty"` + // Target - The name of the target build stage for the docker build. + Target *string `json:"target,omitempty"` + // Arguments - The collection of override arguments to be used when executing the run. + Arguments *[]Argument `json:"arguments,omitempty"` + // Timeout - Run timeout in seconds. + Timeout *int32 `json:"timeout,omitempty"` + // Platform - The platform properties against which the run has to happen. + Platform *PlatformProperties `json:"platform,omitempty"` + // AgentConfiguration - The machine configuration of the run agent. + AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` + // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. + // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. + SourceLocation *string `json:"sourceLocation,omitempty"` + // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. + Credentials *Credentials `json:"credentials,omitempty"` + // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. + IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` + // AgentPoolName - The dedicated agent pool for the run. + AgentPoolName *string `json:"agentPoolName,omitempty"` + // LogTemplate - The template that describes the repository and tag information for run log artifact. + LogTemplate *string `json:"logTemplate,omitempty"` + // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DockerBuildRequest. +func (dbr DockerBuildRequest) MarshalJSON() ([]byte, error) { + dbr.Type = TypeDockerBuildRequest + objectMap := make(map[string]interface{}) + if dbr.ImageNames != nil { + objectMap["imageNames"] = dbr.ImageNames + } + if dbr.IsPushEnabled != nil { + objectMap["isPushEnabled"] = dbr.IsPushEnabled + } + if dbr.NoCache != nil { + objectMap["noCache"] = dbr.NoCache + } + if dbr.DockerFilePath != nil { + objectMap["dockerFilePath"] = dbr.DockerFilePath + } + if dbr.Target != nil { + objectMap["target"] = dbr.Target + } + if dbr.Arguments != nil { + objectMap["arguments"] = dbr.Arguments + } + if dbr.Timeout != nil { + objectMap["timeout"] = dbr.Timeout + } + if dbr.Platform != nil { + objectMap["platform"] = dbr.Platform + } + if dbr.AgentConfiguration != nil { + objectMap["agentConfiguration"] = dbr.AgentConfiguration + } + if dbr.SourceLocation != nil { + objectMap["sourceLocation"] = dbr.SourceLocation + } + if dbr.Credentials != nil { + objectMap["credentials"] = dbr.Credentials + } + if dbr.IsArchiveEnabled != nil { + objectMap["isArchiveEnabled"] = dbr.IsArchiveEnabled + } + if dbr.AgentPoolName != nil { + objectMap["agentPoolName"] = dbr.AgentPoolName + } + if dbr.LogTemplate != nil { + objectMap["logTemplate"] = dbr.LogTemplate + } + if dbr.Type != "" { + objectMap["type"] = dbr.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildRequest is the BasicRunRequest implementation for DockerBuildRequest. +func (dbr DockerBuildRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { + return &dbr, true +} + +// AsFileTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. +func (dbr DockerBuildRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { + return nil, false +} + +// AsTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. +func (dbr DockerBuildRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { + return nil, false +} + +// AsEncodedTaskRunRequest is the BasicRunRequest implementation for DockerBuildRequest. +func (dbr DockerBuildRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { + return nil, false +} + +// AsRunRequest is the BasicRunRequest implementation for DockerBuildRequest. +func (dbr DockerBuildRequest) AsRunRequest() (*RunRequest, bool) { + return nil, false +} + +// AsBasicRunRequest is the BasicRunRequest implementation for DockerBuildRequest. +func (dbr DockerBuildRequest) AsBasicRunRequest() (BasicRunRequest, bool) { + return &dbr, true +} + +// DockerBuildStep the Docker build step. +type DockerBuildStep struct { + // ImageNames - The fully qualified image names including the repository and tag. + ImageNames *[]string `json:"imageNames,omitempty"` + // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. + IsPushEnabled *bool `json:"isPushEnabled,omitempty"` + // NoCache - The value of this property indicates whether the image cache is enabled or not. + NoCache *bool `json:"noCache,omitempty"` + // DockerFilePath - The Docker file path relative to the source context. + DockerFilePath *string `json:"dockerFilePath,omitempty"` + // Target - The name of the target build stage for the docker build. + Target *string `json:"target,omitempty"` + // Arguments - The collection of override arguments to be used when executing this build step. + Arguments *[]Argument `json:"arguments,omitempty"` + // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. + BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` + // ContextPath - The URL(absolute or relative) of the source context for the task step. + ContextPath *string `json:"contextPath,omitempty"` + // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string `json:"contextAccessToken,omitempty"` + // Type - Possible values include: 'TypeBasicTaskStepPropertiesTypeTaskStepProperties', 'TypeBasicTaskStepPropertiesTypeDocker', 'TypeBasicTaskStepPropertiesTypeFileTask', 'TypeBasicTaskStepPropertiesTypeEncodedTask' + Type TypeBasicTaskStepProperties `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DockerBuildStep. +func (dbs DockerBuildStep) MarshalJSON() ([]byte, error) { + dbs.Type = TypeBasicTaskStepPropertiesTypeDocker + objectMap := make(map[string]interface{}) + if dbs.ImageNames != nil { + objectMap["imageNames"] = dbs.ImageNames + } + if dbs.IsPushEnabled != nil { + objectMap["isPushEnabled"] = dbs.IsPushEnabled + } + if dbs.NoCache != nil { + objectMap["noCache"] = dbs.NoCache + } + if dbs.DockerFilePath != nil { + objectMap["dockerFilePath"] = dbs.DockerFilePath + } + if dbs.Target != nil { + objectMap["target"] = dbs.Target + } + if dbs.Arguments != nil { + objectMap["arguments"] = dbs.Arguments + } + if dbs.ContextPath != nil { + objectMap["contextPath"] = dbs.ContextPath + } + if dbs.ContextAccessToken != nil { + objectMap["contextAccessToken"] = dbs.ContextAccessToken + } + if dbs.Type != "" { + objectMap["type"] = dbs.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildStep is the BasicTaskStepProperties implementation for DockerBuildStep. +func (dbs DockerBuildStep) AsDockerBuildStep() (*DockerBuildStep, bool) { + return &dbs, true +} + +// AsFileTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. +func (dbs DockerBuildStep) AsFileTaskStep() (*FileTaskStep, bool) { + return nil, false +} + +// AsEncodedTaskStep is the BasicTaskStepProperties implementation for DockerBuildStep. +func (dbs DockerBuildStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { + return nil, false +} + +// AsTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. +func (dbs DockerBuildStep) AsTaskStepProperties() (*TaskStepProperties, bool) { + return nil, false +} + +// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for DockerBuildStep. +func (dbs DockerBuildStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { + return &dbs, true +} + +// DockerBuildStepUpdateParameters the properties for updating a docker build step. +type DockerBuildStepUpdateParameters struct { + // ImageNames - The fully qualified image names including the repository and tag. + ImageNames *[]string `json:"imageNames,omitempty"` + // IsPushEnabled - The value of this property indicates whether the image built should be pushed to the registry or not. + IsPushEnabled *bool `json:"isPushEnabled,omitempty"` + // NoCache - The value of this property indicates whether the image cache is enabled or not. + NoCache *bool `json:"noCache,omitempty"` + // DockerFilePath - The Docker file path relative to the source context. + DockerFilePath *string `json:"dockerFilePath,omitempty"` + // Arguments - The collection of override arguments to be used when executing this build step. + Arguments *[]Argument `json:"arguments,omitempty"` + // Target - The name of the target build stage for the docker build. + Target *string `json:"target,omitempty"` + // ContextPath - The URL(absolute or relative) of the source context for the task step. + ContextPath *string `json:"contextPath,omitempty"` + // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string `json:"contextAccessToken,omitempty"` + // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' + Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DockerBuildStepUpdateParameters. +func (dbsup DockerBuildStepUpdateParameters) MarshalJSON() ([]byte, error) { + dbsup.Type = TypeBasicTaskStepUpdateParametersTypeDocker + objectMap := make(map[string]interface{}) + if dbsup.ImageNames != nil { + objectMap["imageNames"] = dbsup.ImageNames + } + if dbsup.IsPushEnabled != nil { + objectMap["isPushEnabled"] = dbsup.IsPushEnabled + } + if dbsup.NoCache != nil { + objectMap["noCache"] = dbsup.NoCache + } + if dbsup.DockerFilePath != nil { + objectMap["dockerFilePath"] = dbsup.DockerFilePath + } + if dbsup.Arguments != nil { + objectMap["arguments"] = dbsup.Arguments + } + if dbsup.Target != nil { + objectMap["target"] = dbsup.Target + } + if dbsup.ContextPath != nil { + objectMap["contextPath"] = dbsup.ContextPath + } + if dbsup.ContextAccessToken != nil { + objectMap["contextAccessToken"] = dbsup.ContextAccessToken + } + if dbsup.Type != "" { + objectMap["type"] = dbsup.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. +func (dbsup DockerBuildStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { + return &dbsup, true +} + +// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. +func (dbsup DockerBuildStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { + return nil, false +} + +// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. +func (dbsup DockerBuildStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { + return nil, false +} + +// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. +func (dbsup DockerBuildStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { + return nil, false +} + +// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for DockerBuildStepUpdateParameters. +func (dbsup DockerBuildStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { + return &dbsup, true +} + +// EncodedTaskRunRequest the parameters for a quick task run request. +type EncodedTaskRunRequest struct { + // EncodedTaskContent - Base64 encoded value of the template/definition file content. + EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` + // EncodedValuesContent - Base64 encoded value of the parameters/values file content. + EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` + // Values - The collection of overridable values that can be passed when running a task. + Values *[]SetValue `json:"values,omitempty"` + // Timeout - Run timeout in seconds. + Timeout *int32 `json:"timeout,omitempty"` + // Platform - The platform properties against which the run has to happen. + Platform *PlatformProperties `json:"platform,omitempty"` + // AgentConfiguration - The machine configuration of the run agent. + AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` + // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. + // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. + SourceLocation *string `json:"sourceLocation,omitempty"` + // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. + Credentials *Credentials `json:"credentials,omitempty"` + // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. + IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` + // AgentPoolName - The dedicated agent pool for the run. + AgentPoolName *string `json:"agentPoolName,omitempty"` + // LogTemplate - The template that describes the repository and tag information for run log artifact. + LogTemplate *string `json:"logTemplate,omitempty"` + // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EncodedTaskRunRequest. +func (etrr EncodedTaskRunRequest) MarshalJSON() ([]byte, error) { + etrr.Type = TypeEncodedTaskRunRequest + objectMap := make(map[string]interface{}) + if etrr.EncodedTaskContent != nil { + objectMap["encodedTaskContent"] = etrr.EncodedTaskContent + } + if etrr.EncodedValuesContent != nil { + objectMap["encodedValuesContent"] = etrr.EncodedValuesContent + } + if etrr.Values != nil { + objectMap["values"] = etrr.Values + } + if etrr.Timeout != nil { + objectMap["timeout"] = etrr.Timeout + } + if etrr.Platform != nil { + objectMap["platform"] = etrr.Platform + } + if etrr.AgentConfiguration != nil { + objectMap["agentConfiguration"] = etrr.AgentConfiguration + } + if etrr.SourceLocation != nil { + objectMap["sourceLocation"] = etrr.SourceLocation + } + if etrr.Credentials != nil { + objectMap["credentials"] = etrr.Credentials + } + if etrr.IsArchiveEnabled != nil { + objectMap["isArchiveEnabled"] = etrr.IsArchiveEnabled + } + if etrr.AgentPoolName != nil { + objectMap["agentPoolName"] = etrr.AgentPoolName + } + if etrr.LogTemplate != nil { + objectMap["logTemplate"] = etrr.LogTemplate + } + if etrr.Type != "" { + objectMap["type"] = etrr.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. +func (etrr EncodedTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { + return nil, false +} + +// AsFileTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. +func (etrr EncodedTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { + return nil, false +} + +// AsTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. +func (etrr EncodedTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { + return nil, false +} + +// AsEncodedTaskRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. +func (etrr EncodedTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { + return &etrr, true +} + +// AsRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. +func (etrr EncodedTaskRunRequest) AsRunRequest() (*RunRequest, bool) { + return nil, false +} + +// AsBasicRunRequest is the BasicRunRequest implementation for EncodedTaskRunRequest. +func (etrr EncodedTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { + return &etrr, true +} + +// EncodedTaskStep the properties of a encoded task step. +type EncodedTaskStep struct { + // EncodedTaskContent - Base64 encoded value of the template/definition file content. + EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` + // EncodedValuesContent - Base64 encoded value of the parameters/values file content. + EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` + // Values - The collection of overridable values that can be passed when running a task. + Values *[]SetValue `json:"values,omitempty"` + // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. + BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` + // ContextPath - The URL(absolute or relative) of the source context for the task step. + ContextPath *string `json:"contextPath,omitempty"` + // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string `json:"contextAccessToken,omitempty"` + // Type - Possible values include: 'TypeBasicTaskStepPropertiesTypeTaskStepProperties', 'TypeBasicTaskStepPropertiesTypeDocker', 'TypeBasicTaskStepPropertiesTypeFileTask', 'TypeBasicTaskStepPropertiesTypeEncodedTask' + Type TypeBasicTaskStepProperties `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EncodedTaskStep. +func (ets EncodedTaskStep) MarshalJSON() ([]byte, error) { + ets.Type = TypeBasicTaskStepPropertiesTypeEncodedTask + objectMap := make(map[string]interface{}) + if ets.EncodedTaskContent != nil { + objectMap["encodedTaskContent"] = ets.EncodedTaskContent + } + if ets.EncodedValuesContent != nil { + objectMap["encodedValuesContent"] = ets.EncodedValuesContent + } + if ets.Values != nil { + objectMap["values"] = ets.Values + } + if ets.ContextPath != nil { + objectMap["contextPath"] = ets.ContextPath + } + if ets.ContextAccessToken != nil { + objectMap["contextAccessToken"] = ets.ContextAccessToken + } + if ets.Type != "" { + objectMap["type"] = ets.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildStep is the BasicTaskStepProperties implementation for EncodedTaskStep. +func (ets EncodedTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { + return nil, false +} + +// AsFileTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. +func (ets EncodedTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { + return nil, false +} + +// AsEncodedTaskStep is the BasicTaskStepProperties implementation for EncodedTaskStep. +func (ets EncodedTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { + return &ets, true +} + +// AsTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. +func (ets EncodedTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { + return nil, false +} + +// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for EncodedTaskStep. +func (ets EncodedTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { + return &ets, true +} + +// EncodedTaskStepUpdateParameters the properties for updating encoded task step. +type EncodedTaskStepUpdateParameters struct { + // EncodedTaskContent - Base64 encoded value of the template/definition file content. + EncodedTaskContent *string `json:"encodedTaskContent,omitempty"` + // EncodedValuesContent - Base64 encoded value of the parameters/values file content. + EncodedValuesContent *string `json:"encodedValuesContent,omitempty"` + // Values - The collection of overridable values that can be passed when running a task. + Values *[]SetValue `json:"values,omitempty"` + // ContextPath - The URL(absolute or relative) of the source context for the task step. + ContextPath *string `json:"contextPath,omitempty"` + // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string `json:"contextAccessToken,omitempty"` + // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' + Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EncodedTaskStepUpdateParameters. +func (etsup EncodedTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { + etsup.Type = TypeBasicTaskStepUpdateParametersTypeEncodedTask + objectMap := make(map[string]interface{}) + if etsup.EncodedTaskContent != nil { + objectMap["encodedTaskContent"] = etsup.EncodedTaskContent + } + if etsup.EncodedValuesContent != nil { + objectMap["encodedValuesContent"] = etsup.EncodedValuesContent + } + if etsup.Values != nil { + objectMap["values"] = etsup.Values + } + if etsup.ContextPath != nil { + objectMap["contextPath"] = etsup.ContextPath + } + if etsup.ContextAccessToken != nil { + objectMap["contextAccessToken"] = etsup.ContextAccessToken + } + if etsup.Type != "" { + objectMap["type"] = etsup.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. +func (etsup EncodedTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { + return nil, false +} + +// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. +func (etsup EncodedTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { + return nil, false +} + +// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. +func (etsup EncodedTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { + return &etsup, true +} + +// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. +func (etsup EncodedTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { + return nil, false +} + +// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for EncodedTaskStepUpdateParameters. +func (etsup EncodedTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { + return &etsup, true +} + +// EncryptionProperty ... +type EncryptionProperty struct { + // Status - Indicates whether or not the encryption is enabled for container registry. Possible values include: 'EncryptionStatusEnabled', 'EncryptionStatusDisabled' + Status EncryptionStatus `json:"status,omitempty"` + // KeyVaultProperties - Key vault properties. + KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} + +// ErrorResponse an error response from the Azure Container Registry service. +type ErrorResponse struct { + // Error - Azure container registry build API error body. + Error *ErrorResponseBody `json:"error,omitempty"` +} + +// ErrorResponseBody an error response from the Azure Container Registry service. +type ErrorResponseBody struct { + // Code - error code. + Code *string `json:"code,omitempty"` + // Message - error message. + Message *string `json:"message,omitempty"` + // Target - target of the particular error. + Target *string `json:"target,omitempty"` + // Details - an array of additional nested error response info objects, as described by this contract. + Details *InnerErrorDescription `json:"details,omitempty"` +} + +// Event the event for a webhook. +type Event struct { + // EventRequestMessage - The event request message sent to the service URI. + EventRequestMessage *EventRequestMessage `json:"eventRequestMessage,omitempty"` + // EventResponseMessage - The event response message received from the service URI. + EventResponseMessage *EventResponseMessage `json:"eventResponseMessage,omitempty"` + // ID - The event ID. + ID *string `json:"id,omitempty"` +} + +// EventContent the content of the event request message. +type EventContent struct { + // ID - The event ID. + ID *string `json:"id,omitempty"` + // Timestamp - The time at which the event occurred. + Timestamp *date.Time `json:"timestamp,omitempty"` + // Action - The action that encompasses the provided event. + Action *string `json:"action,omitempty"` + // Target - The target of the event. + Target *Target `json:"target,omitempty"` + // Request - The request that generated the event. + Request *Request `json:"request,omitempty"` + // Actor - The agent that initiated the event. For most situations, this could be from the authorization context of the request. + Actor *Actor `json:"actor,omitempty"` + // Source - The registry node that generated the event. Put differently, while the actor initiates the event, the source generates it. + Source *Source `json:"source,omitempty"` +} + +// EventInfo the basic information of an event. +type EventInfo struct { + autorest.Response `json:"-"` + // ID - The event ID. + ID *string `json:"id,omitempty"` +} + +// EventListResult the result of a request to list events for a webhook. +type EventListResult struct { + autorest.Response `json:"-"` + // Value - The list of events. Since this list may be incomplete, the nextLink field should be used to request the next list of events. + Value *[]Event `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of events. + NextLink *string `json:"nextLink,omitempty"` +} + +// EventListResultIterator provides access to a complete listing of Event values. +type EventListResultIterator struct { + i int + page EventListResultPage +} + +// 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 *EventListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultIterator.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 *EventListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EventListResultIterator) 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 EventListResultIterator) Response() EventListResult { + 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 EventListResultIterator) Value() Event { + if !iter.page.NotDone() { + return Event{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EventListResultIterator type. +func NewEventListResultIterator(page EventListResultPage) EventListResultIterator { + return EventListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (elr EventListResult) IsEmpty() bool { + return elr.Value == nil || len(*elr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (elr EventListResult) hasNextLink() bool { + return elr.NextLink != nil && len(*elr.NextLink) != 0 +} + +// eventListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (elr EventListResult) eventListResultPreparer(ctx context.Context) (*http.Request, error) { + if !elr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(elr.NextLink))) +} + +// EventListResultPage contains a page of Event values. +type EventListResultPage struct { + fn func(context.Context, EventListResult) (EventListResult, error) + elr EventListResult +} + +// 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 *EventListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EventListResultPage.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.elr) + if err != nil { + return err + } + page.elr = 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 *EventListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EventListResultPage) NotDone() bool { + return !page.elr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EventListResultPage) Response() EventListResult { + return page.elr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EventListResultPage) Values() []Event { + if page.elr.IsEmpty() { + return nil + } + return *page.elr.Value +} + +// Creates a new instance of the EventListResultPage type. +func NewEventListResultPage(cur EventListResult, getNextPage func(context.Context, EventListResult) (EventListResult, error)) EventListResultPage { + return EventListResultPage{ + fn: getNextPage, + elr: cur, + } +} + +// EventRequestMessage the event request message sent to the service URI. +type EventRequestMessage struct { + // Content - The content of the event request message. + Content *EventContent `json:"content,omitempty"` + // Headers - The headers of the event request message. + Headers map[string]*string `json:"headers"` + // Method - The HTTP method used to send the event request message. + Method *string `json:"method,omitempty"` + // RequestURI - The URI used to send the event request message. + RequestURI *string `json:"requestUri,omitempty"` + // Version - The HTTP message version. + Version *string `json:"version,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventRequestMessage. +func (erm EventRequestMessage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erm.Content != nil { + objectMap["content"] = erm.Content + } + if erm.Headers != nil { + objectMap["headers"] = erm.Headers + } + if erm.Method != nil { + objectMap["method"] = erm.Method + } + if erm.RequestURI != nil { + objectMap["requestUri"] = erm.RequestURI + } + if erm.Version != nil { + objectMap["version"] = erm.Version + } + return json.Marshal(objectMap) +} + +// EventResponseMessage the event response message received from the service URI. +type EventResponseMessage struct { + // Content - The content of the event response message. + Content *string `json:"content,omitempty"` + // Headers - The headers of the event response message. + Headers map[string]*string `json:"headers"` + // ReasonPhrase - The reason phrase of the event response message. + ReasonPhrase *string `json:"reasonPhrase,omitempty"` + // StatusCode - The status code of the event response message. + StatusCode *string `json:"statusCode,omitempty"` + // Version - The HTTP message version. + Version *string `json:"version,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventResponseMessage. +func (erm EventResponseMessage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erm.Content != nil { + objectMap["content"] = erm.Content + } + if erm.Headers != nil { + objectMap["headers"] = erm.Headers + } + if erm.ReasonPhrase != nil { + objectMap["reasonPhrase"] = erm.ReasonPhrase + } + if erm.StatusCode != nil { + objectMap["statusCode"] = erm.StatusCode + } + if erm.Version != nil { + objectMap["version"] = erm.Version + } + return json.Marshal(objectMap) +} + +// ExportPipeline an object that represents an export pipeline for a container registry. +type ExportPipeline struct { + autorest.Response `json:"-"` + // Location - The location of the export pipeline. + Location *string `json:"location,omitempty"` + // Identity - The identity of the export pipeline. + Identity *IdentityProperties `json:"identity,omitempty"` + // ExportPipelineProperties - The properties of the export pipeline. + *ExportPipelineProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExportPipeline. +func (ep ExportPipeline) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ep.Location != nil { + objectMap["location"] = ep.Location + } + if ep.Identity != nil { + objectMap["identity"] = ep.Identity + } + if ep.ExportPipelineProperties != nil { + objectMap["properties"] = ep.ExportPipelineProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExportPipeline struct. +func (ep *ExportPipeline) 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 "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ep.Location = &location + } + case "identity": + if v != nil { + var identity IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + ep.Identity = &identity + } + case "properties": + if v != nil { + var exportPipelineProperties ExportPipelineProperties + err = json.Unmarshal(*v, &exportPipelineProperties) + if err != nil { + return err + } + ep.ExportPipelineProperties = &exportPipelineProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ep.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ep.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ep.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ep.SystemData = &systemData + } + } + } + + return nil +} + +// ExportPipelineListResult the result of a request to list export pipelines for a container registry. +type ExportPipelineListResult struct { + autorest.Response `json:"-"` + // Value - The list of export pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of export pipelines. + Value *[]ExportPipeline `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of pipeline runs. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExportPipelineListResultIterator provides access to a complete listing of ExportPipeline values. +type ExportPipelineListResultIterator struct { + i int + page ExportPipelineListResultPage +} + +// 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 *ExportPipelineListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelineListResultIterator.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 *ExportPipelineListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExportPipelineListResultIterator) 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 ExportPipelineListResultIterator) Response() ExportPipelineListResult { + 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 ExportPipelineListResultIterator) Value() ExportPipeline { + if !iter.page.NotDone() { + return ExportPipeline{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExportPipelineListResultIterator type. +func NewExportPipelineListResultIterator(page ExportPipelineListResultPage) ExportPipelineListResultIterator { + return ExportPipelineListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (eplr ExportPipelineListResult) IsEmpty() bool { + return eplr.Value == nil || len(*eplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (eplr ExportPipelineListResult) hasNextLink() bool { + return eplr.NextLink != nil && len(*eplr.NextLink) != 0 +} + +// exportPipelineListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (eplr ExportPipelineListResult) exportPipelineListResultPreparer(ctx context.Context) (*http.Request, error) { + if !eplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(eplr.NextLink))) +} + +// ExportPipelineListResultPage contains a page of ExportPipeline values. +type ExportPipelineListResultPage struct { + fn func(context.Context, ExportPipelineListResult) (ExportPipelineListResult, error) + eplr ExportPipelineListResult +} + +// 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 *ExportPipelineListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExportPipelineListResultPage.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.eplr) + if err != nil { + return err + } + page.eplr = 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 *ExportPipelineListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExportPipelineListResultPage) NotDone() bool { + return !page.eplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExportPipelineListResultPage) Response() ExportPipelineListResult { + return page.eplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExportPipelineListResultPage) Values() []ExportPipeline { + if page.eplr.IsEmpty() { + return nil + } + return *page.eplr.Value +} + +// Creates a new instance of the ExportPipelineListResultPage type. +func NewExportPipelineListResultPage(cur ExportPipelineListResult, getNextPage func(context.Context, ExportPipelineListResult) (ExportPipelineListResult, error)) ExportPipelineListResultPage { + return ExportPipelineListResultPage{ + fn: getNextPage, + eplr: cur, + } +} + +// ExportPipelineProperties the properties of an export pipeline. +type ExportPipelineProperties struct { + // Target - The target properties of the export pipeline. + Target *ExportPipelineTargetProperties `json:"target,omitempty"` + // Options - The list of all options configured for the pipeline. + Options *[]PipelineOptions `json:"options,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the pipeline at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExportPipelineProperties. +func (epp ExportPipelineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if epp.Target != nil { + objectMap["target"] = epp.Target + } + if epp.Options != nil { + objectMap["options"] = epp.Options + } + return json.Marshal(objectMap) +} + +// ExportPipelinesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExportPipelinesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExportPipelinesClient) (ExportPipeline, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExportPipelinesCreateFuture) 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 ExportPipelinesCreateFuture.Result. +func (future *ExportPipelinesCreateFuture) result(client ExportPipelinesClient) (ep ExportPipeline, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ep.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ExportPipelinesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ep.Response.Response, err = future.GetResult(sender); err == nil && ep.Response.Response.StatusCode != http.StatusNoContent { + ep, err = client.CreateResponder(ep.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesCreateFuture", "Result", ep.Response.Response, "Failure responding to request") + } + } + return +} + +// ExportPipelinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExportPipelinesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExportPipelinesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExportPipelinesDeleteFuture) 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 ExportPipelinesDeleteFuture.Result. +func (future *ExportPipelinesDeleteFuture) result(client ExportPipelinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ExportPipelinesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ExportPipelinesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExportPipelineTargetProperties the properties of the export pipeline target. +type ExportPipelineTargetProperties struct { + // Type - The type of target for the export pipeline. + Type *string `json:"type,omitempty"` + // URI - The target uri of the export pipeline. + // When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + // When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName" + URI *string `json:"uri,omitempty"` + // KeyVaultURI - They key vault secret uri to obtain the target storage SAS token. + KeyVaultURI *string `json:"keyVaultUri,omitempty"` +} + +// ExportPolicy the export policy for a container registry. +type ExportPolicy struct { + // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'ExportPolicyStatusEnabled', 'ExportPolicyStatusDisabled' + Status ExportPolicyStatus `json:"status,omitempty"` +} + +// FileTaskRunRequest the request parameters for a scheduling run against a task file. +type FileTaskRunRequest struct { + // TaskFilePath - The template/definition file path relative to the source. + TaskFilePath *string `json:"taskFilePath,omitempty"` + // ValuesFilePath - The values/parameters file path relative to the source. + ValuesFilePath *string `json:"valuesFilePath,omitempty"` + // Values - The collection of overridable values that can be passed when running a task. + Values *[]SetValue `json:"values,omitempty"` + // Timeout - Run timeout in seconds. + Timeout *int32 `json:"timeout,omitempty"` + // Platform - The platform properties against which the run has to happen. + Platform *PlatformProperties `json:"platform,omitempty"` + // AgentConfiguration - The machine configuration of the run agent. + AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` + // SourceLocation - The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. + // If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. + SourceLocation *string `json:"sourceLocation,omitempty"` + // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. + Credentials *Credentials `json:"credentials,omitempty"` + // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. + IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` + // AgentPoolName - The dedicated agent pool for the run. + AgentPoolName *string `json:"agentPoolName,omitempty"` + // LogTemplate - The template that describes the repository and tag information for run log artifact. + LogTemplate *string `json:"logTemplate,omitempty"` + // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileTaskRunRequest. +func (ftrr FileTaskRunRequest) MarshalJSON() ([]byte, error) { + ftrr.Type = TypeFileTaskRunRequest + objectMap := make(map[string]interface{}) + if ftrr.TaskFilePath != nil { + objectMap["taskFilePath"] = ftrr.TaskFilePath + } + if ftrr.ValuesFilePath != nil { + objectMap["valuesFilePath"] = ftrr.ValuesFilePath + } + if ftrr.Values != nil { + objectMap["values"] = ftrr.Values + } + if ftrr.Timeout != nil { + objectMap["timeout"] = ftrr.Timeout + } + if ftrr.Platform != nil { + objectMap["platform"] = ftrr.Platform + } + if ftrr.AgentConfiguration != nil { + objectMap["agentConfiguration"] = ftrr.AgentConfiguration + } + if ftrr.SourceLocation != nil { + objectMap["sourceLocation"] = ftrr.SourceLocation + } + if ftrr.Credentials != nil { + objectMap["credentials"] = ftrr.Credentials + } + if ftrr.IsArchiveEnabled != nil { + objectMap["isArchiveEnabled"] = ftrr.IsArchiveEnabled + } + if ftrr.AgentPoolName != nil { + objectMap["agentPoolName"] = ftrr.AgentPoolName + } + if ftrr.LogTemplate != nil { + objectMap["logTemplate"] = ftrr.LogTemplate + } + if ftrr.Type != "" { + objectMap["type"] = ftrr.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildRequest is the BasicRunRequest implementation for FileTaskRunRequest. +func (ftrr FileTaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { + return nil, false +} + +// AsFileTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. +func (ftrr FileTaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { + return &ftrr, true +} + +// AsTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. +func (ftrr FileTaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { + return nil, false +} + +// AsEncodedTaskRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. +func (ftrr FileTaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { + return nil, false +} + +// AsRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. +func (ftrr FileTaskRunRequest) AsRunRequest() (*RunRequest, bool) { + return nil, false +} + +// AsBasicRunRequest is the BasicRunRequest implementation for FileTaskRunRequest. +func (ftrr FileTaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { + return &ftrr, true +} + +// FileTaskStep the properties of a task step. +type FileTaskStep struct { + // TaskFilePath - The task template/definition file path relative to the source context. + TaskFilePath *string `json:"taskFilePath,omitempty"` + // ValuesFilePath - The task values/parameters file path relative to the source context. + ValuesFilePath *string `json:"valuesFilePath,omitempty"` + // Values - The collection of overridable values that can be passed when running a task. + Values *[]SetValue `json:"values,omitempty"` + // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. + BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` + // ContextPath - The URL(absolute or relative) of the source context for the task step. + ContextPath *string `json:"contextPath,omitempty"` + // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string `json:"contextAccessToken,omitempty"` + // Type - Possible values include: 'TypeBasicTaskStepPropertiesTypeTaskStepProperties', 'TypeBasicTaskStepPropertiesTypeDocker', 'TypeBasicTaskStepPropertiesTypeFileTask', 'TypeBasicTaskStepPropertiesTypeEncodedTask' + Type TypeBasicTaskStepProperties `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileTaskStep. +func (fts FileTaskStep) MarshalJSON() ([]byte, error) { + fts.Type = TypeBasicTaskStepPropertiesTypeFileTask + objectMap := make(map[string]interface{}) + if fts.TaskFilePath != nil { + objectMap["taskFilePath"] = fts.TaskFilePath + } + if fts.ValuesFilePath != nil { + objectMap["valuesFilePath"] = fts.ValuesFilePath + } + if fts.Values != nil { + objectMap["values"] = fts.Values + } + if fts.ContextPath != nil { + objectMap["contextPath"] = fts.ContextPath + } + if fts.ContextAccessToken != nil { + objectMap["contextAccessToken"] = fts.ContextAccessToken + } + if fts.Type != "" { + objectMap["type"] = fts.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildStep is the BasicTaskStepProperties implementation for FileTaskStep. +func (fts FileTaskStep) AsDockerBuildStep() (*DockerBuildStep, bool) { + return nil, false +} + +// AsFileTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. +func (fts FileTaskStep) AsFileTaskStep() (*FileTaskStep, bool) { + return &fts, true +} + +// AsEncodedTaskStep is the BasicTaskStepProperties implementation for FileTaskStep. +func (fts FileTaskStep) AsEncodedTaskStep() (*EncodedTaskStep, bool) { + return nil, false +} + +// AsTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. +func (fts FileTaskStep) AsTaskStepProperties() (*TaskStepProperties, bool) { + return nil, false +} + +// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for FileTaskStep. +func (fts FileTaskStep) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { + return &fts, true +} + +// FileTaskStepUpdateParameters the properties of updating a task step. +type FileTaskStepUpdateParameters struct { + // TaskFilePath - The task template/definition file path relative to the source context. + TaskFilePath *string `json:"taskFilePath,omitempty"` + // ValuesFilePath - The values/parameters file path relative to the source context. + ValuesFilePath *string `json:"valuesFilePath,omitempty"` + // Values - The collection of overridable values that can be passed when running a task. + Values *[]SetValue `json:"values,omitempty"` + // ContextPath - The URL(absolute or relative) of the source context for the task step. + ContextPath *string `json:"contextPath,omitempty"` + // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string `json:"contextAccessToken,omitempty"` + // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' + Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileTaskStepUpdateParameters. +func (ftsup FileTaskStepUpdateParameters) MarshalJSON() ([]byte, error) { + ftsup.Type = TypeBasicTaskStepUpdateParametersTypeFileTask + objectMap := make(map[string]interface{}) + if ftsup.TaskFilePath != nil { + objectMap["taskFilePath"] = ftsup.TaskFilePath + } + if ftsup.ValuesFilePath != nil { + objectMap["valuesFilePath"] = ftsup.ValuesFilePath + } + if ftsup.Values != nil { + objectMap["values"] = ftsup.Values + } + if ftsup.ContextPath != nil { + objectMap["contextPath"] = ftsup.ContextPath + } + if ftsup.ContextAccessToken != nil { + objectMap["contextAccessToken"] = ftsup.ContextAccessToken + } + if ftsup.Type != "" { + objectMap["type"] = ftsup.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. +func (ftsup FileTaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { + return nil, false +} + +// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. +func (ftsup FileTaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { + return &ftsup, true +} + +// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. +func (ftsup FileTaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { + return nil, false +} + +// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. +func (ftsup FileTaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { + return nil, false +} + +// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for FileTaskStepUpdateParameters. +func (ftsup FileTaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { + return &ftsup, true +} + +// GenerateCredentialsParameters the parameters used to generate credentials for a specified token or user +// of a container registry. +type GenerateCredentialsParameters struct { + // TokenID - The resource ID of the token for which credentials have to be generated. + TokenID *string `json:"tokenId,omitempty"` + // Expiry - The expiry date of the generated credentials after which the credentials become invalid. + Expiry *date.Time `json:"expiry,omitempty"` + // Name - Specifies name of the password which should be regenerated if any -- password1 or password2. Possible values include: 'TokenPasswordNamePassword1', 'TokenPasswordNamePassword2' + Name TokenPasswordName `json:"name,omitempty"` +} + +// GenerateCredentialsResult the response from the GenerateCredentials operation. +type GenerateCredentialsResult struct { + autorest.Response `json:"-"` + // Username - The username for a container registry. + Username *string `json:"username,omitempty"` + // Passwords - The list of passwords for a container registry. + Passwords *[]TokenPassword `json:"passwords,omitempty"` +} + +// IdentityProperties managed identity for the resource. +type IdentityProperties struct { + // PrincipalID - The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,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}'. + UserAssignedIdentities map[string]*UserIdentityProperties `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for IdentityProperties. +func (IP IdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if IP.PrincipalID != nil { + objectMap["principalId"] = IP.PrincipalID + } + if IP.TenantID != nil { + objectMap["tenantId"] = IP.TenantID + } + if IP.Type != "" { + objectMap["type"] = IP.Type + } + if IP.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = IP.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ImageDescriptor properties for a registry image. +type ImageDescriptor struct { + // Registry - The registry login server. + Registry *string `json:"registry,omitempty"` + // Repository - The repository name. + Repository *string `json:"repository,omitempty"` + // Tag - The tag name. + Tag *string `json:"tag,omitempty"` + // Digest - The sha256-based digest of the image manifest. + Digest *string `json:"digest,omitempty"` +} + +// ImageUpdateTrigger the image update trigger that caused a build. +type ImageUpdateTrigger struct { + // ID - The unique ID of the trigger. + ID *string `json:"id,omitempty"` + // Timestamp - The timestamp when the image update happened. + Timestamp *date.Time `json:"timestamp,omitempty"` + // Images - The list of image updates that caused the build. + Images *[]ImageDescriptor `json:"images,omitempty"` +} + +// ImportImageParameters ... +type ImportImageParameters struct { + // Source - The source of the image. + Source *ImportSource `json:"source,omitempty"` + // TargetTags - List of strings of the form repo[:tag]. When tag is omitted the source will be used (or 'latest' if source tag is also omitted). + TargetTags *[]string `json:"targetTags,omitempty"` + // UntaggedTargetRepositories - List of strings of repository names to do a manifest only copy. No tag will be created. + UntaggedTargetRepositories *[]string `json:"untaggedTargetRepositories,omitempty"` + // Mode - When Force, any existing target tags will be overwritten. When NoForce, any existing target tags will fail the operation before any copying begins. Possible values include: 'ImportModeNoForce', 'ImportModeForce' + Mode ImportMode `json:"mode,omitempty"` +} + +// ImportPipeline an object that represents an import pipeline for a container registry. +type ImportPipeline struct { + autorest.Response `json:"-"` + // Location - The location of the import pipeline. + Location *string `json:"location,omitempty"` + // Identity - The identity of the import pipeline. + Identity *IdentityProperties `json:"identity,omitempty"` + // ImportPipelineProperties - The properties of the import pipeline. + *ImportPipelineProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImportPipeline. +func (IP ImportPipeline) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if IP.Location != nil { + objectMap["location"] = IP.Location + } + if IP.Identity != nil { + objectMap["identity"] = IP.Identity + } + if IP.ImportPipelineProperties != nil { + objectMap["properties"] = IP.ImportPipelineProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ImportPipeline struct. +func (IP *ImportPipeline) 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 "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + IP.Location = &location + } + case "identity": + if v != nil { + var identity IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + IP.Identity = &identity + } + case "properties": + if v != nil { + var importPipelineProperties ImportPipelineProperties + err = json.Unmarshal(*v, &importPipelineProperties) + if err != nil { + return err + } + IP.ImportPipelineProperties = &importPipelineProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + IP.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + IP.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + IP.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + IP.SystemData = &systemData + } + } + } + + return nil +} + +// ImportPipelineListResult the result of a request to list import pipelines for a container registry. +type ImportPipelineListResult struct { + autorest.Response `json:"-"` + // Value - The list of import pipelines. Since this list may be incomplete, the nextLink field should be used to request the next list of import pipelines. + Value *[]ImportPipeline `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of pipeline runs. + NextLink *string `json:"nextLink,omitempty"` +} + +// ImportPipelineListResultIterator provides access to a complete listing of ImportPipeline values. +type ImportPipelineListResultIterator struct { + i int + page ImportPipelineListResultPage +} + +// 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 *ImportPipelineListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelineListResultIterator.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 *ImportPipelineListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ImportPipelineListResultIterator) 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 ImportPipelineListResultIterator) Response() ImportPipelineListResult { + 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 ImportPipelineListResultIterator) Value() ImportPipeline { + if !iter.page.NotDone() { + return ImportPipeline{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ImportPipelineListResultIterator type. +func NewImportPipelineListResultIterator(page ImportPipelineListResultPage) ImportPipelineListResultIterator { + return ImportPipelineListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (iplr ImportPipelineListResult) IsEmpty() bool { + return iplr.Value == nil || len(*iplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (iplr ImportPipelineListResult) hasNextLink() bool { + return iplr.NextLink != nil && len(*iplr.NextLink) != 0 +} + +// importPipelineListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (iplr ImportPipelineListResult) importPipelineListResultPreparer(ctx context.Context) (*http.Request, error) { + if !iplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(iplr.NextLink))) +} + +// ImportPipelineListResultPage contains a page of ImportPipeline values. +type ImportPipelineListResultPage struct { + fn func(context.Context, ImportPipelineListResult) (ImportPipelineListResult, error) + iplr ImportPipelineListResult +} + +// 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 *ImportPipelineListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImportPipelineListResultPage.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.iplr) + if err != nil { + return err + } + page.iplr = 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 *ImportPipelineListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ImportPipelineListResultPage) NotDone() bool { + return !page.iplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ImportPipelineListResultPage) Response() ImportPipelineListResult { + return page.iplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ImportPipelineListResultPage) Values() []ImportPipeline { + if page.iplr.IsEmpty() { + return nil + } + return *page.iplr.Value +} + +// Creates a new instance of the ImportPipelineListResultPage type. +func NewImportPipelineListResultPage(cur ImportPipelineListResult, getNextPage func(context.Context, ImportPipelineListResult) (ImportPipelineListResult, error)) ImportPipelineListResultPage { + return ImportPipelineListResultPage{ + fn: getNextPage, + iplr: cur, + } +} + +// ImportPipelineProperties the properties of an import pipeline. +type ImportPipelineProperties struct { + // Source - The source properties of the import pipeline. + Source *ImportPipelineSourceProperties `json:"source,omitempty"` + // Trigger - The properties that describe the trigger of the import pipeline. + Trigger *PipelineTriggerProperties `json:"trigger,omitempty"` + // Options - The list of all options configured for the pipeline. + Options *[]PipelineOptions `json:"options,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the pipeline at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImportPipelineProperties. +func (ipp ImportPipelineProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ipp.Source != nil { + objectMap["source"] = ipp.Source + } + if ipp.Trigger != nil { + objectMap["trigger"] = ipp.Trigger + } + if ipp.Options != nil { + objectMap["options"] = ipp.Options + } + return json.Marshal(objectMap) +} + +// ImportPipelinesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ImportPipelinesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ImportPipelinesClient) (ImportPipeline, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ImportPipelinesCreateFuture) 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 ImportPipelinesCreateFuture.Result. +func (future *ImportPipelinesCreateFuture) result(client ImportPipelinesClient) (IP ImportPipeline, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + IP.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ImportPipelinesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if IP.Response.Response, err = future.GetResult(sender); err == nil && IP.Response.Response.StatusCode != http.StatusNoContent { + IP, err = client.CreateResponder(IP.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesCreateFuture", "Result", IP.Response.Response, "Failure responding to request") + } + } + return +} + +// ImportPipelinesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ImportPipelinesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ImportPipelinesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ImportPipelinesDeleteFuture) 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 ImportPipelinesDeleteFuture.Result. +func (future *ImportPipelinesDeleteFuture) result(client ImportPipelinesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ImportPipelinesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ImportPipelinesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ImportPipelineSourceProperties the properties of the import pipeline source. +type ImportPipelineSourceProperties struct { + // Type - The type of source for the import pipeline. Possible values include: 'PipelineSourceTypeAzureStorageBlobContainer' + Type PipelineSourceType `json:"type,omitempty"` + // URI - The source uri of the import pipeline. + // When 'AzureStorageBlob': "https://accountName.blob.core.windows.net/containerName/blobName" + // When 'AzureStorageBlobContainer': "https://accountName.blob.core.windows.net/containerName" + URI *string `json:"uri,omitempty"` + // KeyVaultURI - They key vault secret uri to obtain the source storage SAS token. + KeyVaultURI *string `json:"keyVaultUri,omitempty"` +} + +// ImportSource ... +type ImportSource struct { + // ResourceID - The resource identifier of the source Azure Container Registry. + ResourceID *string `json:"resourceId,omitempty"` + // RegistryURI - The address of the source registry (e.g. 'mcr.microsoft.com'). + RegistryURI *string `json:"registryUri,omitempty"` + // Credentials - Credentials used when importing from a registry uri. + Credentials *ImportSourceCredentials `json:"credentials,omitempty"` + // SourceImage - Repository name of the source image. + // Specify an image by repository ('hello-world'). This will use the 'latest' tag. + // Specify an image by tag ('hello-world:latest'). + // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + SourceImage *string `json:"sourceImage,omitempty"` +} + +// ImportSourceCredentials ... +type ImportSourceCredentials struct { + // Username - The username to authenticate with the source registry. + Username *string `json:"username,omitempty"` + // Password - The password used to authenticate with the source registry. + Password *string `json:"password,omitempty"` +} + +// InnerErrorDescription inner error. +type InnerErrorDescription struct { + // Code - error code. + Code *string `json:"code,omitempty"` + // Message - error message. + Message *string `json:"message,omitempty"` + // Target - target of the particular error. + Target *string `json:"target,omitempty"` +} + +// IPRule IP rule with specific IP or IP range in CIDR format. +type IPRule struct { + // Action - The action of IP ACL rule. Possible values include: 'ActionAllow' + Action Action `json:"action,omitempty"` + // IPAddressOrRange - Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. + IPAddressOrRange *string `json:"value,omitempty"` +} + +// KeyVaultProperties ... +type KeyVaultProperties struct { + // KeyIdentifier - Key vault uri to access the encryption key. + KeyIdentifier *string `json:"keyIdentifier,omitempty"` + // VersionedKeyIdentifier - READ-ONLY; The fully qualified key identifier that includes the version of the key that is actually used for encryption. + VersionedKeyIdentifier *string `json:"versionedKeyIdentifier,omitempty"` + // Identity - The client id of the identity which will be used to access key vault. + Identity *string `json:"identity,omitempty"` + // KeyRotationEnabled - READ-ONLY; Auto key rotation status for a CMK enabled registry. + KeyRotationEnabled *bool `json:"keyRotationEnabled,omitempty"` + // LastKeyRotationTimestamp - READ-ONLY; Timestamp of the last successful key rotation. + LastKeyRotationTimestamp *date.Time `json:"lastKeyRotationTimestamp,omitempty"` +} + +// MarshalJSON is the custom marshaler for KeyVaultProperties. +func (kvp KeyVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kvp.KeyIdentifier != nil { + objectMap["keyIdentifier"] = kvp.KeyIdentifier + } + if kvp.Identity != nil { + objectMap["identity"] = kvp.Identity + } + return json.Marshal(objectMap) +} + +// LoggingProperties the logging properties of the connected registry. +type LoggingProperties struct { + // LogLevel - The verbosity of logs persisted on the connected registry. Possible values include: 'LogLevelDebug', 'LogLevelInformation', 'LogLevelWarning', 'LogLevelError', 'LogLevelNone' + LogLevel LogLevel `json:"logLevel,omitempty"` + // AuditLogStatus - Indicates whether audit logs are enabled on the connected registry. Possible values include: 'AuditLogStatusEnabled', 'AuditLogStatusDisabled' + AuditLogStatus AuditLogStatus `json:"auditLogStatus,omitempty"` +} + +// LoginServerProperties the login server properties of the connected registry. +type LoginServerProperties struct { + // Host - READ-ONLY; The host of the connected registry. Can be FQDN or IP. + Host *string `json:"host,omitempty"` + // TLS - READ-ONLY; The TLS properties of the connected registry login server. + TLS *TLSProperties `json:"tls,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoginServerProperties. +func (lsp LoginServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// NetworkRuleSet the network rule set for a container registry. +type NetworkRuleSet struct { + // DefaultAction - The default action of allow or deny when no other rules match. Possible values include: 'DefaultActionAllow', 'DefaultActionDeny' + DefaultAction DefaultAction `json:"defaultAction,omitempty"` + // VirtualNetworkRules - The virtual network rules. + VirtualNetworkRules *[]VirtualNetworkRule `json:"virtualNetworkRules,omitempty"` + // IPRules - The IP ACL rules. + IPRules *[]IPRule `json:"ipRules,omitempty"` +} + +// OperationDefinition the definition of a container registry operation. +type OperationDefinition struct { + // Origin - The origin information of the container registry operation. + Origin *string `json:"origin,omitempty"` + // Name - Operation name: {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + // Display - The display information for the container registry operation. + Display *OperationDisplayDefinition `json:"display,omitempty"` + // OperationPropertiesDefinition - The properties information for the container registry operation. + *OperationPropertiesDefinition `json:"properties,omitempty"` + // IsDataAction - This property indicates if the operation is an action or a data action + // ref: https://docs.microsoft.com/en-us/azure/role-based-access-control/role-definitions#management-and-data-operations + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDefinition. +func (od OperationDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.Origin != nil { + objectMap["origin"] = od.Origin + } + if od.Name != nil { + objectMap["name"] = od.Name + } + if od.Display != nil { + objectMap["display"] = od.Display + } + if od.OperationPropertiesDefinition != nil { + objectMap["properties"] = od.OperationPropertiesDefinition + } + if od.IsDataAction != nil { + objectMap["isDataAction"] = od.IsDataAction + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OperationDefinition struct. +func (od *OperationDefinition) 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 "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + od.Origin = &origin + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + od.Name = &name + } + case "display": + if v != nil { + var display OperationDisplayDefinition + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + od.Display = &display + } + case "properties": + if v != nil { + var operationPropertiesDefinition OperationPropertiesDefinition + err = json.Unmarshal(*v, &operationPropertiesDefinition) + if err != nil { + return err + } + od.OperationPropertiesDefinition = &operationPropertiesDefinition + } + case "isDataAction": + if v != nil { + var isDataAction bool + err = json.Unmarshal(*v, &isDataAction) + if err != nil { + return err + } + od.IsDataAction = &isDataAction + } + } + } + + return nil +} + +// OperationDisplayDefinition the display information for a container registry operation. +type OperationDisplayDefinition struct { + // Provider - The resource provider name: Microsoft.ContainerRegistry. + Provider *string `json:"provider,omitempty"` + // Resource - The resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - The operation that users can perform. + Operation *string `json:"operation,omitempty"` + // Description - The description for the operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult the result of a request to list container registry operations. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - The list of container registry operations. Since this list may be incomplete, the nextLink field should be used to request the next list of operations. + Value *[]OperationDefinition `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of container registry operations. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of OperationDefinition 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() OperationDefinition { + if !iter.page.NotDone() { + return OperationDefinition{} + } + 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 OperationDefinition 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() []OperationDefinition { + 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, + } +} + +// OperationLogSpecificationDefinition the definition of Azure Monitoring log. +type OperationLogSpecificationDefinition struct { + // Name - Log name. + Name *string `json:"name,omitempty"` + // DisplayName - Log display name. + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Log blob duration. + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// OperationMetricSpecificationDefinition the definition of Azure Monitoring metric. +type OperationMetricSpecificationDefinition struct { + // Name - Metric name. + Name *string `json:"name,omitempty"` + // DisplayName - Metric display name. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Metric description. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - Metric unit. + Unit *string `json:"unit,omitempty"` + // AggregationType - Metric aggregation type. + AggregationType *string `json:"aggregationType,omitempty"` + // InternalMetricName - Internal metric name. + InternalMetricName *string `json:"internalMetricName,omitempty"` +} + +// OperationPropertiesDefinition the definition of Azure Monitoring properties. +type OperationPropertiesDefinition struct { + // ServiceSpecification - The definition of Azure Monitoring service. + ServiceSpecification *OperationServiceSpecificationDefinition `json:"serviceSpecification,omitempty"` +} + +// OperationServiceSpecificationDefinition the definition of Azure Monitoring list. +type OperationServiceSpecificationDefinition struct { + // MetricSpecifications - A list of Azure Monitoring metrics definition. + MetricSpecifications *[]OperationMetricSpecificationDefinition `json:"metricSpecifications,omitempty"` + // LogSpecifications - A list of Azure Monitoring log definitions. + LogSpecifications *[]OperationLogSpecificationDefinition `json:"logSpecifications,omitempty"` +} + +// OverrideTaskStepProperties ... +type OverrideTaskStepProperties struct { + // ContextPath - The source context against which run has to be queued. + ContextPath *string `json:"contextPath,omitempty"` + // File - The file against which run has to be queued. + File *string `json:"file,omitempty"` + // Arguments - Gets or sets the collection of override arguments to be used when + // executing a build step. + Arguments *[]Argument `json:"arguments,omitempty"` + // Target - The name of the target build stage for the docker build. + Target *string `json:"target,omitempty"` + // Values - The collection of overridable values that can be passed when running a Task. + Values *[]SetValue `json:"values,omitempty"` + // UpdateTriggerToken - Base64 encoded update trigger token that will be attached with the base image trigger webhook. + UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` +} + +// ParentProperties the properties of the connected registry parent. +type ParentProperties struct { + // ID - The resource ID of the parent to which the connected registry will be associated. + ID *string `json:"id,omitempty"` + // SyncProperties - The sync properties of the connected registry with its parent. + SyncProperties *SyncProperties `json:"syncProperties,omitempty"` +} + +// PipelineRun an object that represents a pipeline run for a container registry. +type PipelineRun struct { + autorest.Response `json:"-"` + // PipelineRunProperties - The properties of a pipeline run. + *PipelineRunProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for PipelineRun. +func (pr PipelineRun) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pr.PipelineRunProperties != nil { + objectMap["properties"] = pr.PipelineRunProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PipelineRun struct. +func (pr *PipelineRun) 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 pipelineRunProperties PipelineRunProperties + err = json.Unmarshal(*v, &pipelineRunProperties) + if err != nil { + return err + } + pr.PipelineRunProperties = &pipelineRunProperties + } + 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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + pr.SystemData = &systemData + } + } + } + + return nil +} + +// PipelineRunListResult the result of a request to list pipeline runs for a container registry. +type PipelineRunListResult struct { + autorest.Response `json:"-"` + // Value - The list of pipeline runs. Since this list may be incomplete, the nextLink field should be used to request the next list of pipeline runs. + Value *[]PipelineRun `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of pipeline runs. + NextLink *string `json:"nextLink,omitempty"` +} + +// PipelineRunListResultIterator provides access to a complete listing of PipelineRun values. +type PipelineRunListResultIterator struct { + i int + page PipelineRunListResultPage +} + +// 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 *PipelineRunListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunListResultIterator.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 *PipelineRunListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PipelineRunListResultIterator) 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 PipelineRunListResultIterator) Response() PipelineRunListResult { + 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 PipelineRunListResultIterator) Value() PipelineRun { + if !iter.page.NotDone() { + return PipelineRun{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PipelineRunListResultIterator type. +func NewPipelineRunListResultIterator(page PipelineRunListResultPage) PipelineRunListResultIterator { + return PipelineRunListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (prlr PipelineRunListResult) IsEmpty() bool { + return prlr.Value == nil || len(*prlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (prlr PipelineRunListResult) hasNextLink() bool { + return prlr.NextLink != nil && len(*prlr.NextLink) != 0 +} + +// pipelineRunListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (prlr PipelineRunListResult) pipelineRunListResultPreparer(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))) +} + +// PipelineRunListResultPage contains a page of PipelineRun values. +type PipelineRunListResultPage struct { + fn func(context.Context, PipelineRunListResult) (PipelineRunListResult, error) + prlr PipelineRunListResult +} + +// 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 *PipelineRunListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunListResultPage.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 *PipelineRunListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PipelineRunListResultPage) NotDone() bool { + return !page.prlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PipelineRunListResultPage) Response() PipelineRunListResult { + return page.prlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PipelineRunListResultPage) Values() []PipelineRun { + if page.prlr.IsEmpty() { + return nil + } + return *page.prlr.Value +} + +// Creates a new instance of the PipelineRunListResultPage type. +func NewPipelineRunListResultPage(cur PipelineRunListResult, getNextPage func(context.Context, PipelineRunListResult) (PipelineRunListResult, error)) PipelineRunListResultPage { + return PipelineRunListResultPage{ + fn: getNextPage, + prlr: cur, + } +} + +// PipelineRunProperties the properties of a pipeline run. +type PipelineRunProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of a pipeline run. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Request - The request parameters for a pipeline run. + Request *PipelineRunRequest `json:"request,omitempty"` + // Response - READ-ONLY; The response of a pipeline run. + Response *PipelineRunResponse `json:"response,omitempty"` + // ForceUpdateTag - How the pipeline run should be forced to recreate even if the pipeline run configuration has not changed. + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` +} + +// MarshalJSON is the custom marshaler for PipelineRunProperties. +func (prp PipelineRunProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if prp.Request != nil { + objectMap["request"] = prp.Request + } + if prp.ForceUpdateTag != nil { + objectMap["forceUpdateTag"] = prp.ForceUpdateTag + } + return json.Marshal(objectMap) +} + +// PipelineRunRequest the request properties provided for a pipeline run. +type PipelineRunRequest struct { + // PipelineResourceID - The resource ID of the pipeline to run. + PipelineResourceID *string `json:"pipelineResourceId,omitempty"` + // Artifacts - List of source artifacts to be transferred by the pipeline. + // Specify an image by repository ('hello-world'). This will use the 'latest' tag. + // Specify an image by tag ('hello-world:latest'). + // Specify an image by sha256-based manifest digest ('hello-world@sha256:abc123'). + Artifacts *[]string `json:"artifacts,omitempty"` + // Source - The source properties of the pipeline run. + Source *PipelineRunSourceProperties `json:"source,omitempty"` + // Target - The target properties of the pipeline run. + Target *PipelineRunTargetProperties `json:"target,omitempty"` + // CatalogDigest - The digest of the tar used to transfer the artifacts. + CatalogDigest *string `json:"catalogDigest,omitempty"` +} + +// PipelineRunResponse the response properties returned for a pipeline run. +type PipelineRunResponse struct { + // Status - The current status of the pipeline run. + Status *string `json:"status,omitempty"` + // ImportedArtifacts - The artifacts imported in the pipeline run. + ImportedArtifacts *[]string `json:"importedArtifacts,omitempty"` + // Progress - The current progress of the copy operation. + Progress *ProgressProperties `json:"progress,omitempty"` + // StartTime - The time the pipeline run started. + StartTime *date.Time `json:"startTime,omitempty"` + // FinishTime - The time the pipeline run finished. + FinishTime *date.Time `json:"finishTime,omitempty"` + // Source - The source of the pipeline run. + Source *ImportPipelineSourceProperties `json:"source,omitempty"` + // Target - The target of the pipeline run. + Target *ExportPipelineTargetProperties `json:"target,omitempty"` + // CatalogDigest - The digest of the tar used to transfer the artifacts. + CatalogDigest *string `json:"catalogDigest,omitempty"` + // Trigger - The trigger that caused the pipeline run. + Trigger *PipelineTriggerDescriptor `json:"trigger,omitempty"` + // PipelineRunErrorMessage - The detailed error message for the pipeline run in the case of failure. + PipelineRunErrorMessage *string `json:"pipelineRunErrorMessage,omitempty"` +} + +// PipelineRunsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PipelineRunsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PipelineRunsClient) (PipelineRun, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PipelineRunsCreateFuture) 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 PipelineRunsCreateFuture.Result. +func (future *PipelineRunsCreateFuture) result(client PipelineRunsClient) (pr PipelineRun, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.PipelineRunsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pr.Response.Response, err = future.GetResult(sender); err == nil && pr.Response.Response.StatusCode != http.StatusNoContent { + pr, err = client.CreateResponder(pr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsCreateFuture", "Result", pr.Response.Response, "Failure responding to request") + } + } + return +} + +// PipelineRunsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PipelineRunsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PipelineRunsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PipelineRunsDeleteFuture) 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 PipelineRunsDeleteFuture.Result. +func (future *PipelineRunsDeleteFuture) result(client PipelineRunsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.PipelineRunsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PipelineRunSourceProperties ... +type PipelineRunSourceProperties struct { + // Type - The type of the source. Possible values include: 'PipelineRunSourceTypeAzureStorageBlob' + Type PipelineRunSourceType `json:"type,omitempty"` + // Name - The name of the source. + Name *string `json:"name,omitempty"` +} + +// PipelineRunTargetProperties ... +type PipelineRunTargetProperties struct { + // Type - The type of the target. Possible values include: 'PipelineRunTargetTypeAzureStorageBlob' + Type PipelineRunTargetType `json:"type,omitempty"` + // Name - The name of the target. + Name *string `json:"name,omitempty"` +} + +// PipelineSourceTriggerDescriptor ... +type PipelineSourceTriggerDescriptor struct { + // Timestamp - The timestamp when the source update happened. + Timestamp *date.Time `json:"timestamp,omitempty"` +} + +// PipelineSourceTriggerProperties ... +type PipelineSourceTriggerProperties struct { + // Status - The current status of the source trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' + Status TriggerStatus `json:"status,omitempty"` +} + +// PipelineTriggerDescriptor ... +type PipelineTriggerDescriptor struct { + // SourceTrigger - The source trigger that caused the pipeline run. + SourceTrigger *PipelineSourceTriggerDescriptor `json:"sourceTrigger,omitempty"` +} + +// PipelineTriggerProperties ... +type PipelineTriggerProperties struct { + // SourceTrigger - The source trigger properties of the pipeline. + SourceTrigger *PipelineSourceTriggerProperties `json:"sourceTrigger,omitempty"` +} + +// PlatformProperties the platform properties against which the run has to happen. +type PlatformProperties struct { + // Os - The operating system type required for the run. Possible values include: 'OSWindows', 'OSLinux' + Os OS `json:"os,omitempty"` + // Architecture - The OS architecture. Possible values include: 'ArchitectureAmd64', 'ArchitectureX86', 'ArchitectureThreeEightSix', 'ArchitectureArm', 'ArchitectureArm64' + Architecture Architecture `json:"architecture,omitempty"` + // Variant - Variant of the CPU. Possible values include: 'VariantV6', 'VariantV7', 'VariantV8' + Variant Variant `json:"variant,omitempty"` +} + +// PlatformUpdateParameters the properties for updating the platform configuration. +type PlatformUpdateParameters struct { + // Os - The operating system type required for the run. Possible values include: 'OSWindows', 'OSLinux' + Os OS `json:"os,omitempty"` + // Architecture - The OS architecture. Possible values include: 'ArchitectureAmd64', 'ArchitectureX86', 'ArchitectureThreeEightSix', 'ArchitectureArm', 'ArchitectureArm64' + Architecture Architecture `json:"architecture,omitempty"` + // Variant - Variant of the CPU. Possible values include: 'VariantV6', 'VariantV7', 'VariantV8' + Variant Variant `json:"variant,omitempty"` +} + +// Policies the policies for a container registry. +type Policies struct { + // QuarantinePolicy - The quarantine policy for a container registry. + QuarantinePolicy *QuarantinePolicy `json:"quarantinePolicy,omitempty"` + // TrustPolicy - The content trust policy for a container registry. + TrustPolicy *TrustPolicy `json:"trustPolicy,omitempty"` + // RetentionPolicy - The retention policy for a container registry. + RetentionPolicy *RetentionPolicy `json:"retentionPolicy,omitempty"` + // ExportPolicy - The export policy for a container registry. + ExportPolicy *ExportPolicy `json:"exportPolicy,omitempty"` +} + +// PrivateEndpoint the Private Endpoint resource. +type PrivateEndpoint struct { + // ID - This is private endpoint resource created with Microsoft.Network resource provider. + ID *string `json:"id,omitempty"` +} + +// PrivateEndpointConnection an object that represents a private endpoint connection for a container +// registry. +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - The properties of a private endpoint connection. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + pec.SystemData = &systemData + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult the result of a request to list private endpoint connections for a +// container registry. +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - The list of private endpoint connections. Since this list may be incomplete, the nextLink field should be used to request the next list of private endpoint connections. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of private endpoint connections. + 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 the properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - The resource of private endpoint. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of private endpoint connection resource. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = pecp.PrivateEndpoint + } + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type PrivateEndpointConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. +func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { + pec, err = client.CreateOrUpdateResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkResource a resource that supports private link capabilities. +type PrivateLinkResource struct { + // Type - READ-ONLY; The resource type is private link resource. + Type *string `json:"type,omitempty"` + // ID - The resource ID. + ID *string `json:"id,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // PrivateLinkResourceProperties - A resource that supports private link capabilities. + *PrivateLinkResourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.ID != nil { + objectMap["id"] = plr.ID + } + if plr.Name != nil { + objectMap["name"] = plr.Name + } + if plr.PrivateLinkResourceProperties != nil { + objectMap["properties"] = plr.PrivateLinkResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkResource struct. +func (plr *PrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plr.Type = &typeVar + } + 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 "properties": + if v != nil { + var privateLinkResourceProperties PrivateLinkResourceProperties + err = json.Unmarshal(*v, &privateLinkResourceProperties) + if err != nil { + return err + } + plr.PrivateLinkResourceProperties = &privateLinkResourceProperties + } + } + } + + return nil +} + +// PrivateLinkResourceListResult the result of a request to list private link resources for a container +// registry. +type PrivateLinkResourceListResult struct { + autorest.Response `json:"-"` + // Value - The list of private link resources. Since this list may be incomplete, the nextLink field should be used to request the next list of private link resources. + Value *[]PrivateLinkResource `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of private link resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// PrivateLinkResourceListResultIterator provides access to a complete listing of PrivateLinkResource +// values. +type PrivateLinkResourceListResultIterator struct { + i int + page PrivateLinkResourceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateLinkResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateLinkResourceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateLinkResourceListResultIterator) Response() PrivateLinkResourceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateLinkResourceListResultIterator) Value() PrivateLinkResource { + if !iter.page.NotDone() { + return PrivateLinkResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateLinkResourceListResultIterator type. +func NewPrivateLinkResourceListResultIterator(page PrivateLinkResourceListResultPage) PrivateLinkResourceListResultIterator { + return PrivateLinkResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plrlr PrivateLinkResourceListResult) IsEmpty() bool { + return plrlr.Value == nil || len(*plrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plrlr PrivateLinkResourceListResult) hasNextLink() bool { + return plrlr.NextLink != nil && len(*plrlr.NextLink) != 0 +} + +// privateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plrlr PrivateLinkResourceListResult) privateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !plrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plrlr.NextLink))) +} + +// PrivateLinkResourceListResultPage contains a page of PrivateLinkResource values. +type PrivateLinkResourceListResultPage struct { + fn func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error) + plrlr PrivateLinkResourceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.plrlr) + if err != nil { + return err + } + page.plrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateLinkResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateLinkResourceListResultPage) NotDone() bool { + return !page.plrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateLinkResourceListResultPage) Response() PrivateLinkResourceListResult { + return page.plrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateLinkResourceListResultPage) Values() []PrivateLinkResource { + if page.plrlr.IsEmpty() { + return nil + } + return *page.plrlr.Value +} + +// Creates a new instance of the PrivateLinkResourceListResultPage type. +func NewPrivateLinkResourceListResultPage(cur PrivateLinkResourceListResult, getNextPage func(context.Context, PrivateLinkResourceListResult) (PrivateLinkResourceListResult, error)) PrivateLinkResourceListResultPage { + return PrivateLinkResourceListResultPage{ + fn: getNextPage, + plrlr: cur, + } +} + +// PrivateLinkResourceProperties the properties of a private link resource. +type PrivateLinkResourceProperties struct { + // GroupID - The private link resource group id. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - The private link resource required member names. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - The private link resource Private link DNS zone name. + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// PrivateLinkServiceConnectionState the state of a private link service connection. +type PrivateLinkServiceConnectionState struct { + // Status - The private link service connection status. Possible values include: 'ConnectionStatusApproved', 'ConnectionStatusPending', 'ConnectionStatusRejected', 'ConnectionStatusDisconnected' + Status ConnectionStatus `json:"status,omitempty"` + // Description - The description for connection status. For example if connection is rejected it can indicate reason for rejection. + Description *string `json:"description,omitempty"` + // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. Possible values include: 'ActionsRequiredNone', 'ActionsRequiredRecreate' + ActionsRequired ActionsRequired `json:"actionsRequired,omitempty"` +} + +// ProgressProperties ... +type ProgressProperties struct { + // Percentage - The percentage complete of the copy operation. + Percentage *string `json:"percentage,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 - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// QuarantinePolicy the quarantine policy for a container registry. +type QuarantinePolicy struct { + // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' + Status PolicyStatus `json:"status,omitempty"` +} + +// RegenerateCredentialParameters the parameters used to regenerate the login credential. +type RegenerateCredentialParameters struct { + // Name - Specifies name of the password which should be regenerated -- password or password2. Possible values include: 'PasswordNamePassword', 'PasswordNamePassword2' + Name PasswordName `json:"name,omitempty"` +} + +// RegistriesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RegistriesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RegistriesClient) (Registry, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RegistriesCreateFuture) 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 RegistriesCreateFuture.Result. +func (future *RegistriesCreateFuture) result(client RegistriesClient) (r Registry, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.CreateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesCreateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RegistriesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RegistriesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RegistriesDeleteFuture) 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 RegistriesDeleteFuture.Result. +func (future *RegistriesDeleteFuture) result(client RegistriesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RegistriesGenerateCredentialsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type RegistriesGenerateCredentialsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RegistriesClient) (GenerateCredentialsResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RegistriesGenerateCredentialsFuture) 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 RegistriesGenerateCredentialsFuture.Result. +func (future *RegistriesGenerateCredentialsFuture) result(client RegistriesClient) (gcr GenerateCredentialsResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesGenerateCredentialsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + gcr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesGenerateCredentialsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gcr.Response.Response, err = future.GetResult(sender); err == nil && gcr.Response.Response.StatusCode != http.StatusNoContent { + gcr, err = client.GenerateCredentialsResponder(gcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesGenerateCredentialsFuture", "Result", gcr.Response.Response, "Failure responding to request") + } + } + return +} + +// RegistriesImportImageFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RegistriesImportImageFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RegistriesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RegistriesImportImageFuture) 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 RegistriesImportImageFuture.Result. +func (future *RegistriesImportImageFuture) result(client RegistriesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesImportImageFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesImportImageFuture") + return + } + ar.Response = future.Response() + return +} + +// RegistriesScheduleRunFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RegistriesScheduleRunFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RegistriesClient) (Run, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RegistriesScheduleRunFuture) 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 RegistriesScheduleRunFuture.Result. +func (future *RegistriesScheduleRunFuture) result(client RegistriesClient) (r Run, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesScheduleRunFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesScheduleRunFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.ScheduleRunResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesScheduleRunFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RegistriesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RegistriesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RegistriesClient) (Registry, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RegistriesUpdateFuture) 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 RegistriesUpdateFuture.Result. +func (future *RegistriesUpdateFuture) result(client RegistriesClient) (r Registry, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.RegistriesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.UpdateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesUpdateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// Registry an object that represents a container registry. +type Registry struct { + autorest.Response `json:"-"` + // Sku - The SKU of the container registry. + Sku *Sku `json:"sku,omitempty"` + // Identity - The identity of the container registry. + Identity *IdentityProperties `json:"identity,omitempty"` + // RegistryProperties - The properties of the container registry. + *RegistryProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. This cannot be changed after the resource is created. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Registry. +func (r Registry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Sku != nil { + objectMap["sku"] = r.Sku + } + if r.Identity != nil { + objectMap["identity"] = r.Identity + } + if r.RegistryProperties != nil { + objectMap["properties"] = r.RegistryProperties + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Registry struct. +func (r *Registry) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + r.Sku = &sku + } + case "identity": + if v != nil { + var identity IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + r.Identity = &identity + } + case "properties": + if v != nil { + var registryProperties RegistryProperties + err = json.Unmarshal(*v, ®istryProperties) + if err != nil { + return err + } + r.RegistryProperties = ®istryProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + r.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + r.Tags = tags + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + r.SystemData = &systemData + } + } + } + + return nil +} + +// RegistryListCredentialsResult the response from the ListCredentials operation. +type RegistryListCredentialsResult struct { + autorest.Response `json:"-"` + // Username - The username for a container registry. + Username *string `json:"username,omitempty"` + // Passwords - The list of passwords for a container registry. + Passwords *[]RegistryPassword `json:"passwords,omitempty"` +} + +// RegistryListResult the result of a request to list container registries. +type RegistryListResult struct { + autorest.Response `json:"-"` + // Value - The list of container registries. Since this list may be incomplete, the nextLink field should be used to request the next list of container registries. + Value *[]Registry `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of container registries. + NextLink *string `json:"nextLink,omitempty"` +} + +// RegistryListResultIterator provides access to a complete listing of Registry values. +type RegistryListResultIterator struct { + i int + page RegistryListResultPage +} + +// 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 *RegistryListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultIterator.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 *RegistryListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RegistryListResultIterator) 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 RegistryListResultIterator) Response() RegistryListResult { + 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 RegistryListResultIterator) Value() Registry { + if !iter.page.NotDone() { + return Registry{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RegistryListResultIterator type. +func NewRegistryListResultIterator(page RegistryListResultPage) RegistryListResultIterator { + return RegistryListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rlr RegistryListResult) IsEmpty() bool { + return rlr.Value == nil || len(*rlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rlr RegistryListResult) hasNextLink() bool { + return rlr.NextLink != nil && len(*rlr.NextLink) != 0 +} + +// registryListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rlr RegistryListResult) registryListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rlr.NextLink))) +} + +// RegistryListResultPage contains a page of Registry values. +type RegistryListResultPage struct { + fn func(context.Context, RegistryListResult) (RegistryListResult, error) + rlr RegistryListResult +} + +// 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 *RegistryListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistryListResultPage.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.rlr) + if err != nil { + return err + } + page.rlr = 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 *RegistryListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RegistryListResultPage) NotDone() bool { + return !page.rlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RegistryListResultPage) Response() RegistryListResult { + return page.rlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RegistryListResultPage) Values() []Registry { + if page.rlr.IsEmpty() { + return nil + } + return *page.rlr.Value +} + +// Creates a new instance of the RegistryListResultPage type. +func NewRegistryListResultPage(cur RegistryListResult, getNextPage func(context.Context, RegistryListResult) (RegistryListResult, error)) RegistryListResultPage { + return RegistryListResultPage{ + fn: getNextPage, + rlr: cur, + } +} + +// RegistryNameCheckRequest a request to check whether a container registry name is available. +type RegistryNameCheckRequest struct { + // Name - The name of the container registry. + Name *string `json:"name,omitempty"` + // Type - The resource type of the container registry. This field must be set to 'Microsoft.ContainerRegistry/registries'. + Type *string `json:"type,omitempty"` +} + +// RegistryNameStatus the result of a request to check the availability of a container registry name. +type RegistryNameStatus struct { + autorest.Response `json:"-"` + // NameAvailable - The value that indicates whether the name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - If any, the reason that the name is not available. + Reason *string `json:"reason,omitempty"` + // Message - If any, the error message that provides more detail for the reason that the name is not available. + Message *string `json:"message,omitempty"` +} + +// RegistryPassword the login password for the container registry. +type RegistryPassword struct { + // Name - The password name. Possible values include: 'PasswordNamePassword', 'PasswordNamePassword2' + Name PasswordName `json:"name,omitempty"` + // Value - The password value. + Value *string `json:"value,omitempty"` +} + +// RegistryProperties the properties of a container registry. +type RegistryProperties struct { + // LoginServer - READ-ONLY; The URL that can be used to log into the container registry. + LoginServer *string `json:"loginServer,omitempty"` + // CreationDate - READ-ONLY; The creation date of the container registry in ISO8601 format. + CreationDate *date.Time `json:"creationDate,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the container registry at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Status - READ-ONLY; The status of the container registry at the time the operation was called. + Status *Status `json:"status,omitempty"` + // AdminUserEnabled - The value that indicates whether the admin user is enabled. + AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` + // NetworkRuleSet - The network rule set for a container registry. + NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` + // Policies - The policies for a container registry. + Policies *Policies `json:"policies,omitempty"` + // Encryption - The encryption settings of container registry. + Encryption *EncryptionProperty `json:"encryption,omitempty"` + // DataEndpointEnabled - Enable a single data endpoint per region for serving data. + DataEndpointEnabled *bool `json:"dataEndpointEnabled,omitempty"` + // DataEndpointHostNames - READ-ONLY; List of host names that will serve data when dataEndpointEnabled is true. + DataEndpointHostNames *[]string `json:"dataEndpointHostNames,omitempty"` + // PrivateEndpointConnections - READ-ONLY; List of private endpoint connections for a container registry. + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // PublicNetworkAccess - Whether or not public network access is allowed for the container registry. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // NetworkRuleBypassOptions - Whether to allow trusted Azure services to access a network restricted registry. Possible values include: 'NetworkRuleBypassOptionsAzureServices', 'NetworkRuleBypassOptionsNone' + NetworkRuleBypassOptions NetworkRuleBypassOptions `json:"networkRuleBypassOptions,omitempty"` + // ZoneRedundancy - Whether or not zone redundancy is enabled for this container registry. Possible values include: 'ZoneRedundancyEnabled', 'ZoneRedundancyDisabled' + ZoneRedundancy ZoneRedundancy `json:"zoneRedundancy,omitempty"` + // AnonymousPullEnabled - Enables registry-wide pull from unauthenticated clients. + AnonymousPullEnabled *bool `json:"anonymousPullEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for RegistryProperties. +func (rp RegistryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rp.AdminUserEnabled != nil { + objectMap["adminUserEnabled"] = rp.AdminUserEnabled + } + if rp.NetworkRuleSet != nil { + objectMap["networkRuleSet"] = rp.NetworkRuleSet + } + if rp.Policies != nil { + objectMap["policies"] = rp.Policies + } + if rp.Encryption != nil { + objectMap["encryption"] = rp.Encryption + } + if rp.DataEndpointEnabled != nil { + objectMap["dataEndpointEnabled"] = rp.DataEndpointEnabled + } + if rp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = rp.PublicNetworkAccess + } + if rp.NetworkRuleBypassOptions != "" { + objectMap["networkRuleBypassOptions"] = rp.NetworkRuleBypassOptions + } + if rp.ZoneRedundancy != "" { + objectMap["zoneRedundancy"] = rp.ZoneRedundancy + } + if rp.AnonymousPullEnabled != nil { + objectMap["anonymousPullEnabled"] = rp.AnonymousPullEnabled + } + return json.Marshal(objectMap) +} + +// RegistryPropertiesUpdateParameters the parameters for updating the properties of a container registry. +type RegistryPropertiesUpdateParameters struct { + // AdminUserEnabled - The value that indicates whether the admin user is enabled. + AdminUserEnabled *bool `json:"adminUserEnabled,omitempty"` + // NetworkRuleSet - The network rule set for a container registry. + NetworkRuleSet *NetworkRuleSet `json:"networkRuleSet,omitempty"` + // Policies - The policies for a container registry. + Policies *Policies `json:"policies,omitempty"` + // Encryption - The encryption settings of container registry. + Encryption *EncryptionProperty `json:"encryption,omitempty"` + // DataEndpointEnabled - Enable a single data endpoint per region for serving data. + DataEndpointEnabled *bool `json:"dataEndpointEnabled,omitempty"` + // PublicNetworkAccess - Whether or not public network access is allowed for the container registry. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // NetworkRuleBypassOptions - Whether to allow trusted Azure services to access a network restricted registry. Possible values include: 'NetworkRuleBypassOptionsAzureServices', 'NetworkRuleBypassOptionsNone' + NetworkRuleBypassOptions NetworkRuleBypassOptions `json:"networkRuleBypassOptions,omitempty"` + // AnonymousPullEnabled - Enables registry-wide pull from unauthenticated clients. + AnonymousPullEnabled *bool `json:"anonymousPullEnabled,omitempty"` +} + +// RegistryUpdateParameters the parameters for updating a container registry. +type RegistryUpdateParameters struct { + // Identity - The identity of the container registry. + Identity *IdentityProperties `json:"identity,omitempty"` + // Tags - The tags for the container registry. + Tags map[string]*string `json:"tags"` + // Sku - The SKU of the container registry. + Sku *Sku `json:"sku,omitempty"` + // RegistryPropertiesUpdateParameters - The properties that the container registry will be updated with. + *RegistryPropertiesUpdateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RegistryUpdateParameters. +func (rup RegistryUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rup.Identity != nil { + objectMap["identity"] = rup.Identity + } + if rup.Tags != nil { + objectMap["tags"] = rup.Tags + } + if rup.Sku != nil { + objectMap["sku"] = rup.Sku + } + if rup.RegistryPropertiesUpdateParameters != nil { + objectMap["properties"] = rup.RegistryPropertiesUpdateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RegistryUpdateParameters struct. +func (rup *RegistryUpdateParameters) 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 IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + rup.Identity = &identity + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + rup.Tags = tags + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + rup.Sku = &sku + } + case "properties": + if v != nil { + var registryPropertiesUpdateParameters RegistryPropertiesUpdateParameters + err = json.Unmarshal(*v, ®istryPropertiesUpdateParameters) + if err != nil { + return err + } + rup.RegistryPropertiesUpdateParameters = ®istryPropertiesUpdateParameters + } + } + } + + return nil +} + +// RegistryUsage the quota usage for a container registry. +type RegistryUsage struct { + // Name - The name of the usage. + Name *string `json:"name,omitempty"` + // Limit - The limit of the usage. + Limit *int64 `json:"limit,omitempty"` + // CurrentValue - The current value of the usage. + CurrentValue *int64 `json:"currentValue,omitempty"` + // Unit - The unit of measurement. Possible values include: 'RegistryUsageUnitCount', 'RegistryUsageUnitBytes' + Unit RegistryUsageUnit `json:"unit,omitempty"` +} + +// RegistryUsageListResult the result of a request to get container registry quota usages. +type RegistryUsageListResult struct { + autorest.Response `json:"-"` + // Value - The list of container registry quota usages. + Value *[]RegistryUsage `json:"value,omitempty"` +} + +// Replication an object that represents a replication for a container registry. +type Replication struct { + autorest.Response `json:"-"` + // ReplicationProperties - The properties of the replication. + *ReplicationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. This cannot be changed after the resource is created. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Replication. +func (r Replication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.ReplicationProperties != nil { + objectMap["properties"] = r.ReplicationProperties + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Replication struct. +func (r *Replication) 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 replicationProperties ReplicationProperties + err = json.Unmarshal(*v, &replicationProperties) + if err != nil { + return err + } + r.ReplicationProperties = &replicationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + r.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + r.Tags = tags + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + r.SystemData = &systemData + } + } + } + + return nil +} + +// ReplicationListResult the result of a request to list replications for a container registry. +type ReplicationListResult struct { + autorest.Response `json:"-"` + // Value - The list of replications. Since this list may be incomplete, the nextLink field should be used to request the next list of replications. + Value *[]Replication `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of replications. + NextLink *string `json:"nextLink,omitempty"` +} + +// ReplicationListResultIterator provides access to a complete listing of Replication values. +type ReplicationListResultIterator struct { + i int + page ReplicationListResultPage +} + +// 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 *ReplicationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultIterator.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 *ReplicationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ReplicationListResultIterator) 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 ReplicationListResultIterator) Response() ReplicationListResult { + 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 ReplicationListResultIterator) Value() Replication { + if !iter.page.NotDone() { + return Replication{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ReplicationListResultIterator type. +func NewReplicationListResultIterator(page ReplicationListResultPage) ReplicationListResultIterator { + return ReplicationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rlr ReplicationListResult) IsEmpty() bool { + return rlr.Value == nil || len(*rlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rlr ReplicationListResult) hasNextLink() bool { + return rlr.NextLink != nil && len(*rlr.NextLink) != 0 +} + +// replicationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rlr ReplicationListResult) replicationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rlr.NextLink))) +} + +// ReplicationListResultPage contains a page of Replication values. +type ReplicationListResultPage struct { + fn func(context.Context, ReplicationListResult) (ReplicationListResult, error) + rlr ReplicationListResult +} + +// 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 *ReplicationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationListResultPage.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.rlr) + if err != nil { + return err + } + page.rlr = 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 *ReplicationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ReplicationListResultPage) NotDone() bool { + return !page.rlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ReplicationListResultPage) Response() ReplicationListResult { + return page.rlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ReplicationListResultPage) Values() []Replication { + if page.rlr.IsEmpty() { + return nil + } + return *page.rlr.Value +} + +// Creates a new instance of the ReplicationListResultPage type. +func NewReplicationListResultPage(cur ReplicationListResult, getNextPage func(context.Context, ReplicationListResult) (ReplicationListResult, error)) ReplicationListResultPage { + return ReplicationListResultPage{ + fn: getNextPage, + rlr: cur, + } +} + +// ReplicationProperties the properties of a replication. +type ReplicationProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the replication at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Status - READ-ONLY; The status of the replication at the time the operation was called. + Status *Status `json:"status,omitempty"` + // RegionEndpointEnabled - Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. + RegionEndpointEnabled *bool `json:"regionEndpointEnabled,omitempty"` + // ZoneRedundancy - Whether or not zone redundancy is enabled for this container registry replication. Possible values include: 'ZoneRedundancyEnabled', 'ZoneRedundancyDisabled' + ZoneRedundancy ZoneRedundancy `json:"zoneRedundancy,omitempty"` +} + +// MarshalJSON is the custom marshaler for ReplicationProperties. +func (rp ReplicationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rp.RegionEndpointEnabled != nil { + objectMap["regionEndpointEnabled"] = rp.RegionEndpointEnabled + } + if rp.ZoneRedundancy != "" { + objectMap["zoneRedundancy"] = rp.ZoneRedundancy + } + return json.Marshal(objectMap) +} + +// ReplicationsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ReplicationsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ReplicationsClient) (Replication, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ReplicationsCreateFuture) 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 ReplicationsCreateFuture.Result. +func (future *ReplicationsCreateFuture) result(client ReplicationsClient) (r Replication, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.CreateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsCreateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// ReplicationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ReplicationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ReplicationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ReplicationsDeleteFuture) 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 ReplicationsDeleteFuture.Result. +func (future *ReplicationsDeleteFuture) result(client ReplicationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ReplicationsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ReplicationsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ReplicationsClient) (Replication, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ReplicationsUpdateFuture) 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 ReplicationsUpdateFuture.Result. +func (future *ReplicationsUpdateFuture) result(client ReplicationsClient) (r Replication, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ReplicationsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.UpdateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// ReplicationUpdateParameters the parameters for updating a replication. +type ReplicationUpdateParameters struct { + // Tags - The tags for the replication. + Tags map[string]*string `json:"tags"` + // ReplicationUpdateParametersProperties - The parameters for updating a replication's properties + *ReplicationUpdateParametersProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ReplicationUpdateParameters. +func (rup ReplicationUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rup.Tags != nil { + objectMap["tags"] = rup.Tags + } + if rup.ReplicationUpdateParametersProperties != nil { + objectMap["properties"] = rup.ReplicationUpdateParametersProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ReplicationUpdateParameters struct. +func (rup *ReplicationUpdateParameters) 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 + } + rup.Tags = tags + } + case "properties": + if v != nil { + var replicationUpdateParametersProperties ReplicationUpdateParametersProperties + err = json.Unmarshal(*v, &replicationUpdateParametersProperties) + if err != nil { + return err + } + rup.ReplicationUpdateParametersProperties = &replicationUpdateParametersProperties + } + } + } + + return nil +} + +// ReplicationUpdateParametersProperties ... +type ReplicationUpdateParametersProperties struct { + // RegionEndpointEnabled - Specifies whether the replication's regional endpoint is enabled. Requests will not be routed to a replication whose regional endpoint is disabled, however its data will continue to be synced with other replications. + RegionEndpointEnabled *bool `json:"regionEndpointEnabled,omitempty"` +} + +// Request the request that generated the event. +type Request struct { + // ID - The ID of the request that initiated the event. + ID *string `json:"id,omitempty"` + // Addr - The IP or hostname and possibly port of the client connection that initiated the event. This is the RemoteAddr from the standard http request. + Addr *string `json:"addr,omitempty"` + // Host - The externally accessible hostname of the registry instance, as specified by the http host header on incoming requests. + Host *string `json:"host,omitempty"` + // Method - The request method that generated the event. + Method *string `json:"method,omitempty"` + // Useragent - The user agent header of the request. + Useragent *string `json:"useragent,omitempty"` +} + +// Resource an Azure resource. +type Resource struct { + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. This cannot be changed after the resource is created. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// RetentionPolicy the retention policy for a container registry. +type RetentionPolicy struct { + // Days - The number of days to retain an untagged manifest after which it gets purged. + Days *int32 `json:"days,omitempty"` + // LastUpdatedTime - READ-ONLY; The timestamp when the policy was last updated. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' + Status PolicyStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for RetentionPolicy. +func (rp RetentionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rp.Days != nil { + objectMap["days"] = rp.Days + } + if rp.Status != "" { + objectMap["status"] = rp.Status + } + return json.Marshal(objectMap) +} + +// Run run resource properties +type Run struct { + autorest.Response `json:"-"` + // RunProperties - The properties of a run. + *RunProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Run. +func (r Run) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.RunProperties != nil { + objectMap["properties"] = r.RunProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Run struct. +func (r *Run) 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 runProperties RunProperties + err = json.Unmarshal(*v, &runProperties) + if err != nil { + return err + } + r.RunProperties = &runProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + r.SystemData = &systemData + } + } + } + + return nil +} + +// RunFilter properties that are enabled for Odata querying on runs. +type RunFilter struct { + // RunID - The unique identifier for the run. + RunID *string `json:"runId,omitempty"` + // RunType - The type of run. Possible values include: 'RunTypeQuickBuild', 'RunTypeQuickRun', 'RunTypeAutoBuild', 'RunTypeAutoRun' + RunType RunType `json:"runType,omitempty"` + // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' + Status RunStatus `json:"status,omitempty"` + // CreateTime - The create time for a run. + CreateTime *date.Time `json:"createTime,omitempty"` + // FinishTime - The time the run finished. + FinishTime *date.Time `json:"finishTime,omitempty"` + // OutputImageManifests - The list of comma-separated image manifests that were generated from the run. This is applicable if the run is of + // build type. + OutputImageManifests *string `json:"outputImageManifests,omitempty"` + // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. + IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` + // TaskName - The name of the task that the run corresponds to. + TaskName *string `json:"taskName,omitempty"` + // AgentPoolName - The name of the agent pool that the run corresponds to. + AgentPoolName *string `json:"agentPoolName,omitempty"` +} + +// RunGetLogResult the result of get log link operation. +type RunGetLogResult struct { + autorest.Response `json:"-"` + // LogLink - The link to logs for a run on a azure container registry. + LogLink *string `json:"logLink,omitempty"` + // LogArtifactLink - The link to logs in registry for a run on a azure container registry. + LogArtifactLink *string `json:"logArtifactLink,omitempty"` +} + +// RunListResult collection of runs. +type RunListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]Run `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next set of paged results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RunListResultIterator provides access to a complete listing of Run values. +type RunListResultIterator struct { + i int + page RunListResultPage +} + +// 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 *RunListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultIterator.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 *RunListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RunListResultIterator) 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 RunListResultIterator) Response() RunListResult { + 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 RunListResultIterator) Value() Run { + if !iter.page.NotDone() { + return Run{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RunListResultIterator type. +func NewRunListResultIterator(page RunListResultPage) RunListResultIterator { + return RunListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rlr RunListResult) IsEmpty() bool { + return rlr.Value == nil || len(*rlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rlr RunListResult) hasNextLink() bool { + return rlr.NextLink != nil && len(*rlr.NextLink) != 0 +} + +// runListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rlr RunListResult) runListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rlr.NextLink))) +} + +// RunListResultPage contains a page of Run values. +type RunListResultPage struct { + fn func(context.Context, RunListResult) (RunListResult, error) + rlr RunListResult +} + +// 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 *RunListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RunListResultPage.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.rlr) + if err != nil { + return err + } + page.rlr = 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 *RunListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RunListResultPage) NotDone() bool { + return !page.rlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RunListResultPage) Response() RunListResult { + return page.rlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RunListResultPage) Values() []Run { + if page.rlr.IsEmpty() { + return nil + } + return *page.rlr.Value +} + +// Creates a new instance of the RunListResultPage type. +func NewRunListResultPage(cur RunListResult, getNextPage func(context.Context, RunListResult) (RunListResult, error)) RunListResultPage { + return RunListResultPage{ + fn: getNextPage, + rlr: cur, + } +} + +// RunProperties the properties for a run. +type RunProperties struct { + // RunID - The unique identifier for the run. + RunID *string `json:"runId,omitempty"` + // Status - The current status of the run. Possible values include: 'RunStatusQueued', 'RunStatusStarted', 'RunStatusRunning', 'RunStatusSucceeded', 'RunStatusFailed', 'RunStatusCanceled', 'RunStatusError', 'RunStatusTimeout' + Status RunStatus `json:"status,omitempty"` + // LastUpdatedTime - The last updated time for the run. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // RunType - The type of run. Possible values include: 'RunTypeQuickBuild', 'RunTypeQuickRun', 'RunTypeAutoBuild', 'RunTypeAutoRun' + RunType RunType `json:"runType,omitempty"` + // AgentPoolName - The dedicated agent pool for the run. + AgentPoolName *string `json:"agentPoolName,omitempty"` + // CreateTime - The time the run was scheduled. + CreateTime *date.Time `json:"createTime,omitempty"` + // StartTime - The time the run started. + StartTime *date.Time `json:"startTime,omitempty"` + // FinishTime - The time the run finished. + FinishTime *date.Time `json:"finishTime,omitempty"` + // OutputImages - The list of all images that were generated from the run. This is applicable if the run generates base image dependencies. + OutputImages *[]ImageDescriptor `json:"outputImages,omitempty"` + // Task - The task against which run was scheduled. + Task *string `json:"task,omitempty"` + // ImageUpdateTrigger - The image update trigger that caused the run. This is applicable if the task has base image trigger configured. + ImageUpdateTrigger *ImageUpdateTrigger `json:"imageUpdateTrigger,omitempty"` + // SourceTrigger - The source trigger that caused the run. + SourceTrigger *SourceTriggerDescriptor `json:"sourceTrigger,omitempty"` + // TimerTrigger - The timer trigger that caused the run. + TimerTrigger *TimerTriggerDescriptor `json:"timerTrigger,omitempty"` + // Platform - The platform properties against which the run will happen. + Platform *PlatformProperties `json:"platform,omitempty"` + // AgentConfiguration - The machine configuration of the run agent. + AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` + // SourceRegistryAuth - The scope of the credentials that were used to login to the source registry during this run. + SourceRegistryAuth *string `json:"sourceRegistryAuth,omitempty"` + // CustomRegistries - The list of custom registries that were logged in during this run. + CustomRegistries *[]string `json:"customRegistries,omitempty"` + // RunErrorMessage - READ-ONLY; The error message received from backend systems after the run is scheduled. + RunErrorMessage *string `json:"runErrorMessage,omitempty"` + // UpdateTriggerToken - The update trigger token passed for the Run. + UpdateTriggerToken *string `json:"updateTriggerToken,omitempty"` + // LogArtifact - READ-ONLY; The image description for the log artifact. + LogArtifact *ImageDescriptor `json:"logArtifact,omitempty"` + // ProvisioningState - The provisioning state of a run. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. + IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for RunProperties. +func (rp RunProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rp.RunID != nil { + objectMap["runId"] = rp.RunID + } + if rp.Status != "" { + objectMap["status"] = rp.Status + } + if rp.LastUpdatedTime != nil { + objectMap["lastUpdatedTime"] = rp.LastUpdatedTime + } + if rp.RunType != "" { + objectMap["runType"] = rp.RunType + } + if rp.AgentPoolName != nil { + objectMap["agentPoolName"] = rp.AgentPoolName + } + if rp.CreateTime != nil { + objectMap["createTime"] = rp.CreateTime + } + if rp.StartTime != nil { + objectMap["startTime"] = rp.StartTime + } + if rp.FinishTime != nil { + objectMap["finishTime"] = rp.FinishTime + } + if rp.OutputImages != nil { + objectMap["outputImages"] = rp.OutputImages + } + if rp.Task != nil { + objectMap["task"] = rp.Task + } + if rp.ImageUpdateTrigger != nil { + objectMap["imageUpdateTrigger"] = rp.ImageUpdateTrigger + } + if rp.SourceTrigger != nil { + objectMap["sourceTrigger"] = rp.SourceTrigger + } + if rp.TimerTrigger != nil { + objectMap["timerTrigger"] = rp.TimerTrigger + } + if rp.Platform != nil { + objectMap["platform"] = rp.Platform + } + if rp.AgentConfiguration != nil { + objectMap["agentConfiguration"] = rp.AgentConfiguration + } + if rp.SourceRegistryAuth != nil { + objectMap["sourceRegistryAuth"] = rp.SourceRegistryAuth + } + if rp.CustomRegistries != nil { + objectMap["customRegistries"] = rp.CustomRegistries + } + if rp.UpdateTriggerToken != nil { + objectMap["updateTriggerToken"] = rp.UpdateTriggerToken + } + if rp.ProvisioningState != "" { + objectMap["provisioningState"] = rp.ProvisioningState + } + if rp.IsArchiveEnabled != nil { + objectMap["isArchiveEnabled"] = rp.IsArchiveEnabled + } + return json.Marshal(objectMap) +} + +// BasicRunRequest the request parameters for scheduling a run. +type BasicRunRequest interface { + AsDockerBuildRequest() (*DockerBuildRequest, bool) + AsFileTaskRunRequest() (*FileTaskRunRequest, bool) + AsTaskRunRequest() (*TaskRunRequest, bool) + AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) + AsRunRequest() (*RunRequest, bool) +} + +// RunRequest the request parameters for scheduling a run. +type RunRequest struct { + // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. + IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` + // AgentPoolName - The dedicated agent pool for the run. + AgentPoolName *string `json:"agentPoolName,omitempty"` + // LogTemplate - The template that describes the repository and tag information for run log artifact. + LogTemplate *string `json:"logTemplate,omitempty"` + // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' + Type Type `json:"type,omitempty"` +} + +func unmarshalBasicRunRequest(body []byte) (BasicRunRequest, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeDockerBuildRequest): + var dbr DockerBuildRequest + err := json.Unmarshal(body, &dbr) + return dbr, err + case string(TypeFileTaskRunRequest): + var ftrr FileTaskRunRequest + err := json.Unmarshal(body, &ftrr) + return ftrr, err + case string(TypeTaskRunRequest): + var trr TaskRunRequest + err := json.Unmarshal(body, &trr) + return trr, err + case string(TypeEncodedTaskRunRequest): + var etrr EncodedTaskRunRequest + err := json.Unmarshal(body, &etrr) + return etrr, err + default: + var rr RunRequest + err := json.Unmarshal(body, &rr) + return rr, err + } +} +func unmarshalBasicRunRequestArray(body []byte) ([]BasicRunRequest, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rrArray := make([]BasicRunRequest, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rr, err := unmarshalBasicRunRequest(*rawMessage) + if err != nil { + return nil, err + } + rrArray[index] = rr + } + return rrArray, nil +} + +// MarshalJSON is the custom marshaler for RunRequest. +func (rr RunRequest) MarshalJSON() ([]byte, error) { + rr.Type = TypeRunRequest + objectMap := make(map[string]interface{}) + if rr.IsArchiveEnabled != nil { + objectMap["isArchiveEnabled"] = rr.IsArchiveEnabled + } + if rr.AgentPoolName != nil { + objectMap["agentPoolName"] = rr.AgentPoolName + } + if rr.LogTemplate != nil { + objectMap["logTemplate"] = rr.LogTemplate + } + if rr.Type != "" { + objectMap["type"] = rr.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildRequest is the BasicRunRequest implementation for RunRequest. +func (rr RunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { + return nil, false +} + +// AsFileTaskRunRequest is the BasicRunRequest implementation for RunRequest. +func (rr RunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { + return nil, false +} + +// AsTaskRunRequest is the BasicRunRequest implementation for RunRequest. +func (rr RunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { + return nil, false +} + +// AsEncodedTaskRunRequest is the BasicRunRequest implementation for RunRequest. +func (rr RunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { + return nil, false +} + +// AsRunRequest is the BasicRunRequest implementation for RunRequest. +func (rr RunRequest) AsRunRequest() (*RunRequest, bool) { + return &rr, true +} + +// AsBasicRunRequest is the BasicRunRequest implementation for RunRequest. +func (rr RunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { + return &rr, true +} + +// RunsCancelFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RunsCancelFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RunsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RunsCancelFuture) 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 RunsCancelFuture.Result. +func (future *RunsCancelFuture) result(client RunsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsCancelFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.RunsCancelFuture") + return + } + ar.Response = future.Response() + return +} + +// RunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RunsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RunsClient) (Run, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RunsUpdateFuture) 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 RunsUpdateFuture.Result. +func (future *RunsUpdateFuture) result(client RunsClient) (r Run, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.RunsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.UpdateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsUpdateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RunUpdateParameters the set of run properties that can be updated. +type RunUpdateParameters struct { + // IsArchiveEnabled - The value that indicates whether archiving is enabled or not. + IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` +} + +// ScopeMap an object that represents a scope map for a container registry. +type ScopeMap struct { + autorest.Response `json:"-"` + // ScopeMapProperties - The properties of the scope map. + *ScopeMapProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScopeMap. +func (sm ScopeMap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sm.ScopeMapProperties != nil { + objectMap["properties"] = sm.ScopeMapProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ScopeMap struct. +func (sm *ScopeMap) 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 scopeMapProperties ScopeMapProperties + err = json.Unmarshal(*v, &scopeMapProperties) + if err != nil { + return err + } + sm.ScopeMapProperties = &scopeMapProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sm.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sm.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sm.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sm.SystemData = &systemData + } + } + } + + return nil +} + +// ScopeMapListResult the result of a request to list scope maps for a container registry. +type ScopeMapListResult struct { + autorest.Response `json:"-"` + // Value - The list of scope maps. Since this list may be incomplete, the nextLink field should be used to request the next list of scope maps. + Value *[]ScopeMap `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of scope maps. + NextLink *string `json:"nextLink,omitempty"` +} + +// ScopeMapListResultIterator provides access to a complete listing of ScopeMap values. +type ScopeMapListResultIterator struct { + i int + page ScopeMapListResultPage +} + +// 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 *ScopeMapListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapListResultIterator.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 *ScopeMapListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ScopeMapListResultIterator) 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 ScopeMapListResultIterator) Response() ScopeMapListResult { + 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 ScopeMapListResultIterator) Value() ScopeMap { + if !iter.page.NotDone() { + return ScopeMap{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ScopeMapListResultIterator type. +func NewScopeMapListResultIterator(page ScopeMapListResultPage) ScopeMapListResultIterator { + return ScopeMapListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (smlr ScopeMapListResult) IsEmpty() bool { + return smlr.Value == nil || len(*smlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (smlr ScopeMapListResult) hasNextLink() bool { + return smlr.NextLink != nil && len(*smlr.NextLink) != 0 +} + +// scopeMapListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (smlr ScopeMapListResult) scopeMapListResultPreparer(ctx context.Context) (*http.Request, error) { + if !smlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(smlr.NextLink))) +} + +// ScopeMapListResultPage contains a page of ScopeMap values. +type ScopeMapListResultPage struct { + fn func(context.Context, ScopeMapListResult) (ScopeMapListResult, error) + smlr ScopeMapListResult +} + +// 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 *ScopeMapListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.smlr) + if err != nil { + return err + } + page.smlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ScopeMapListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ScopeMapListResultPage) NotDone() bool { + return !page.smlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ScopeMapListResultPage) Response() ScopeMapListResult { + return page.smlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ScopeMapListResultPage) Values() []ScopeMap { + if page.smlr.IsEmpty() { + return nil + } + return *page.smlr.Value +} + +// Creates a new instance of the ScopeMapListResultPage type. +func NewScopeMapListResultPage(cur ScopeMapListResult, getNextPage func(context.Context, ScopeMapListResult) (ScopeMapListResult, error)) ScopeMapListResultPage { + return ScopeMapListResultPage{ + fn: getNextPage, + smlr: cur, + } +} + +// ScopeMapProperties the properties of a scope map. +type ScopeMapProperties struct { + // Description - The user friendly description of the scope map. + Description *string `json:"description,omitempty"` + // Type - READ-ONLY; The type of the scope map. E.g. BuildIn scope map. + Type *string `json:"type,omitempty"` + // CreationDate - READ-ONLY; The creation date of scope map. + CreationDate *date.Time `json:"creationDate,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Actions - The list of scoped permissions for registry artifacts. + // E.g. repositories/repository-name/content/read, + // repositories/repository-name/metadata/write + Actions *[]string `json:"actions,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScopeMapProperties. +func (smp ScopeMapProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smp.Description != nil { + objectMap["description"] = smp.Description + } + if smp.Actions != nil { + objectMap["actions"] = smp.Actions + } + return json.Marshal(objectMap) +} + +// ScopeMapPropertiesUpdateParameters the update parameters for scope map properties. +type ScopeMapPropertiesUpdateParameters struct { + // Description - The user friendly description of the scope map. + Description *string `json:"description,omitempty"` + // Actions - The list of scope permissions for registry artifacts. + // E.g. repositories/repository-name/pull, + // repositories/repository-name/delete + Actions *[]string `json:"actions,omitempty"` +} + +// ScopeMapsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ScopeMapsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ScopeMapsClient) (ScopeMap, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ScopeMapsCreateFuture) 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 ScopeMapsCreateFuture.Result. +func (future *ScopeMapsCreateFuture) result(client ScopeMapsClient) (sm ScopeMap, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sm.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { + sm, err = client.CreateResponder(sm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsCreateFuture", "Result", sm.Response.Response, "Failure responding to request") + } + } + return +} + +// ScopeMapsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ScopeMapsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ScopeMapsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ScopeMapsDeleteFuture) 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 ScopeMapsDeleteFuture.Result. +func (future *ScopeMapsDeleteFuture) result(client ScopeMapsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ScopeMapsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ScopeMapsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ScopeMapsClient) (ScopeMap, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ScopeMapsUpdateFuture) 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 ScopeMapsUpdateFuture.Result. +func (future *ScopeMapsUpdateFuture) result(client ScopeMapsClient) (sm ScopeMap, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sm.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.ScopeMapsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { + sm, err = client.UpdateResponder(sm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsUpdateFuture", "Result", sm.Response.Response, "Failure responding to request") + } + } + return +} + +// ScopeMapUpdateParameters the properties for updating the scope map. +type ScopeMapUpdateParameters struct { + // ScopeMapPropertiesUpdateParameters - The update parameters for scope map properties. + *ScopeMapPropertiesUpdateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ScopeMapUpdateParameters. +func (smup ScopeMapUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if smup.ScopeMapPropertiesUpdateParameters != nil { + objectMap["properties"] = smup.ScopeMapPropertiesUpdateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ScopeMapUpdateParameters struct. +func (smup *ScopeMapUpdateParameters) 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 scopeMapPropertiesUpdateParameters ScopeMapPropertiesUpdateParameters + err = json.Unmarshal(*v, &scopeMapPropertiesUpdateParameters) + if err != nil { + return err + } + smup.ScopeMapPropertiesUpdateParameters = &scopeMapPropertiesUpdateParameters + } + } + } + + return nil +} + +// SecretObject describes the properties of a secret object value. +type SecretObject struct { + // Value - The value of the secret. The format of this value will be determined + // based on the type of the secret object. If the type is Opaque, the value will be + // used as is without any modification. + Value *string `json:"value,omitempty"` + // Type - The type of the secret object which determines how the value of the secret object has to be + // interpreted. Possible values include: 'SecretObjectTypeOpaque', 'SecretObjectTypeVaultsecret' + Type SecretObjectType `json:"type,omitempty"` +} + +// SetValue the properties of a overridable value that can be passed to a task template. +type SetValue struct { + // Name - The name of the overridable value. + Name *string `json:"name,omitempty"` + // Value - The overridable value. + Value *string `json:"value,omitempty"` + // IsSecret - Flag to indicate whether the value represents a secret or not. + IsSecret *bool `json:"isSecret,omitempty"` +} + +// Sku the SKU of a container registry. +type Sku struct { + // Name - The SKU name of the container registry. Required for registry creation. Possible values include: 'SkuNameClassic', 'SkuNameBasic', 'SkuNameStandard', 'SkuNamePremium' + Name SkuName `json:"name,omitempty"` + // Tier - READ-ONLY; The SKU tier based on the SKU name. Possible values include: 'SkuTierClassic', 'SkuTierBasic', 'SkuTierStandard', 'SkuTierPremium' + Tier SkuTier `json:"tier,omitempty"` +} + +// MarshalJSON is the custom marshaler for Sku. +func (s Sku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.Name != "" { + objectMap["name"] = s.Name + } + return json.Marshal(objectMap) +} + +// Source the registry node that generated the event. Put differently, while the actor initiates the event, +// the source generates it. +type Source struct { + // Addr - The IP or hostname and the port of the registry node that generated the event. Generally, this will be resolved by os.Hostname() along with the running port. + Addr *string `json:"addr,omitempty"` + // InstanceID - The running instance of an application. Changes after each restart. + InstanceID *string `json:"instanceID,omitempty"` +} + +// SourceProperties the properties of the source code repository. +type SourceProperties struct { + // SourceControlType - The type of source control service. Possible values include: 'SourceControlTypeGithub', 'SourceControlTypeVisualStudioTeamService' + SourceControlType SourceControlType `json:"sourceControlType,omitempty"` + // RepositoryURL - The full URL to the source code repository + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // Branch - The branch name of the source code. + Branch *string `json:"branch,omitempty"` + // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up + // webhooks for notifications. + SourceControlAuthProperties *AuthInfo `json:"sourceControlAuthProperties,omitempty"` +} + +// SourceRegistryCredentials describes the credential parameters for accessing the source registry. +type SourceRegistryCredentials struct { + // LoginMode - The authentication mode which determines the source registry login scope. The credentials for the source registry + // will be generated using the given scope. These credentials will be used to login to + // the source registry during the run. Possible values include: 'SourceRegistryLoginModeNone', 'SourceRegistryLoginModeDefault' + LoginMode SourceRegistryLoginMode `json:"loginMode,omitempty"` +} + +// SourceTrigger the properties of a source based trigger. +type SourceTrigger struct { + // SourceRepository - The properties that describes the source(code) for the task. + SourceRepository *SourceProperties `json:"sourceRepository,omitempty"` + // SourceTriggerEvents - The source event corresponding to the trigger. + SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` + // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' + Status TriggerStatus `json:"status,omitempty"` + // Name - The name of the trigger. + Name *string `json:"name,omitempty"` +} + +// SourceTriggerDescriptor the source trigger that caused a run. +type SourceTriggerDescriptor struct { + // ID - The unique ID of the trigger. + ID *string `json:"id,omitempty"` + // EventType - The event type of the trigger. + EventType *string `json:"eventType,omitempty"` + // CommitID - The unique ID that identifies a commit. + CommitID *string `json:"commitId,omitempty"` + // PullRequestID - The unique ID that identifies pull request. + PullRequestID *string `json:"pullRequestId,omitempty"` + // RepositoryURL - The repository URL. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // BranchName - The branch name in the repository. + BranchName *string `json:"branchName,omitempty"` + // ProviderType - The source control provider type. + ProviderType *string `json:"providerType,omitempty"` +} + +// SourceTriggerUpdateParameters the properties for updating a source based trigger. +type SourceTriggerUpdateParameters struct { + // SourceRepository - The properties that describes the source(code) for the task. + SourceRepository *SourceUpdateParameters `json:"sourceRepository,omitempty"` + // SourceTriggerEvents - The source event corresponding to the trigger. + SourceTriggerEvents *[]SourceTriggerEvent `json:"sourceTriggerEvents,omitempty"` + // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' + Status TriggerStatus `json:"status,omitempty"` + // Name - The name of the trigger. + Name *string `json:"name,omitempty"` +} + +// SourceUpdateParameters the properties for updating the source code repository. +type SourceUpdateParameters struct { + // SourceControlType - The type of source control service. Possible values include: 'SourceControlTypeGithub', 'SourceControlTypeVisualStudioTeamService' + SourceControlType SourceControlType `json:"sourceControlType,omitempty"` + // RepositoryURL - The full URL to the source code repository + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // Branch - The branch name of the source code. + Branch *string `json:"branch,omitempty"` + // SourceControlAuthProperties - The authorization properties for accessing the source code repository and to set up + // webhooks for notifications. + SourceControlAuthProperties *AuthInfoUpdateParameters `json:"sourceControlAuthProperties,omitempty"` +} + +// SourceUploadDefinition the properties of a response to source upload request. +type SourceUploadDefinition struct { + autorest.Response `json:"-"` + // UploadURL - The URL where the client can upload the source. + UploadURL *string `json:"uploadUrl,omitempty"` + // RelativePath - The relative path to the source. This is used to submit the subsequent queue build request. + RelativePath *string `json:"relativePath,omitempty"` +} + +// Status the status of an Azure resource at the time the operation was called. +type Status struct { + // DisplayStatus - READ-ONLY; The short label for the status. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Message - READ-ONLY; The detailed message for the status, including alerts and error messages. + Message *string `json:"message,omitempty"` + // Timestamp - READ-ONLY; The timestamp when the status was changed to the current value. + Timestamp *date.Time `json:"timestamp,omitempty"` +} + +// MarshalJSON is the custom marshaler for Status. +func (s Status) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// StatusDetailProperties the status detail properties of the connected registry. +type StatusDetailProperties struct { + // Type - READ-ONLY; The component of the connected registry corresponding to the status. + Type *string `json:"type,omitempty"` + // Code - READ-ONLY; The code of the status. + Code *string `json:"code,omitempty"` + // Description - READ-ONLY; The description of the status. + Description *string `json:"description,omitempty"` + // Timestamp - READ-ONLY; The timestamp of the status. + Timestamp *date.Time `json:"timestamp,omitempty"` + // CorrelationID - READ-ONLY; The correlation ID of the status. + CorrelationID *string `json:"correlationId,omitempty"` +} + +// MarshalJSON is the custom marshaler for StatusDetailProperties. +func (sdp StatusDetailProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SyncProperties the sync properties of the connected registry with its parent. +type SyncProperties struct { + // TokenID - The resource ID of the ACR token used to authenticate the connected registry to its parent during sync. + TokenID *string `json:"tokenId,omitempty"` + // Schedule - The cron expression indicating the schedule that the connected registry will sync with its parent. + Schedule *string `json:"schedule,omitempty"` + // SyncWindow - The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + SyncWindow *string `json:"syncWindow,omitempty"` + // MessageTTL - The period of time for which a message is available to sync before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + MessageTTL *string `json:"messageTtl,omitempty"` + // LastSyncTime - READ-ONLY; The last time a sync occurred between the connected registry and its parent. + LastSyncTime *date.Time `json:"lastSyncTime,omitempty"` + // GatewayEndpoint - READ-ONLY; The gateway endpoint used by the connected registry to communicate with its parent. + GatewayEndpoint *string `json:"gatewayEndpoint,omitempty"` +} + +// MarshalJSON is the custom marshaler for SyncProperties. +func (sp SyncProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.TokenID != nil { + objectMap["tokenId"] = sp.TokenID + } + if sp.Schedule != nil { + objectMap["schedule"] = sp.Schedule + } + if sp.SyncWindow != nil { + objectMap["syncWindow"] = sp.SyncWindow + } + if sp.MessageTTL != nil { + objectMap["messageTtl"] = sp.MessageTTL + } + return json.Marshal(objectMap) +} + +// SyncUpdateProperties the parameters for updating the sync properties of the connected registry with its +// parent. +type SyncUpdateProperties struct { + // Schedule - The cron expression indicating the schedule that the connected registry will sync with its parent. + Schedule *string `json:"schedule,omitempty"` + // SyncWindow - The time window during which sync is enabled for each schedule occurrence. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + SyncWindow *string `json:"syncWindow,omitempty"` + // MessageTTL - The period of time for which a message is available to sync before it is expired. Specify the duration using the format P[n]Y[n]M[n]DT[n]H[n]M[n]S as per ISO8601. + MessageTTL *string `json:"messageTtl,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: 'LastModifiedByTypeUser', 'LastModifiedByTypeApplication', 'LastModifiedByTypeManagedIdentity', 'LastModifiedByTypeKey' + LastModifiedByType LastModifiedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource modification (UTC). + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// Target the target of the event. +type Target struct { + // MediaType - The MIME type of the referenced object. + MediaType *string `json:"mediaType,omitempty"` + // Size - The number of bytes of the content. Same as Length field. + Size *int64 `json:"size,omitempty"` + // Digest - The digest of the content, as defined by the Registry V2 HTTP API Specification. + Digest *string `json:"digest,omitempty"` + // Length - The number of bytes of the content. Same as Size field. + Length *int64 `json:"length,omitempty"` + // Repository - The repository name. + Repository *string `json:"repository,omitempty"` + // URL - The direct URL to the content. + URL *string `json:"url,omitempty"` + // Tag - The tag name. + Tag *string `json:"tag,omitempty"` + // Name - The name of the artifact. + Name *string `json:"name,omitempty"` + // Version - The version of the artifact. + Version *string `json:"version,omitempty"` +} + +// Task the task that has the ARM resource and task properties. +// The task will have all information to schedule a run against it. +type Task struct { + autorest.Response `json:"-"` + // Identity - Identity for the resource. + Identity *IdentityProperties `json:"identity,omitempty"` + // TaskProperties - The properties of a task. + *TaskProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. This cannot be changed after the resource is created. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Task. +func (t Task) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.Identity != nil { + objectMap["identity"] = t.Identity + } + if t.TaskProperties != nil { + objectMap["properties"] = t.TaskProperties + } + 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 Task struct. +func (t *Task) 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 IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + t.Identity = &identity + } + case "properties": + if v != nil { + var taskProperties TaskProperties + err = json.Unmarshal(*v, &taskProperties) + if err != nil { + return err + } + t.TaskProperties = &taskProperties + } + 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 + } + 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + t.SystemData = &systemData + } + } + } + + return nil +} + +// TaskListResult the collection of tasks. +type TaskListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]Task `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next set of paged results. + NextLink *string `json:"nextLink,omitempty"` +} + +// TaskListResultIterator provides access to a complete listing of Task values. +type TaskListResultIterator struct { + i int + page TaskListResultPage +} + +// 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 *TaskListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultIterator.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 *TaskListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TaskListResultIterator) 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 TaskListResultIterator) Response() TaskListResult { + 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 TaskListResultIterator) Value() Task { + if !iter.page.NotDone() { + return Task{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TaskListResultIterator type. +func NewTaskListResultIterator(page TaskListResultPage) TaskListResultIterator { + return TaskListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (tlr TaskListResult) IsEmpty() bool { + return tlr.Value == nil || len(*tlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (tlr TaskListResult) hasNextLink() bool { + return tlr.NextLink != nil && len(*tlr.NextLink) != 0 +} + +// taskListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tlr TaskListResult) taskListResultPreparer(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))) +} + +// TaskListResultPage contains a page of Task values. +type TaskListResultPage struct { + fn func(context.Context, TaskListResult) (TaskListResult, error) + tlr TaskListResult +} + +// 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 *TaskListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskListResultPage.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 *TaskListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TaskListResultPage) NotDone() bool { + return !page.tlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TaskListResultPage) Response() TaskListResult { + return page.tlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TaskListResultPage) Values() []Task { + if page.tlr.IsEmpty() { + return nil + } + return *page.tlr.Value +} + +// Creates a new instance of the TaskListResultPage type. +func NewTaskListResultPage(cur TaskListResult, getNextPage func(context.Context, TaskListResult) (TaskListResult, error)) TaskListResultPage { + return TaskListResultPage{ + fn: getNextPage, + tlr: cur, + } +} + +// TaskProperties the properties of a task. +type TaskProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the task. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // CreationDate - READ-ONLY; The creation date of task. + CreationDate *date.Time `json:"creationDate,omitempty"` + // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' + Status TaskStatus `json:"status,omitempty"` + // Platform - The platform properties against which the run has to happen. + Platform *PlatformProperties `json:"platform,omitempty"` + // AgentConfiguration - The machine configuration of the run agent. + AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` + // AgentPoolName - The dedicated agent pool for the task. + AgentPoolName *string `json:"agentPoolName,omitempty"` + // Timeout - Run timeout in seconds. + Timeout *int32 `json:"timeout,omitempty"` + // Step - The properties of a task step. + Step BasicTaskStepProperties `json:"step,omitempty"` + // Trigger - The properties that describe all triggers for the task. + Trigger *TriggerProperties `json:"trigger,omitempty"` + // Credentials - The properties that describes a set of credentials that will be used when this run is invoked. + Credentials *Credentials `json:"credentials,omitempty"` + // LogTemplate - The template that describes the repository and tag information for run log artifact. + LogTemplate *string `json:"logTemplate,omitempty"` + // IsSystemTask - The value of this property indicates whether the task resource is system task or not. + IsSystemTask *bool `json:"isSystemTask,omitempty"` +} + +// MarshalJSON is the custom marshaler for TaskProperties. +func (tp TaskProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tp.Status != "" { + objectMap["status"] = tp.Status + } + if tp.Platform != nil { + objectMap["platform"] = tp.Platform + } + if tp.AgentConfiguration != nil { + objectMap["agentConfiguration"] = tp.AgentConfiguration + } + if tp.AgentPoolName != nil { + objectMap["agentPoolName"] = tp.AgentPoolName + } + if tp.Timeout != nil { + objectMap["timeout"] = tp.Timeout + } + objectMap["step"] = tp.Step + if tp.Trigger != nil { + objectMap["trigger"] = tp.Trigger + } + if tp.Credentials != nil { + objectMap["credentials"] = tp.Credentials + } + if tp.LogTemplate != nil { + objectMap["logTemplate"] = tp.LogTemplate + } + if tp.IsSystemTask != nil { + objectMap["isSystemTask"] = tp.IsSystemTask + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TaskProperties struct. +func (tp *TaskProperties) 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 "provisioningState": + if v != nil { + var provisioningState ProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + tp.ProvisioningState = provisioningState + } + case "creationDate": + if v != nil { + var creationDate date.Time + err = json.Unmarshal(*v, &creationDate) + if err != nil { + return err + } + tp.CreationDate = &creationDate + } + case "status": + if v != nil { + var status TaskStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + tp.Status = status + } + case "platform": + if v != nil { + var platform PlatformProperties + err = json.Unmarshal(*v, &platform) + if err != nil { + return err + } + tp.Platform = &platform + } + case "agentConfiguration": + if v != nil { + var agentConfiguration AgentProperties + err = json.Unmarshal(*v, &agentConfiguration) + if err != nil { + return err + } + tp.AgentConfiguration = &agentConfiguration + } + case "agentPoolName": + if v != nil { + var agentPoolName string + err = json.Unmarshal(*v, &agentPoolName) + if err != nil { + return err + } + tp.AgentPoolName = &agentPoolName + } + case "timeout": + if v != nil { + var timeout int32 + err = json.Unmarshal(*v, &timeout) + if err != nil { + return err + } + tp.Timeout = &timeout + } + case "step": + if v != nil { + step, err := unmarshalBasicTaskStepProperties(*v) + if err != nil { + return err + } + tp.Step = step + } + case "trigger": + if v != nil { + var trigger TriggerProperties + err = json.Unmarshal(*v, &trigger) + if err != nil { + return err + } + tp.Trigger = &trigger + } + case "credentials": + if v != nil { + var credentials Credentials + err = json.Unmarshal(*v, &credentials) + if err != nil { + return err + } + tp.Credentials = &credentials + } + case "logTemplate": + if v != nil { + var logTemplate string + err = json.Unmarshal(*v, &logTemplate) + if err != nil { + return err + } + tp.LogTemplate = &logTemplate + } + case "isSystemTask": + if v != nil { + var isSystemTask bool + err = json.Unmarshal(*v, &isSystemTask) + if err != nil { + return err + } + tp.IsSystemTask = &isSystemTask + } + } + } + + return nil +} + +// TaskPropertiesUpdateParameters the properties for updating a task. +type TaskPropertiesUpdateParameters struct { + // Status - The current status of task. Possible values include: 'TaskStatusDisabled', 'TaskStatusEnabled' + Status TaskStatus `json:"status,omitempty"` + // Platform - The platform properties against which the run has to happen. + Platform *PlatformUpdateParameters `json:"platform,omitempty"` + // AgentConfiguration - The machine configuration of the run agent. + AgentConfiguration *AgentProperties `json:"agentConfiguration,omitempty"` + // AgentPoolName - The dedicated agent pool for the task. + AgentPoolName *string `json:"agentPoolName,omitempty"` + // Timeout - Run timeout in seconds. + Timeout *int32 `json:"timeout,omitempty"` + // Step - The properties for updating a task step. + Step BasicTaskStepUpdateParameters `json:"step,omitempty"` + // Trigger - The properties for updating trigger properties. + Trigger *TriggerUpdateParameters `json:"trigger,omitempty"` + // Credentials - The parameters that describes a set of credentials that will be used when this run is invoked. + Credentials *Credentials `json:"credentials,omitempty"` + // LogTemplate - The template that describes the repository and tag information for run log artifact. + LogTemplate *string `json:"logTemplate,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for TaskPropertiesUpdateParameters struct. +func (tpup *TaskPropertiesUpdateParameters) 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 "status": + if v != nil { + var status TaskStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + tpup.Status = status + } + case "platform": + if v != nil { + var platform PlatformUpdateParameters + err = json.Unmarshal(*v, &platform) + if err != nil { + return err + } + tpup.Platform = &platform + } + case "agentConfiguration": + if v != nil { + var agentConfiguration AgentProperties + err = json.Unmarshal(*v, &agentConfiguration) + if err != nil { + return err + } + tpup.AgentConfiguration = &agentConfiguration + } + case "agentPoolName": + if v != nil { + var agentPoolName string + err = json.Unmarshal(*v, &agentPoolName) + if err != nil { + return err + } + tpup.AgentPoolName = &agentPoolName + } + case "timeout": + if v != nil { + var timeout int32 + err = json.Unmarshal(*v, &timeout) + if err != nil { + return err + } + tpup.Timeout = &timeout + } + case "step": + if v != nil { + step, err := unmarshalBasicTaskStepUpdateParameters(*v) + if err != nil { + return err + } + tpup.Step = step + } + case "trigger": + if v != nil { + var trigger TriggerUpdateParameters + err = json.Unmarshal(*v, &trigger) + if err != nil { + return err + } + tpup.Trigger = &trigger + } + case "credentials": + if v != nil { + var credentials Credentials + err = json.Unmarshal(*v, &credentials) + if err != nil { + return err + } + tpup.Credentials = &credentials + } + case "logTemplate": + if v != nil { + var logTemplate string + err = json.Unmarshal(*v, &logTemplate) + if err != nil { + return err + } + tpup.LogTemplate = &logTemplate + } + } + } + + return nil +} + +// TaskRun the task run that has the ARM resource and properties. +// The task run will have the information of request and result of a run. +type TaskRun struct { + autorest.Response `json:"-"` + // Identity - Identity for the resource. + Identity *IdentityProperties `json:"identity,omitempty"` + // TaskRunProperties - The properties associated with the task run, i.e., request and result of the run + *TaskRunProperties `json:"properties,omitempty"` + // Location - The location of the resource + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TaskRun. +func (tr TaskRun) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Identity != nil { + objectMap["identity"] = tr.Identity + } + if tr.TaskRunProperties != nil { + objectMap["properties"] = tr.TaskRunProperties + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TaskRun struct. +func (tr *TaskRun) 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 IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + tr.Identity = &identity + } + case "properties": + if v != nil { + var taskRunProperties TaskRunProperties + err = json.Unmarshal(*v, &taskRunProperties) + if err != nil { + return err + } + tr.TaskRunProperties = &taskRunProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + tr.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tr.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + tr.SystemData = &systemData + } + } + } + + return nil +} + +// TaskRunListResult the collection of task runs. +type TaskRunListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]TaskRun `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next set of paged results. + NextLink *string `json:"nextLink,omitempty"` +} + +// TaskRunListResultIterator provides access to a complete listing of TaskRun values. +type TaskRunListResultIterator struct { + i int + page TaskRunListResultPage +} + +// 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 *TaskRunListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultIterator.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 *TaskRunListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TaskRunListResultIterator) 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 TaskRunListResultIterator) Response() TaskRunListResult { + 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 TaskRunListResultIterator) Value() TaskRun { + if !iter.page.NotDone() { + return TaskRun{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TaskRunListResultIterator type. +func NewTaskRunListResultIterator(page TaskRunListResultPage) TaskRunListResultIterator { + return TaskRunListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (trlr TaskRunListResult) IsEmpty() bool { + return trlr.Value == nil || len(*trlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (trlr TaskRunListResult) hasNextLink() bool { + return trlr.NextLink != nil && len(*trlr.NextLink) != 0 +} + +// taskRunListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (trlr TaskRunListResult) taskRunListResultPreparer(ctx context.Context) (*http.Request, error) { + if !trlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(trlr.NextLink))) +} + +// TaskRunListResultPage contains a page of TaskRun values. +type TaskRunListResultPage struct { + fn func(context.Context, TaskRunListResult) (TaskRunListResult, error) + trlr TaskRunListResult +} + +// 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 *TaskRunListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.trlr) + if err != nil { + return err + } + page.trlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *TaskRunListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TaskRunListResultPage) NotDone() bool { + return !page.trlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TaskRunListResultPage) Response() TaskRunListResult { + return page.trlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TaskRunListResultPage) Values() []TaskRun { + if page.trlr.IsEmpty() { + return nil + } + return *page.trlr.Value +} + +// Creates a new instance of the TaskRunListResultPage type. +func NewTaskRunListResultPage(cur TaskRunListResult, getNextPage func(context.Context, TaskRunListResult) (TaskRunListResult, error)) TaskRunListResultPage { + return TaskRunListResultPage{ + fn: getNextPage, + trlr: cur, + } +} + +// TaskRunProperties the properties of task run. +type TaskRunProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of this task run. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // RunRequest - The request (parameters) for the run + RunRequest BasicRunRequest `json:"runRequest,omitempty"` + // RunResult - READ-ONLY; The result of this task run + RunResult *Run `json:"runResult,omitempty"` + // ForceUpdateTag - How the run should be forced to rerun even if the run request configuration has not changed + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` +} + +// MarshalJSON is the custom marshaler for TaskRunProperties. +func (trp TaskRunProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["runRequest"] = trp.RunRequest + if trp.ForceUpdateTag != nil { + objectMap["forceUpdateTag"] = trp.ForceUpdateTag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TaskRunProperties struct. +func (trp *TaskRunProperties) 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 "provisioningState": + if v != nil { + var provisioningState ProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + trp.ProvisioningState = provisioningState + } + case "runRequest": + if v != nil { + runRequest, err := unmarshalBasicRunRequest(*v) + if err != nil { + return err + } + trp.RunRequest = runRequest + } + case "runResult": + if v != nil { + var runResult Run + err = json.Unmarshal(*v, &runResult) + if err != nil { + return err + } + trp.RunResult = &runResult + } + case "forceUpdateTag": + if v != nil { + var forceUpdateTag string + err = json.Unmarshal(*v, &forceUpdateTag) + if err != nil { + return err + } + trp.ForceUpdateTag = &forceUpdateTag + } + } + } + + return nil +} + +// TaskRunPropertiesUpdateParameters the properties of a task run update parameters. +type TaskRunPropertiesUpdateParameters struct { + // RunRequest - The request (parameters) for the new run + RunRequest BasicRunRequest `json:"runRequest,omitempty"` + // ForceUpdateTag - How the run should be forced to rerun even if the run request configuration has not changed + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for TaskRunPropertiesUpdateParameters struct. +func (trpup *TaskRunPropertiesUpdateParameters) 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 "runRequest": + if v != nil { + runRequest, err := unmarshalBasicRunRequest(*v) + if err != nil { + return err + } + trpup.RunRequest = runRequest + } + case "forceUpdateTag": + if v != nil { + var forceUpdateTag string + err = json.Unmarshal(*v, &forceUpdateTag) + if err != nil { + return err + } + trpup.ForceUpdateTag = &forceUpdateTag + } + } + } + + return nil +} + +// TaskRunRequest the parameters for a task run request. +type TaskRunRequest struct { + // TaskID - The resource ID of task against which run has to be queued. + TaskID *string `json:"taskId,omitempty"` + // OverrideTaskStepProperties - Set of overridable parameters that can be passed when running a Task. + OverrideTaskStepProperties *OverrideTaskStepProperties `json:"overrideTaskStepProperties,omitempty"` + // IsArchiveEnabled - The value that indicates whether archiving is enabled for the run or not. + IsArchiveEnabled *bool `json:"isArchiveEnabled,omitempty"` + // AgentPoolName - The dedicated agent pool for the run. + AgentPoolName *string `json:"agentPoolName,omitempty"` + // LogTemplate - The template that describes the repository and tag information for run log artifact. + LogTemplate *string `json:"logTemplate,omitempty"` + // Type - Possible values include: 'TypeRunRequest', 'TypeDockerBuildRequest', 'TypeFileTaskRunRequest', 'TypeTaskRunRequest', 'TypeEncodedTaskRunRequest' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TaskRunRequest. +func (trr TaskRunRequest) MarshalJSON() ([]byte, error) { + trr.Type = TypeTaskRunRequest + objectMap := make(map[string]interface{}) + if trr.TaskID != nil { + objectMap["taskId"] = trr.TaskID + } + if trr.OverrideTaskStepProperties != nil { + objectMap["overrideTaskStepProperties"] = trr.OverrideTaskStepProperties + } + if trr.IsArchiveEnabled != nil { + objectMap["isArchiveEnabled"] = trr.IsArchiveEnabled + } + if trr.AgentPoolName != nil { + objectMap["agentPoolName"] = trr.AgentPoolName + } + if trr.LogTemplate != nil { + objectMap["logTemplate"] = trr.LogTemplate + } + if trr.Type != "" { + objectMap["type"] = trr.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildRequest is the BasicRunRequest implementation for TaskRunRequest. +func (trr TaskRunRequest) AsDockerBuildRequest() (*DockerBuildRequest, bool) { + return nil, false +} + +// AsFileTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. +func (trr TaskRunRequest) AsFileTaskRunRequest() (*FileTaskRunRequest, bool) { + return nil, false +} + +// AsTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. +func (trr TaskRunRequest) AsTaskRunRequest() (*TaskRunRequest, bool) { + return &trr, true +} + +// AsEncodedTaskRunRequest is the BasicRunRequest implementation for TaskRunRequest. +func (trr TaskRunRequest) AsEncodedTaskRunRequest() (*EncodedTaskRunRequest, bool) { + return nil, false +} + +// AsRunRequest is the BasicRunRequest implementation for TaskRunRequest. +func (trr TaskRunRequest) AsRunRequest() (*RunRequest, bool) { + return nil, false +} + +// AsBasicRunRequest is the BasicRunRequest implementation for TaskRunRequest. +func (trr TaskRunRequest) AsBasicRunRequest() (BasicRunRequest, bool) { + return &trr, true +} + +// TaskRunsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TaskRunsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TaskRunsClient) (TaskRun, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TaskRunsCreateFuture) 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 TaskRunsCreateFuture.Result. +func (future *TaskRunsCreateFuture) result(client TaskRunsClient) (tr TaskRun, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + tr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { + tr, err = client.CreateResponder(tr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsCreateFuture", "Result", tr.Response.Response, "Failure responding to request") + } + } + return +} + +// TaskRunsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TaskRunsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TaskRunsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TaskRunsDeleteFuture) 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 TaskRunsDeleteFuture.Result. +func (future *TaskRunsDeleteFuture) result(client TaskRunsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// TaskRunsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TaskRunsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TaskRunsClient) (TaskRun, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TaskRunsUpdateFuture) 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 TaskRunsUpdateFuture.Result. +func (future *TaskRunsUpdateFuture) result(client TaskRunsClient) (tr TaskRun, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + tr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.TaskRunsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { + tr, err = client.UpdateResponder(tr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsUpdateFuture", "Result", tr.Response.Response, "Failure responding to request") + } + } + return +} + +// TaskRunUpdateParameters the parameters for updating a task run. +type TaskRunUpdateParameters struct { + // Identity - Identity for the resource. + Identity *IdentityProperties `json:"identity,omitempty"` + // TaskRunPropertiesUpdateParameters - The properties for updating a task run. + *TaskRunPropertiesUpdateParameters `json:"properties,omitempty"` + // Location - The location of the resource + Location *string `json:"location,omitempty"` + // Tags - The ARM resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TaskRunUpdateParameters. +func (trup TaskRunUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if trup.Identity != nil { + objectMap["identity"] = trup.Identity + } + if trup.TaskRunPropertiesUpdateParameters != nil { + objectMap["properties"] = trup.TaskRunPropertiesUpdateParameters + } + if trup.Location != nil { + objectMap["location"] = trup.Location + } + if trup.Tags != nil { + objectMap["tags"] = trup.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TaskRunUpdateParameters struct. +func (trup *TaskRunUpdateParameters) 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 IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + trup.Identity = &identity + } + case "properties": + if v != nil { + var taskRunPropertiesUpdateParameters TaskRunPropertiesUpdateParameters + err = json.Unmarshal(*v, &taskRunPropertiesUpdateParameters) + if err != nil { + return err + } + trup.TaskRunPropertiesUpdateParameters = &taskRunPropertiesUpdateParameters + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + trup.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + trup.Tags = tags + } + } + } + + return nil +} + +// TasksCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TasksCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TasksClient) (Task, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TasksCreateFuture) 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 TasksCreateFuture.Result. +func (future *TasksCreateFuture) result(client TasksClient) (t Task, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + t.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.TasksCreateFuture") + 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.CreateResponder(t.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksCreateFuture", "Result", t.Response.Response, "Failure responding to request") + } + } + return +} + +// TasksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TasksDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TasksClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TasksDeleteFuture) 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 TasksDeleteFuture.Result. +func (future *TasksDeleteFuture) result(client TasksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.TasksDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BasicTaskStepProperties base properties for any task step. +type BasicTaskStepProperties interface { + AsDockerBuildStep() (*DockerBuildStep, bool) + AsFileTaskStep() (*FileTaskStep, bool) + AsEncodedTaskStep() (*EncodedTaskStep, bool) + AsTaskStepProperties() (*TaskStepProperties, bool) +} + +// TaskStepProperties base properties for any task step. +type TaskStepProperties struct { + // BaseImageDependencies - READ-ONLY; List of base image dependencies for a step. + BaseImageDependencies *[]BaseImageDependency `json:"baseImageDependencies,omitempty"` + // ContextPath - The URL(absolute or relative) of the source context for the task step. + ContextPath *string `json:"contextPath,omitempty"` + // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string `json:"contextAccessToken,omitempty"` + // Type - Possible values include: 'TypeBasicTaskStepPropertiesTypeTaskStepProperties', 'TypeBasicTaskStepPropertiesTypeDocker', 'TypeBasicTaskStepPropertiesTypeFileTask', 'TypeBasicTaskStepPropertiesTypeEncodedTask' + Type TypeBasicTaskStepProperties `json:"type,omitempty"` +} + +func unmarshalBasicTaskStepProperties(body []byte) (BasicTaskStepProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicTaskStepPropertiesTypeDocker): + var dbs DockerBuildStep + err := json.Unmarshal(body, &dbs) + return dbs, err + case string(TypeBasicTaskStepPropertiesTypeFileTask): + var fts FileTaskStep + err := json.Unmarshal(body, &fts) + return fts, err + case string(TypeBasicTaskStepPropertiesTypeEncodedTask): + var ets EncodedTaskStep + err := json.Unmarshal(body, &ets) + return ets, err + default: + var tsp TaskStepProperties + err := json.Unmarshal(body, &tsp) + return tsp, err + } +} +func unmarshalBasicTaskStepPropertiesArray(body []byte) ([]BasicTaskStepProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + tspArray := make([]BasicTaskStepProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + tsp, err := unmarshalBasicTaskStepProperties(*rawMessage) + if err != nil { + return nil, err + } + tspArray[index] = tsp + } + return tspArray, nil +} + +// MarshalJSON is the custom marshaler for TaskStepProperties. +func (tsp TaskStepProperties) MarshalJSON() ([]byte, error) { + tsp.Type = TypeBasicTaskStepPropertiesTypeTaskStepProperties + objectMap := make(map[string]interface{}) + if tsp.ContextPath != nil { + objectMap["contextPath"] = tsp.ContextPath + } + if tsp.ContextAccessToken != nil { + objectMap["contextAccessToken"] = tsp.ContextAccessToken + } + if tsp.Type != "" { + objectMap["type"] = tsp.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildStep is the BasicTaskStepProperties implementation for TaskStepProperties. +func (tsp TaskStepProperties) AsDockerBuildStep() (*DockerBuildStep, bool) { + return nil, false +} + +// AsFileTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. +func (tsp TaskStepProperties) AsFileTaskStep() (*FileTaskStep, bool) { + return nil, false +} + +// AsEncodedTaskStep is the BasicTaskStepProperties implementation for TaskStepProperties. +func (tsp TaskStepProperties) AsEncodedTaskStep() (*EncodedTaskStep, bool) { + return nil, false +} + +// AsTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. +func (tsp TaskStepProperties) AsTaskStepProperties() (*TaskStepProperties, bool) { + return &tsp, true +} + +// AsBasicTaskStepProperties is the BasicTaskStepProperties implementation for TaskStepProperties. +func (tsp TaskStepProperties) AsBasicTaskStepProperties() (BasicTaskStepProperties, bool) { + return &tsp, true +} + +// BasicTaskStepUpdateParameters base properties for updating any task step. +type BasicTaskStepUpdateParameters interface { + AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) + AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) + AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) + AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) +} + +// TaskStepUpdateParameters base properties for updating any task step. +type TaskStepUpdateParameters struct { + // ContextPath - The URL(absolute or relative) of the source context for the task step. + ContextPath *string `json:"contextPath,omitempty"` + // ContextAccessToken - The token (git PAT or SAS token of storage account blob) associated with the context for a step. + ContextAccessToken *string `json:"contextAccessToken,omitempty"` + // Type - Possible values include: 'TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters', 'TypeBasicTaskStepUpdateParametersTypeDocker', 'TypeBasicTaskStepUpdateParametersTypeFileTask', 'TypeBasicTaskStepUpdateParametersTypeEncodedTask' + Type TypeBasicTaskStepUpdateParameters `json:"type,omitempty"` +} + +func unmarshalBasicTaskStepUpdateParameters(body []byte) (BasicTaskStepUpdateParameters, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicTaskStepUpdateParametersTypeDocker): + var dbsup DockerBuildStepUpdateParameters + err := json.Unmarshal(body, &dbsup) + return dbsup, err + case string(TypeBasicTaskStepUpdateParametersTypeFileTask): + var ftsup FileTaskStepUpdateParameters + err := json.Unmarshal(body, &ftsup) + return ftsup, err + case string(TypeBasicTaskStepUpdateParametersTypeEncodedTask): + var etsup EncodedTaskStepUpdateParameters + err := json.Unmarshal(body, &etsup) + return etsup, err + default: + var tsup TaskStepUpdateParameters + err := json.Unmarshal(body, &tsup) + return tsup, err + } +} +func unmarshalBasicTaskStepUpdateParametersArray(body []byte) ([]BasicTaskStepUpdateParameters, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + tsupArray := make([]BasicTaskStepUpdateParameters, len(rawMessages)) + + for index, rawMessage := range rawMessages { + tsup, err := unmarshalBasicTaskStepUpdateParameters(*rawMessage) + if err != nil { + return nil, err + } + tsupArray[index] = tsup + } + return tsupArray, nil +} + +// MarshalJSON is the custom marshaler for TaskStepUpdateParameters. +func (tsup TaskStepUpdateParameters) MarshalJSON() ([]byte, error) { + tsup.Type = TypeBasicTaskStepUpdateParametersTypeTaskStepUpdateParameters + objectMap := make(map[string]interface{}) + if tsup.ContextPath != nil { + objectMap["contextPath"] = tsup.ContextPath + } + if tsup.ContextAccessToken != nil { + objectMap["contextAccessToken"] = tsup.ContextAccessToken + } + if tsup.Type != "" { + objectMap["type"] = tsup.Type + } + return json.Marshal(objectMap) +} + +// AsDockerBuildStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. +func (tsup TaskStepUpdateParameters) AsDockerBuildStepUpdateParameters() (*DockerBuildStepUpdateParameters, bool) { + return nil, false +} + +// AsFileTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. +func (tsup TaskStepUpdateParameters) AsFileTaskStepUpdateParameters() (*FileTaskStepUpdateParameters, bool) { + return nil, false +} + +// AsEncodedTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. +func (tsup TaskStepUpdateParameters) AsEncodedTaskStepUpdateParameters() (*EncodedTaskStepUpdateParameters, bool) { + return nil, false +} + +// AsTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. +func (tsup TaskStepUpdateParameters) AsTaskStepUpdateParameters() (*TaskStepUpdateParameters, bool) { + return &tsup, true +} + +// AsBasicTaskStepUpdateParameters is the BasicTaskStepUpdateParameters implementation for TaskStepUpdateParameters. +func (tsup TaskStepUpdateParameters) AsBasicTaskStepUpdateParameters() (BasicTaskStepUpdateParameters, bool) { + return &tsup, true +} + +// TasksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TasksUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TasksClient) (Task, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TasksUpdateFuture) 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 TasksUpdateFuture.Result. +func (future *TasksUpdateFuture) result(client TasksClient) (t Task, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + t.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.TasksUpdateFuture") + 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, "containerregistry.TasksUpdateFuture", "Result", t.Response.Response, "Failure responding to request") + } + } + return +} + +// TaskUpdateParameters the parameters for updating a task. +type TaskUpdateParameters struct { + // Identity - Identity for the resource. + Identity *IdentityProperties `json:"identity,omitempty"` + // TaskPropertiesUpdateParameters - The properties for updating a task. + *TaskPropertiesUpdateParameters `json:"properties,omitempty"` + // Tags - The ARM resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TaskUpdateParameters. +func (tup TaskUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tup.Identity != nil { + objectMap["identity"] = tup.Identity + } + if tup.TaskPropertiesUpdateParameters != nil { + objectMap["properties"] = tup.TaskPropertiesUpdateParameters + } + if tup.Tags != nil { + objectMap["tags"] = tup.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TaskUpdateParameters struct. +func (tup *TaskUpdateParameters) 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 IdentityProperties + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + tup.Identity = &identity + } + case "properties": + if v != nil { + var taskPropertiesUpdateParameters TaskPropertiesUpdateParameters + err = json.Unmarshal(*v, &taskPropertiesUpdateParameters) + if err != nil { + return err + } + tup.TaskPropertiesUpdateParameters = &taskPropertiesUpdateParameters + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + tup.Tags = tags + } + } + } + + return nil +} + +// TimerTrigger the properties of a timer trigger. +type TimerTrigger struct { + // Schedule - The CRON expression for the task schedule + Schedule *string `json:"schedule,omitempty"` + // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' + Status TriggerStatus `json:"status,omitempty"` + // Name - The name of the trigger. + Name *string `json:"name,omitempty"` +} + +// TimerTriggerDescriptor ... +type TimerTriggerDescriptor struct { + // TimerTriggerName - The timer trigger name that caused the run. + TimerTriggerName *string `json:"timerTriggerName,omitempty"` + // ScheduleOccurrence - The occurrence that triggered the run. + ScheduleOccurrence *string `json:"scheduleOccurrence,omitempty"` +} + +// TimerTriggerUpdateParameters the properties for updating a timer trigger. +type TimerTriggerUpdateParameters struct { + // Schedule - The CRON expression for the task schedule + Schedule *string `json:"schedule,omitempty"` + // Status - The current status of trigger. Possible values include: 'TriggerStatusEnabled', 'TriggerStatusDisabled' + Status TriggerStatus `json:"status,omitempty"` + // Name - The name of the trigger. + Name *string `json:"name,omitempty"` +} + +// TLSCertificateProperties the TLS certificate properties of the connected registry login server. +type TLSCertificateProperties struct { + // Type - READ-ONLY; The type of certificate location. Possible values include: 'CertificateTypeLocalDirectory' + Type CertificateType `json:"type,omitempty"` + // Location - READ-ONLY; Indicates the location of the certificates. + Location *string `json:"location,omitempty"` +} + +// MarshalJSON is the custom marshaler for TLSCertificateProperties. +func (TCP TLSCertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// TLSProperties the TLS properties of the connected registry login server. +type TLSProperties struct { + // Status - READ-ONLY; Indicates whether HTTPS is enabled for the login server. Possible values include: 'TLSStatusEnabled', 'TLSStatusDisabled' + Status TLSStatus `json:"status,omitempty"` + // Certificate - READ-ONLY; The certificate used to configure HTTPS for the login server. + Certificate *TLSCertificateProperties `json:"certificate,omitempty"` +} + +// MarshalJSON is the custom marshaler for TLSProperties. +func (tp TLSProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Token an object that represents a token for a container registry. +type Token struct { + autorest.Response `json:"-"` + // TokenProperties - The properties of the token. + *TokenProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Token. +func (t Token) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.TokenProperties != nil { + objectMap["properties"] = t.TokenProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Token struct. +func (t *Token) 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 tokenProperties TokenProperties + err = json.Unmarshal(*v, &tokenProperties) + if err != nil { + return err + } + t.TokenProperties = &tokenProperties + } + 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 + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + t.SystemData = &systemData + } + } + } + + return nil +} + +// TokenCertificate the properties of a certificate used for authenticating a token. +type TokenCertificate struct { + // Name - Possible values include: 'TokenCertificateNameCertificate1', 'TokenCertificateNameCertificate2' + Name TokenCertificateName `json:"name,omitempty"` + // Expiry - The expiry datetime of the certificate. + Expiry *date.Time `json:"expiry,omitempty"` + // Thumbprint - The thumbprint of the certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // EncodedPemCertificate - Base 64 encoded string of the public certificate1 in PEM format that will be used for authenticating the token. + EncodedPemCertificate *string `json:"encodedPemCertificate,omitempty"` +} + +// TokenCredentialsProperties the properties of the credentials that can be used for authenticating the +// token. +type TokenCredentialsProperties struct { + Certificates *[]TokenCertificate `json:"certificates,omitempty"` + Passwords *[]TokenPassword `json:"passwords,omitempty"` +} + +// TokenListResult the result of a request to list tokens for a container registry. +type TokenListResult struct { + autorest.Response `json:"-"` + // Value - The list of tokens. Since this list may be incomplete, the nextLink field should be used to request the next list of tokens. + Value *[]Token `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of tokens. + NextLink *string `json:"nextLink,omitempty"` +} + +// TokenListResultIterator provides access to a complete listing of Token values. +type TokenListResultIterator struct { + i int + page TokenListResultPage +} + +// 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 *TokenListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokenListResultIterator.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 *TokenListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TokenListResultIterator) 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 TokenListResultIterator) Response() TokenListResult { + 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 TokenListResultIterator) Value() Token { + if !iter.page.NotDone() { + return Token{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TokenListResultIterator type. +func NewTokenListResultIterator(page TokenListResultPage) TokenListResultIterator { + return TokenListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (tlr TokenListResult) IsEmpty() bool { + return tlr.Value == nil || len(*tlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (tlr TokenListResult) hasNextLink() bool { + return tlr.NextLink != nil && len(*tlr.NextLink) != 0 +} + +// tokenListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tlr TokenListResult) tokenListResultPreparer(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))) +} + +// TokenListResultPage contains a page of Token values. +type TokenListResultPage struct { + fn func(context.Context, TokenListResult) (TokenListResult, error) + tlr TokenListResult +} + +// 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 *TokenListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokenListResultPage.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 *TokenListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TokenListResultPage) NotDone() bool { + return !page.tlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TokenListResultPage) Response() TokenListResult { + return page.tlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TokenListResultPage) Values() []Token { + if page.tlr.IsEmpty() { + return nil + } + return *page.tlr.Value +} + +// Creates a new instance of the TokenListResultPage type. +func NewTokenListResultPage(cur TokenListResult, getNextPage func(context.Context, TokenListResult) (TokenListResult, error)) TokenListResultPage { + return TokenListResultPage{ + fn: getNextPage, + tlr: cur, + } +} + +// TokenPassword the password that will be used for authenticating the token of a container registry. +type TokenPassword struct { + // CreationTime - The creation datetime of the password. + CreationTime *date.Time `json:"creationTime,omitempty"` + // Expiry - The expiry datetime of the password. + Expiry *date.Time `json:"expiry,omitempty"` + // Name - The password name "password1" or "password2". Possible values include: 'TokenPasswordNamePassword1', 'TokenPasswordNamePassword2' + Name TokenPasswordName `json:"name,omitempty"` + // Value - READ-ONLY; The password value. + Value *string `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for TokenPassword. +func (tp TokenPassword) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tp.CreationTime != nil { + objectMap["creationTime"] = tp.CreationTime + } + if tp.Expiry != nil { + objectMap["expiry"] = tp.Expiry + } + if tp.Name != "" { + objectMap["name"] = tp.Name + } + return json.Marshal(objectMap) +} + +// TokenProperties the properties of a token. +type TokenProperties struct { + // CreationDate - READ-ONLY; The creation date of scope map. + CreationDate *date.Time `json:"creationDate,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ScopeMapID - The resource ID of the scope map to which the token will be associated with. + ScopeMapID *string `json:"scopeMapId,omitempty"` + // Credentials - The credentials that can be used for authenticating the token. + Credentials *TokenCredentialsProperties `json:"credentials,omitempty"` + // Status - The status of the token example enabled or disabled. Possible values include: 'TokenStatusEnabled', 'TokenStatusDisabled' + Status TokenStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for TokenProperties. +func (tp TokenProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tp.ScopeMapID != nil { + objectMap["scopeMapId"] = tp.ScopeMapID + } + if tp.Credentials != nil { + objectMap["credentials"] = tp.Credentials + } + if tp.Status != "" { + objectMap["status"] = tp.Status + } + return json.Marshal(objectMap) +} + +// TokensCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TokensCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TokensClient) (Token, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TokensCreateFuture) 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 TokensCreateFuture.Result. +func (future *TokensCreateFuture) result(client TokensClient) (t Token, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + t.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.TokensCreateFuture") + 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.CreateResponder(t.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensCreateFuture", "Result", t.Response.Response, "Failure responding to request") + } + } + return +} + +// TokensDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TokensDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TokensClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TokensDeleteFuture) 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 TokensDeleteFuture.Result. +func (future *TokensDeleteFuture) result(client TokensClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.TokensDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// TokensUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type TokensUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TokensClient) (Token, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TokensUpdateFuture) 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 TokensUpdateFuture.Result. +func (future *TokensUpdateFuture) result(client TokensClient) (t Token, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + t.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.TokensUpdateFuture") + 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, "containerregistry.TokensUpdateFuture", "Result", t.Response.Response, "Failure responding to request") + } + } + return +} + +// TokenUpdateParameters the parameters for updating a token. +type TokenUpdateParameters struct { + // TokenUpdateProperties - The properties of the token update parameters. + *TokenUpdateProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for TokenUpdateParameters. +func (tup TokenUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tup.TokenUpdateProperties != nil { + objectMap["properties"] = tup.TokenUpdateProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TokenUpdateParameters struct. +func (tup *TokenUpdateParameters) 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 tokenUpdateProperties TokenUpdateProperties + err = json.Unmarshal(*v, &tokenUpdateProperties) + if err != nil { + return err + } + tup.TokenUpdateProperties = &tokenUpdateProperties + } + } + } + + return nil +} + +// TokenUpdateProperties the parameters for updating token properties. +type TokenUpdateProperties struct { + // ScopeMapID - The resource ID of the scope map to which the token will be associated with. + ScopeMapID *string `json:"scopeMapId,omitempty"` + // Status - The status of the token example enabled or disabled. Possible values include: 'TokenStatusEnabled', 'TokenStatusDisabled' + Status TokenStatus `json:"status,omitempty"` + // Credentials - The credentials that can be used for authenticating the token. + Credentials *TokenCredentialsProperties `json:"credentials,omitempty"` +} + +// TriggerProperties the properties of a trigger. +type TriggerProperties struct { + // TimerTriggers - The collection of timer triggers. + TimerTriggers *[]TimerTrigger `json:"timerTriggers,omitempty"` + // SourceTriggers - The collection of triggers based on source code repository. + SourceTriggers *[]SourceTrigger `json:"sourceTriggers,omitempty"` + // BaseImageTrigger - The trigger based on base image dependencies. + BaseImageTrigger *BaseImageTrigger `json:"baseImageTrigger,omitempty"` +} + +// TriggerUpdateParameters the properties for updating triggers. +type TriggerUpdateParameters struct { + // TimerTriggers - The collection of timer triggers. + TimerTriggers *[]TimerTriggerUpdateParameters `json:"timerTriggers,omitempty"` + // SourceTriggers - The collection of triggers based on source code repository. + SourceTriggers *[]SourceTriggerUpdateParameters `json:"sourceTriggers,omitempty"` + // BaseImageTrigger - The trigger based on base image dependencies. + BaseImageTrigger *BaseImageTriggerUpdateParameters `json:"baseImageTrigger,omitempty"` +} + +// TrustPolicy the content trust policy for a container registry. +type TrustPolicy struct { + // Type - The type of trust policy. Possible values include: 'TrustPolicyTypeNotary' + Type TrustPolicyType `json:"type,omitempty"` + // Status - The value that indicates whether the policy is enabled or not. Possible values include: 'PolicyStatusEnabled', 'PolicyStatusDisabled' + Status PolicyStatus `json:"status,omitempty"` +} + +// UserIdentityProperties ... +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"` +} + +// VirtualNetworkRule virtual network rule. +type VirtualNetworkRule struct { + // Action - The action of virtual network rule. Possible values include: 'ActionAllow' + Action Action `json:"action,omitempty"` + // VirtualNetworkResourceID - Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + VirtualNetworkResourceID *string `json:"id,omitempty"` +} + +// Webhook an object that represents a webhook for a container registry. +type Webhook struct { + autorest.Response `json:"-"` + // WebhookProperties - The properties of the webhook. + *WebhookProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + // Location - The location of the resource. This cannot be changed after the resource is created. + Location *string `json:"location,omitempty"` + // Tags - The tags of the resource. + Tags map[string]*string `json:"tags"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Webhook. +func (w Webhook) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if w.WebhookProperties != nil { + objectMap["properties"] = w.WebhookProperties + } + if w.Location != nil { + objectMap["location"] = w.Location + } + if w.Tags != nil { + objectMap["tags"] = w.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Webhook struct. +func (w *Webhook) 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 webhookProperties WebhookProperties + err = json.Unmarshal(*v, &webhookProperties) + if err != nil { + return err + } + w.WebhookProperties = &webhookProperties + } + 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 + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + w.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + w.Tags = tags + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + w.SystemData = &systemData + } + } + } + + return nil +} + +// WebhookCreateParameters the parameters for creating a webhook. +type WebhookCreateParameters struct { + // Tags - The tags for the webhook. + Tags map[string]*string `json:"tags"` + // Location - The location of the webhook. This cannot be changed after the resource is created. + Location *string `json:"location,omitempty"` + // WebhookPropertiesCreateParameters - The properties that the webhook will be created with. + *WebhookPropertiesCreateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebhookCreateParameters. +func (wcp WebhookCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wcp.Tags != nil { + objectMap["tags"] = wcp.Tags + } + if wcp.Location != nil { + objectMap["location"] = wcp.Location + } + if wcp.WebhookPropertiesCreateParameters != nil { + objectMap["properties"] = wcp.WebhookPropertiesCreateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WebhookCreateParameters struct. +func (wcp *WebhookCreateParameters) 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 + } + wcp.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + wcp.Location = &location + } + case "properties": + if v != nil { + var webhookPropertiesCreateParameters WebhookPropertiesCreateParameters + err = json.Unmarshal(*v, &webhookPropertiesCreateParameters) + if err != nil { + return err + } + wcp.WebhookPropertiesCreateParameters = &webhookPropertiesCreateParameters + } + } + } + + return nil +} + +// WebhookListResult the result of a request to list webhooks for a container registry. +type WebhookListResult struct { + autorest.Response `json:"-"` + // Value - The list of webhooks. Since this list may be incomplete, the nextLink field should be used to request the next list of webhooks. + Value *[]Webhook `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next list of webhooks. + NextLink *string `json:"nextLink,omitempty"` +} + +// WebhookListResultIterator provides access to a complete listing of Webhook values. +type WebhookListResultIterator struct { + i int + page WebhookListResultPage +} + +// 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 *WebhookListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultIterator.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 *WebhookListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WebhookListResultIterator) 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 WebhookListResultIterator) Response() WebhookListResult { + 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 WebhookListResultIterator) Value() Webhook { + if !iter.page.NotDone() { + return Webhook{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WebhookListResultIterator type. +func NewWebhookListResultIterator(page WebhookListResultPage) WebhookListResultIterator { + return WebhookListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wlr WebhookListResult) IsEmpty() bool { + return wlr.Value == nil || len(*wlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wlr WebhookListResult) hasNextLink() bool { + return wlr.NextLink != nil && len(*wlr.NextLink) != 0 +} + +// webhookListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wlr WebhookListResult) webhookListResultPreparer(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))) +} + +// WebhookListResultPage contains a page of Webhook values. +type WebhookListResultPage struct { + fn func(context.Context, WebhookListResult) (WebhookListResult, error) + wlr WebhookListResult +} + +// 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 *WebhookListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebhookListResultPage.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 *WebhookListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WebhookListResultPage) NotDone() bool { + return !page.wlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WebhookListResultPage) Response() WebhookListResult { + return page.wlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WebhookListResultPage) Values() []Webhook { + if page.wlr.IsEmpty() { + return nil + } + return *page.wlr.Value +} + +// Creates a new instance of the WebhookListResultPage type. +func NewWebhookListResultPage(cur WebhookListResult, getNextPage func(context.Context, WebhookListResult) (WebhookListResult, error)) WebhookListResultPage { + return WebhookListResultPage{ + fn: getNextPage, + wlr: cur, + } +} + +// WebhookProperties the properties of a webhook. +type WebhookProperties struct { + // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' + Status WebhookStatus `json:"status,omitempty"` + // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + Scope *string `json:"scope,omitempty"` + // Actions - The list of actions that trigger the webhook to post notifications. + Actions *[]WebhookAction `json:"actions,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the webhook at the time the operation was called. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebhookProperties. +func (wp WebhookProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wp.Status != "" { + objectMap["status"] = wp.Status + } + if wp.Scope != nil { + objectMap["scope"] = wp.Scope + } + if wp.Actions != nil { + objectMap["actions"] = wp.Actions + } + return json.Marshal(objectMap) +} + +// WebhookPropertiesCreateParameters the parameters for creating the properties of a webhook. +type WebhookPropertiesCreateParameters struct { + // ServiceURI - The service URI for the webhook to post notifications. + ServiceURI *string `json:"serviceUri,omitempty"` + // CustomHeaders - Custom headers that will be added to the webhook notifications. + CustomHeaders map[string]*string `json:"customHeaders"` + // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' + Status WebhookStatus `json:"status,omitempty"` + // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + Scope *string `json:"scope,omitempty"` + // Actions - The list of actions that trigger the webhook to post notifications. + Actions *[]WebhookAction `json:"actions,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebhookPropertiesCreateParameters. +func (wpcp WebhookPropertiesCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wpcp.ServiceURI != nil { + objectMap["serviceUri"] = wpcp.ServiceURI + } + if wpcp.CustomHeaders != nil { + objectMap["customHeaders"] = wpcp.CustomHeaders + } + if wpcp.Status != "" { + objectMap["status"] = wpcp.Status + } + if wpcp.Scope != nil { + objectMap["scope"] = wpcp.Scope + } + if wpcp.Actions != nil { + objectMap["actions"] = wpcp.Actions + } + return json.Marshal(objectMap) +} + +// WebhookPropertiesUpdateParameters the parameters for updating the properties of a webhook. +type WebhookPropertiesUpdateParameters struct { + // ServiceURI - The service URI for the webhook to post notifications. + ServiceURI *string `json:"serviceUri,omitempty"` + // CustomHeaders - Custom headers that will be added to the webhook notifications. + CustomHeaders map[string]*string `json:"customHeaders"` + // Status - The status of the webhook at the time the operation was called. Possible values include: 'WebhookStatusEnabled', 'WebhookStatusDisabled' + Status WebhookStatus `json:"status,omitempty"` + // Scope - The scope of repositories where the event can be triggered. For example, 'foo:*' means events for all tags under repository 'foo'. 'foo:bar' means events for 'foo:bar' only. 'foo' is equivalent to 'foo:latest'. Empty means all events. + Scope *string `json:"scope,omitempty"` + // Actions - The list of actions that trigger the webhook to post notifications. + Actions *[]WebhookAction `json:"actions,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebhookPropertiesUpdateParameters. +func (wpup WebhookPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wpup.ServiceURI != nil { + objectMap["serviceUri"] = wpup.ServiceURI + } + if wpup.CustomHeaders != nil { + objectMap["customHeaders"] = wpup.CustomHeaders + } + if wpup.Status != "" { + objectMap["status"] = wpup.Status + } + if wpup.Scope != nil { + objectMap["scope"] = wpup.Scope + } + if wpup.Actions != nil { + objectMap["actions"] = wpup.Actions + } + return json.Marshal(objectMap) +} + +// WebhooksCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WebhooksCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WebhooksClient) (Webhook, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WebhooksCreateFuture) 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 WebhooksCreateFuture.Result. +func (future *WebhooksCreateFuture) result(client WebhooksClient) (w Webhook, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + w.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksCreateFuture") + 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.CreateResponder(w.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksCreateFuture", "Result", w.Response.Response, "Failure responding to request") + } + } + return +} + +// WebhooksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WebhooksDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WebhooksClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WebhooksDeleteFuture) 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 WebhooksDeleteFuture.Result. +func (future *WebhooksDeleteFuture) result(client WebhooksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// WebhooksUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WebhooksUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WebhooksClient) (Webhook, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WebhooksUpdateFuture) 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 WebhooksUpdateFuture.Result. +func (future *WebhooksUpdateFuture) result(client WebhooksClient) (w Webhook, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + w.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerregistry.WebhooksUpdateFuture") + 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, "containerregistry.WebhooksUpdateFuture", "Result", w.Response.Response, "Failure responding to request") + } + } + return +} + +// WebhookUpdateParameters the parameters for updating a webhook. +type WebhookUpdateParameters struct { + // Tags - The tags for the webhook. + Tags map[string]*string `json:"tags"` + // WebhookPropertiesUpdateParameters - The properties that the webhook will be updated with. + *WebhookPropertiesUpdateParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebhookUpdateParameters. +func (wup WebhookUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wup.Tags != nil { + objectMap["tags"] = wup.Tags + } + if wup.WebhookPropertiesUpdateParameters != nil { + objectMap["properties"] = wup.WebhookPropertiesUpdateParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WebhookUpdateParameters struct. +func (wup *WebhookUpdateParameters) 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 + } + wup.Tags = tags + } + case "properties": + if v != nil { + var webhookPropertiesUpdateParameters WebhookPropertiesUpdateParameters + err = json.Unmarshal(*v, &webhookPropertiesUpdateParameters) + if err != nil { + return err + } + wup.WebhookPropertiesUpdateParameters = &webhookPropertiesUpdateParameters + } + } + } + + return nil +} diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/operations.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/operations.go new file mode 100644 index 000000000000..16590f60f57d --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/operations.go @@ -0,0 +1,140 @@ +package containerregistry + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the client for the Operations methods of the Containerregistry service. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Azure Container Registry REST API 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, "containerregistry.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, "containerregistry.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.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-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ContainerRegistry/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, "containerregistry.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, "containerregistry.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.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/containerregistry/mgmt/2021-06-01-preview/containerregistry/pipelineruns.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/pipelineruns.go new file mode 100644 index 000000000000..ea4acd04b823 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/pipelineruns.go @@ -0,0 +1,453 @@ +package containerregistry + +// 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" +) + +// PipelineRunsClient is the client for the PipelineRuns methods of the Containerregistry service. +type PipelineRunsClient struct { + BaseClient +} + +// NewPipelineRunsClient creates an instance of the PipelineRunsClient client. +func NewPipelineRunsClient(subscriptionID string) PipelineRunsClient { + return NewPipelineRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPipelineRunsClientWithBaseURI creates an instance of the PipelineRunsClient 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 NewPipelineRunsClientWithBaseURI(baseURI string, subscriptionID string) PipelineRunsClient { + return PipelineRunsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a pipeline run for a container registry with the specified parameters +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// pipelineRunName - the name of the pipeline run. +// pipelineRunCreateParameters - the parameters for creating a pipeline run. +func (client PipelineRunsClient) Create(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun) (result PipelineRunsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: pipelineRunName, + Constraints: []validation.Constraint{{Target: "pipelineRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "pipelineRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "pipelineRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: pipelineRunCreateParameters, + Constraints: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Source", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Source.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Target", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "pipelineRunCreateParameters.PipelineRunProperties.Response.Target.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("containerregistry.PipelineRunsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, pipelineRunName, pipelineRunCreateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client PipelineRunsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string, pipelineRunCreateParameters PipelineRun) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pipelineRunName": autorest.Encode("path", pipelineRunName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}", pathParameters), + autorest.WithJSON(pipelineRunCreateParameters), + 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 PipelineRunsClient) CreateSender(req *http.Request) (future PipelineRunsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client PipelineRunsClient) CreateResponder(resp *http.Response) (result PipelineRun, 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 pipeline run from a container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// pipelineRunName - the name of the pipeline run. +func (client PipelineRunsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result PipelineRunsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: pipelineRunName, + Constraints: []validation.Constraint{{Target: "pipelineRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "pipelineRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "pipelineRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.PipelineRunsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, pipelineRunName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PipelineRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pipelineRunName": autorest.Encode("path", pipelineRunName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}", 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 PipelineRunsClient) DeleteSender(req *http.Request) (future PipelineRunsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PipelineRunsClient) 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 detailed information for a given pipeline run. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// pipelineRunName - the name of the pipeline run. +func (client PipelineRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (result PipelineRun, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: pipelineRunName, + Constraints: []validation.Constraint{{Target: "pipelineRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "pipelineRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "pipelineRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.PipelineRunsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, pipelineRunName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PipelineRunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, pipelineRunName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "pipelineRunName": autorest.Encode("path", pipelineRunName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/pipelineRuns/{pipelineRunName}", 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 PipelineRunsClient) 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 PipelineRunsClient) GetResponder(resp *http.Response) (result PipelineRun, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the pipeline runs for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client PipelineRunsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result PipelineRunListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.List") + defer func() { + sc := -1 + if result.prlr.Response.Response != nil { + sc = result.prlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.PipelineRunsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.prlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "List", resp, "Failure sending request") + return + } + + result.prlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "List", resp, "Failure responding to request") + return + } + if result.prlr.hasNextLink() && result.prlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PipelineRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/pipelineRuns", 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 PipelineRunsClient) 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 PipelineRunsClient) ListResponder(resp *http.Response) (result PipelineRunListResult, 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 PipelineRunsClient) listNextResults(ctx context.Context, lastResults PipelineRunListResult) (result PipelineRunListResult, err error) { + req, err := lastResults.pipelineRunListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "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, "containerregistry.PipelineRunsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PipelineRunsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PipelineRunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result PipelineRunListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PipelineRunsClient.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, registryName) + return +} diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/privateendpointconnections.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/privateendpointconnections.go new file mode 100644 index 000000000000..d29eca10078f --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/privateendpointconnections.go @@ -0,0 +1,434 @@ +package containerregistry + +// 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 client for the PrivateEndpointConnections methods of the Containerregistry +// service. +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate update the state of specified private endpoint connection associated with the container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// privateEndpointConnectionName - the name of the private endpoint connection. +// privateEndpointConnection - the parameters for creating a private endpoint connection. +func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName, privateEndpointConnection) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(privateEndpointConnection), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified private endpoint connection associated with the container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, registryName 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the specified private endpoint connection associated with the container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, registryName 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.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, "containerregistry.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/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 all private endpoint connections in a container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result PrivateEndpointConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.peclr.Response.Response != nil { + sc = result.peclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.peclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.peclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.peclr.hasNextLink() && result.peclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/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 PrivateEndpointConnectionListResult, 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 PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { + req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.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, "containerregistry.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.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, registryName string) (result PrivateEndpointConnectionListResultIterator, 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, registryName) + return +} diff --git a/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/registries.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/registries.go new file mode 100644 index 000000000000..6dc9fed42eea --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/registries.go @@ -0,0 +1,1471 @@ +package containerregistry + +// 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" +) + +// RegistriesClient is the client for the Registries methods of the Containerregistry service. +type RegistriesClient struct { + BaseClient +} + +// NewRegistriesClient creates an instance of the RegistriesClient client. +func NewRegistriesClient(subscriptionID string) RegistriesClient { + return NewRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRegistriesClientWithBaseURI creates an instance of the RegistriesClient 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 NewRegistriesClientWithBaseURI(baseURI string, subscriptionID string) RegistriesClient { + return RegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks whether the container registry name is available for use. The name must contain only +// alphanumeric characters, be globally unique, and between 5 and 50 characters in length. +// Parameters: +// registryNameCheckRequest - the object containing information for the availability request. +func (client RegistriesClient) CheckNameAvailability(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (result RegistryNameStatus, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.CheckNameAvailability") + 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: registryNameCheckRequest, + Constraints: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "registryNameCheckRequest.Name", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryNameCheckRequest.Name", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryNameCheckRequest.Name", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}, + }}, + {Target: "registryNameCheckRequest.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, registryNameCheckRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client RegistriesClient) CheckNameAvailabilityPreparer(ctx context.Context, registryNameCheckRequest RegistryNameCheckRequest) (*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, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability", pathParameters), + autorest.WithJSON(registryNameCheckRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client RegistriesClient) CheckNameAvailabilityResponder(resp *http.Response) (result RegistryNameStatus, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Create creates a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// registry - the parameters for creating a container registry. +func (client RegistriesClient) Create(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (result RegistriesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: registry, + Constraints: []validation.Constraint{{Target: "registry.Sku", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, registry) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RegistriesClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, registry Registry) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}", pathParameters), + autorest.WithJSON(registry), + 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 RegistriesClient) CreateSender(req *http.Request) (future RegistriesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RegistriesClient) CreateResponder(resp *http.Response) (result Registry, 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 container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client RegistriesClient) Delete(ctx context.Context, resourceGroupName string, registryName string) (result RegistriesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) DeleteSender(req *http.Request) (future RegistriesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RegistriesClient) 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 +} + +// GenerateCredentials generate keys for a token of a specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// generateCredentialsParameters - the parameters for generating credentials. +func (client RegistriesClient) GenerateCredentials(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters) (result RegistriesGenerateCredentialsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GenerateCredentials") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "GenerateCredentials", err.Error()) + } + + req, err := client.GenerateCredentialsPreparer(ctx, resourceGroupName, registryName, generateCredentialsParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GenerateCredentials", nil, "Failure preparing request") + return + } + + result, err = client.GenerateCredentialsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GenerateCredentials", result.Response(), "Failure sending request") + return + } + + return +} + +// GenerateCredentialsPreparer prepares the GenerateCredentials request. +func (client RegistriesClient) GenerateCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string, generateCredentialsParameters GenerateCredentialsParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/generateCredentials", pathParameters), + autorest.WithJSON(generateCredentialsParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateCredentialsSender sends the GenerateCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) GenerateCredentialsSender(req *http.Request) (future RegistriesGenerateCredentialsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GenerateCredentialsResponder handles the response to the GenerateCredentials request. The method always +// closes the http.Response Body. +func (client RegistriesClient) GenerateCredentialsResponder(resp *http.Response) (result GenerateCredentialsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the properties of the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client RegistriesClient) Get(ctx context.Context, resourceGroupName string, registryName string) (result Registry, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}", 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 RegistriesClient) 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 RegistriesClient) GetResponder(resp *http.Response) (result Registry, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBuildSourceUploadURL get the upload location for the user to be able to upload the source. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client RegistriesClient) GetBuildSourceUploadURL(ctx context.Context, resourceGroupName string, registryName string) (result SourceUploadDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.GetBuildSourceUploadURL") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "GetBuildSourceUploadURL", err.Error()) + } + + req, err := client.GetBuildSourceUploadURLPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetBuildSourceUploadURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", resp, "Failure sending request") + return + } + + result, err = client.GetBuildSourceUploadURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "GetBuildSourceUploadURL", resp, "Failure responding to request") + return + } + + return +} + +// GetBuildSourceUploadURLPreparer prepares the GetBuildSourceUploadURL request. +func (client RegistriesClient) GetBuildSourceUploadURLPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBuildSourceUploadURLSender sends the GetBuildSourceUploadURL request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) GetBuildSourceUploadURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBuildSourceUploadURLResponder handles the response to the GetBuildSourceUploadURL request. The method always +// closes the http.Response Body. +func (client RegistriesClient) GetBuildSourceUploadURLResponder(resp *http.Response) (result SourceUploadDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ImportImage copies an image to this container registry from the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// parameters - the parameters specifying the image to copy and the source container registry. +func (client RegistriesClient) ImportImage(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (result RegistriesImportImageFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ImportImage") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Source", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Source.Credentials", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Source.Credentials.Password", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.Source.SourceImage", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "ImportImage", err.Error()) + } + + req, err := client.ImportImagePreparer(ctx, resourceGroupName, registryName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", nil, "Failure preparing request") + return + } + + result, err = client.ImportImageSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ImportImage", result.Response(), "Failure sending request") + return + } + + return +} + +// ImportImagePreparer prepares the ImportImage request. +func (client RegistriesClient) ImportImagePreparer(ctx context.Context, resourceGroupName string, registryName string, parameters ImportImageParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/importImage", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ImportImageSender sends the ImportImage request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) ImportImageSender(req *http.Request) (future RegistriesImportImageFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ImportImageResponder handles the response to the ImportImage request. The method always +// closes the http.Response Body. +func (client RegistriesClient) ImportImageResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// List lists all the container registries under the specified subscription. +func (client RegistriesClient) List(ctx context.Context) (result RegistryListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.List") + defer func() { + sc := -1 + if result.rlr.Response.Response != nil { + sc = result.rlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure sending request") + return + } + + result.rlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "List", resp, "Failure responding to request") + return + } + if result.rlr.hasNextLink() && result.rlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client RegistriesClient) ListPreparer(ctx context.Context) (*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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { + req, err := lastResults.registryListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client RegistriesClient) ListComplete(ctx context.Context) (result RegistryListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all the container registries under the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +func (client RegistriesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RegistryListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.rlr.Response.Response != nil { + sc = result.rlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.rlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.rlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.rlr.hasNextLink() && result.rlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client RegistriesClient) 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-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.ContainerRegistry/registries", 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 RegistriesClient) 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 RegistriesClient) ListByResourceGroupResponder(resp *http.Response) (result RegistryListResult, 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 RegistriesClient) listByResourceGroupNextResults(ctx context.Context, lastResults RegistryListResult) (result RegistryListResult, err error) { + req, err := lastResults.registryListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "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, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client RegistriesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RegistryListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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 +} + +// ListCredentials lists the login credentials for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client RegistriesClient) ListCredentials(ctx context.Context, resourceGroupName string, registryName string) (result RegistryListCredentialsResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListCredentials") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "ListCredentials", err.Error()) + } + + req, err := client.ListCredentialsPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListCredentials", resp, "Failure responding to request") + return + } + + return +} + +// ListCredentialsPreparer prepares the ListCredentials request. +func (client RegistriesClient) ListCredentialsPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/listCredentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCredentialsSender sends the ListCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) ListCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListCredentialsResponder handles the response to the ListCredentials request. The method always +// closes the http.Response Body. +func (client RegistriesClient) ListCredentialsResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListPrivateLinkResources lists the private link resources for a container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client RegistriesClient) ListPrivateLinkResources(ctx context.Context, resourceGroupName string, registryName string) (result PrivateLinkResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListPrivateLinkResources") + defer func() { + sc := -1 + if result.plrlr.Response.Response != nil { + sc = result.plrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "ListPrivateLinkResources", err.Error()) + } + + result.fn = client.listPrivateLinkResourcesNextResults + req, err := client.ListPrivateLinkResourcesPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", nil, "Failure preparing request") + return + } + + resp, err := client.ListPrivateLinkResourcesSender(req) + if err != nil { + result.plrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", resp, "Failure sending request") + return + } + + result.plrlr, err = client.ListPrivateLinkResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListPrivateLinkResources", resp, "Failure responding to request") + return + } + if result.plrlr.hasNextLink() && result.plrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPrivateLinkResourcesPreparer prepares the ListPrivateLinkResources request. +func (client RegistriesClient) ListPrivateLinkResourcesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPrivateLinkResourcesSender sends the ListPrivateLinkResources request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) ListPrivateLinkResourcesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListPrivateLinkResourcesResponder handles the response to the ListPrivateLinkResources request. The method always +// closes the http.Response Body. +func (client RegistriesClient) ListPrivateLinkResourcesResponder(resp *http.Response) (result PrivateLinkResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listPrivateLinkResourcesNextResults retrieves the next set of results, if any. +func (client RegistriesClient) listPrivateLinkResourcesNextResults(ctx context.Context, lastResults PrivateLinkResourceListResult) (result PrivateLinkResourceListResult, err error) { + req, err := lastResults.privateLinkResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListPrivateLinkResourcesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListPrivateLinkResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "listPrivateLinkResourcesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListPrivateLinkResourcesComplete enumerates all values, automatically crossing page boundaries as required. +func (client RegistriesClient) ListPrivateLinkResourcesComplete(ctx context.Context, resourceGroupName string, registryName string) (result PrivateLinkResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListPrivateLinkResources") + 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.ListPrivateLinkResources(ctx, resourceGroupName, registryName) + return +} + +// ListUsages gets the quota usages for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client RegistriesClient) ListUsages(ctx context.Context, resourceGroupName string, registryName string) (result RegistryUsageListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ListUsages") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "ListUsages", err.Error()) + } + + req, err := client.ListUsagesPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsagesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure sending request") + return + } + + result, err = client.ListUsagesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ListUsages", resp, "Failure responding to request") + return + } + + return +} + +// ListUsagesPreparer prepares the ListUsages request. +func (client RegistriesClient) ListUsagesPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/listUsages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUsagesSender sends the ListUsages request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) ListUsagesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListUsagesResponder handles the response to the ListUsages request. The method always +// closes the http.Response Body. +func (client RegistriesClient) ListUsagesResponder(resp *http.Response) (result RegistryUsageListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateCredential regenerates one of the login credentials for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// regenerateCredentialParameters - specifies name of the password which should be regenerated -- password or +// password2. +func (client RegistriesClient) RegenerateCredential(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (result RegistryListCredentialsResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.RegenerateCredential") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "RegenerateCredential", err.Error()) + } + + req, err := client.RegenerateCredentialPreparer(ctx, resourceGroupName, registryName, regenerateCredentialParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateCredentialSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure sending request") + return + } + + result, err = client.RegenerateCredentialResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "RegenerateCredential", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateCredentialPreparer prepares the RegenerateCredential request. +func (client RegistriesClient) RegenerateCredentialPreparer(ctx context.Context, resourceGroupName string, registryName string, regenerateCredentialParameters RegenerateCredentialParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/regenerateCredential", pathParameters), + autorest.WithJSON(regenerateCredentialParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateCredentialSender sends the RegenerateCredential request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) RegenerateCredentialSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateCredentialResponder handles the response to the RegenerateCredential request. The method always +// closes the http.Response Body. +func (client RegistriesClient) RegenerateCredentialResponder(resp *http.Response) (result RegistryListCredentialsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ScheduleRun schedules a new run based on the request parameters and add it to the run queue. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// runRequest - the parameters of a run that needs to scheduled. +func (client RegistriesClient) ScheduleRun(ctx context.Context, resourceGroupName string, registryName string, runRequest BasicRunRequest) (result RegistriesScheduleRunFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.ScheduleRun") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "ScheduleRun", err.Error()) + } + + req, err := client.ScheduleRunPreparer(ctx, resourceGroupName, registryName, runRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ScheduleRun", nil, "Failure preparing request") + return + } + + result, err = client.ScheduleRunSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "ScheduleRun", result.Response(), "Failure sending request") + return + } + + return +} + +// ScheduleRunPreparer prepares the ScheduleRun request. +func (client RegistriesClient) ScheduleRunPreparer(ctx context.Context, resourceGroupName string, registryName string, runRequest BasicRunRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/scheduleRun", pathParameters), + autorest.WithJSON(runRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ScheduleRunSender sends the ScheduleRun request. The method will close the +// http.Response Body if it receives an error. +func (client RegistriesClient) ScheduleRunSender(req *http.Request) (future RegistriesScheduleRunFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ScheduleRunResponder handles the response to the ScheduleRun request. The method always +// closes the http.Response Body. +func (client RegistriesClient) ScheduleRunResponder(resp *http.Response) (result Run, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// registryUpdateParameters - the parameters for updating a container registry. +func (client RegistriesClient) Update(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (result RegistriesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RegistriesClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RegistriesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, registryUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RegistriesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client RegistriesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, registryUpdateParameters RegistryUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}", pathParameters), + autorest.WithJSON(registryUpdateParameters), + 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 RegistriesClient) UpdateSender(req *http.Request) (future RegistriesUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RegistriesClient) UpdateResponder(resp *http.Response) (result Registry, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/replications.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/replications.go new file mode 100644 index 000000000000..ee0f554df5a7 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/replications.go @@ -0,0 +1,542 @@ +package containerregistry + +// 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" +) + +// ReplicationsClient is the client for the Replications methods of the Containerregistry service. +type ReplicationsClient struct { + BaseClient +} + +// NewReplicationsClient creates an instance of the ReplicationsClient client. +func NewReplicationsClient(subscriptionID string) ReplicationsClient { + return NewReplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewReplicationsClientWithBaseURI creates an instance of the ReplicationsClient 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 NewReplicationsClientWithBaseURI(baseURI string, subscriptionID string) ReplicationsClient { + return ReplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a replication for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// replicationName - the name of the replication. +// replication - the parameters for creating a replication. +func (client ReplicationsClient) Create(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (result ReplicationsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: replicationName, + Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ReplicationsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, replicationName, replication) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ReplicationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replication Replication) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "replicationName": autorest.Encode("path", replicationName), + "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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), + autorest.WithJSON(replication), + 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 ReplicationsClient) CreateSender(req *http.Request) (future ReplicationsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ReplicationsClient) CreateResponder(resp *http.Response) (result Replication, 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 replication from a container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// replicationName - the name of the replication. +func (client ReplicationsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result ReplicationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: replicationName, + Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ReplicationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, replicationName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ReplicationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "replicationName": autorest.Encode("path", replicationName), + "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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) DeleteSender(req *http.Request) (future ReplicationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ReplicationsClient) 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 properties of the specified replication. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// replicationName - the name of the replication. +func (client ReplicationsClient) Get(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (result Replication, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: replicationName, + Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ReplicationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, replicationName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ReplicationsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "replicationName": autorest.Encode("path", replicationName), + "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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", 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 ReplicationsClient) 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 ReplicationsClient) GetResponder(resp *http.Response) (result Replication, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the replications for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client ReplicationsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.List") + defer func() { + sc := -1 + if result.rlr.Response.Response != nil { + sc = result.rlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ReplicationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure sending request") + return + } + + result.rlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "List", resp, "Failure responding to request") + return + } + if result.rlr.hasNextLink() && result.rlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ReplicationsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/replications", 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 ReplicationsClient) 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 ReplicationsClient) ListResponder(resp *http.Response) (result ReplicationListResult, 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 ReplicationsClient) listNextResults(ctx context.Context, lastResults ReplicationListResult) (result ReplicationListResult, err error) { + req, err := lastResults.replicationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "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, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ReplicationsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ReplicationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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, registryName) + return +} + +// Update updates a replication for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// replicationName - the name of the replication. +// replicationUpdateParameters - the parameters for updating a replication. +func (client ReplicationsClient) Update(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (result ReplicationsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ReplicationsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: replicationName, + Constraints: []validation.Constraint{{Target: "replicationName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "replicationName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "replicationName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ReplicationsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, replicationName, replicationUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ReplicationsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ReplicationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, replicationName string, replicationUpdateParameters ReplicationUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "replicationName": autorest.Encode("path", replicationName), + "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.ContainerRegistry/registries/{registryName}/replications/{replicationName}", pathParameters), + autorest.WithJSON(replicationUpdateParameters), + 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 ReplicationsClient) UpdateSender(req *http.Request) (future ReplicationsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ReplicationsClient) UpdateResponder(resp *http.Response) (result Replication, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/runs.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/runs.go new file mode 100644 index 000000000000..7035b1e3c4f3 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/runs.go @@ -0,0 +1,529 @@ +package containerregistry + +// 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" +) + +// RunsClient is the client for the Runs methods of the Containerregistry service. +type RunsClient struct { + BaseClient +} + +// NewRunsClient creates an instance of the RunsClient client. +func NewRunsClient(subscriptionID string) RunsClient { + return NewRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRunsClientWithBaseURI creates an instance of the RunsClient 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 NewRunsClientWithBaseURI(baseURI string, subscriptionID string) RunsClient { + return RunsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Cancel cancel an existing run. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// runID - the run ID. +func (client RunsClient) Cancel(ctx context.Context, resourceGroupName string, registryName string, runID string) (result RunsCancelFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.Cancel") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RunsClient", "Cancel", err.Error()) + } + + req, err := client.CancelPreparer(ctx, resourceGroupName, registryName, runID) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Cancel", nil, "Failure preparing request") + return + } + + result, err = client.CancelSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Cancel", result.Response(), "Failure sending request") + return + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client RunsClient) CancelPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runId": autorest.Encode("path", runID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client RunsClient) CancelSender(req *http.Request) (future RunsCancelFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client RunsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the detailed information for a given run. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// runID - the run ID. +func (client RunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, runID string) (result Run, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RunsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, runID) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runId": autorest.Encode("path", runID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/runs/{runId}", 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 RunsClient) 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 RunsClient) GetResponder(resp *http.Response) (result Run, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLogSasURL gets a link to download the run logs. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// runID - the run ID. +func (client RunsClient) GetLogSasURL(ctx context.Context, resourceGroupName string, registryName string, runID string) (result RunGetLogResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.GetLogSasURL") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RunsClient", "GetLogSasURL", err.Error()) + } + + req, err := client.GetLogSasURLPreparer(ctx, resourceGroupName, registryName, runID) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogSasURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", resp, "Failure sending request") + return + } + + result, err = client.GetLogSasURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "GetLogSasURL", resp, "Failure responding to request") + return + } + + return +} + +// GetLogSasURLPreparer prepares the GetLogSasURL request. +func (client RunsClient) GetLogSasURLPreparer(ctx context.Context, resourceGroupName string, registryName string, runID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runId": autorest.Encode("path", runID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogSasURLSender sends the GetLogSasURL request. The method will close the +// http.Response Body if it receives an error. +func (client RunsClient) GetLogSasURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogSasURLResponder handles the response to the GetLogSasURL request. The method always +// closes the http.Response Body. +func (client RunsClient) GetLogSasURLResponder(resp *http.Response) (result RunGetLogResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the runs for a registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// filter - the runs filter to apply on the operation. Arithmetic operators are not supported. The allowed +// string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed. +// top - $top is supported for get list of runs, which limits the maximum number of runs to return. +func (client RunsClient) List(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result RunListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.List") + defer func() { + sc := -1 + if result.rlr.Response.Response != nil { + sc = result.rlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RunsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName, filter, top) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", resp, "Failure sending request") + return + } + + result.rlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "List", resp, "Failure responding to request") + return + } + if result.rlr.hasNextLink() && result.rlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client RunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/runs", 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 RunsClient) 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 RunsClient) ListResponder(resp *http.Response) (result RunListResult, 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 RunsClient) listNextResults(ctx context.Context, lastResults RunListResult) (result RunListResult, err error) { + req, err := lastResults.runListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.RunsClient", "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, "containerregistry.RunsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client RunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string, filter string, top *int32) (result RunListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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, registryName, filter, top) + return +} + +// Update patch the run properties. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// runID - the run ID. +// runUpdateParameters - the run update properties. +func (client RunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters) (result RunsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RunsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.RunsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, runID, runUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.RunsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client RunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, runID string, runUpdateParameters RunUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runId": autorest.Encode("path", runID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/runs/{runId}", pathParameters), + autorest.WithJSON(runUpdateParameters), + 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 RunsClient) UpdateSender(req *http.Request) (future RunsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RunsClient) UpdateResponder(resp *http.Response) (result Run, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/scopemaps.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/scopemaps.go new file mode 100644 index 000000000000..70bdde72ab12 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/scopemaps.go @@ -0,0 +1,545 @@ +package containerregistry + +// 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" +) + +// ScopeMapsClient is the client for the ScopeMaps methods of the Containerregistry service. +type ScopeMapsClient struct { + BaseClient +} + +// NewScopeMapsClient creates an instance of the ScopeMapsClient client. +func NewScopeMapsClient(subscriptionID string) ScopeMapsClient { + return NewScopeMapsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewScopeMapsClientWithBaseURI creates an instance of the ScopeMapsClient 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 NewScopeMapsClientWithBaseURI(baseURI string, subscriptionID string) ScopeMapsClient { + return ScopeMapsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a scope map for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// scopeMapName - the name of the scope map. +// scopeMapCreateParameters - the parameters for creating a scope map. +func (client ScopeMapsClient) Create(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap) (result ScopeMapsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: scopeMapName, + Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}, + {TargetValue: scopeMapCreateParameters, + Constraints: []validation.Constraint{{Target: "scopeMapCreateParameters.ScopeMapProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "scopeMapCreateParameters.ScopeMapProperties.Actions", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("containerregistry.ScopeMapsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, scopeMapName, scopeMapCreateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ScopeMapsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapCreateParameters ScopeMap) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeMapName": autorest.Encode("path", scopeMapName), + "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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", pathParameters), + autorest.WithJSON(scopeMapCreateParameters), + 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 ScopeMapsClient) CreateSender(req *http.Request) (future ScopeMapsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ScopeMapsClient) CreateResponder(resp *http.Response) (result ScopeMap, 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 scope map from a container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// scopeMapName - the name of the scope map. +func (client ScopeMapsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result ScopeMapsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: scopeMapName, + Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ScopeMapsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, scopeMapName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ScopeMapsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeMapName": autorest.Encode("path", scopeMapName), + "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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", 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 ScopeMapsClient) DeleteSender(req *http.Request) (future ScopeMapsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ScopeMapsClient) 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 properties of the specified scope map. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// scopeMapName - the name of the scope map. +func (client ScopeMapsClient) Get(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (result ScopeMap, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: scopeMapName, + Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ScopeMapsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, scopeMapName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ScopeMapsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeMapName": autorest.Encode("path", scopeMapName), + "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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", 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 ScopeMapsClient) 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 ScopeMapsClient) GetResponder(resp *http.Response) (result ScopeMap, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the scope maps for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client ScopeMapsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result ScopeMapListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.List") + defer func() { + sc := -1 + if result.smlr.Response.Response != nil { + sc = result.smlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ScopeMapsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.smlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", resp, "Failure sending request") + return + } + + result.smlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "List", resp, "Failure responding to request") + return + } + if result.smlr.hasNextLink() && result.smlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ScopeMapsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/scopeMaps", 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 ScopeMapsClient) 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 ScopeMapsClient) ListResponder(resp *http.Response) (result ScopeMapListResult, 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 ScopeMapsClient) listNextResults(ctx context.Context, lastResults ScopeMapListResult) (result ScopeMapListResult, err error) { + req, err := lastResults.scopeMapListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "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, "containerregistry.ScopeMapsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ScopeMapsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result ScopeMapListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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, registryName) + return +} + +// Update updates a scope map with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// scopeMapName - the name of the scope map. +// scopeMapUpdateParameters - the parameters for updating a scope map. +func (client ScopeMapsClient) Update(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters) (result ScopeMapsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ScopeMapsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: scopeMapName, + Constraints: []validation.Constraint{{Target: "scopeMapName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "scopeMapName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "scopeMapName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.ScopeMapsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, scopeMapName, scopeMapUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.ScopeMapsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ScopeMapsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, scopeMapName string, scopeMapUpdateParameters ScopeMapUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "scopeMapName": autorest.Encode("path", scopeMapName), + "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.ContainerRegistry/registries/{registryName}/scopeMaps/{scopeMapName}", pathParameters), + autorest.WithJSON(scopeMapUpdateParameters), + 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 ScopeMapsClient) UpdateSender(req *http.Request) (future ScopeMapsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ScopeMapsClient) UpdateResponder(resp *http.Response) (result ScopeMap, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/taskruns.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/taskruns.go new file mode 100644 index 000000000000..ee13d4b2d14f --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/taskruns.go @@ -0,0 +1,634 @@ +package containerregistry + +// 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" +) + +// TaskRunsClient is the client for the TaskRuns methods of the Containerregistry service. +type TaskRunsClient struct { + BaseClient +} + +// NewTaskRunsClient creates an instance of the TaskRunsClient client. +func NewTaskRunsClient(subscriptionID string) TaskRunsClient { + return NewTaskRunsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTaskRunsClientWithBaseURI creates an instance of the TaskRunsClient 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 NewTaskRunsClientWithBaseURI(baseURI string, subscriptionID string) TaskRunsClient { + return TaskRunsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a task run for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskRunName - the name of the task run. +// taskRun - the parameters of a run that needs to scheduled. +func (client TaskRunsClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (result TaskRunsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: taskRunName, + Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TaskRunsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskRunName, taskRun) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client TaskRunsClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, taskRun TaskRun) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskRunName": autorest.Encode("path", taskRunName), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), + autorest.WithJSON(taskRun), + 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 TaskRunsClient) CreateSender(req *http.Request) (future TaskRunsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client TaskRunsClient) CreateResponder(resp *http.Response) (result TaskRun, 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 specified task run resource. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskRunName - the name of the task run. +func (client TaskRunsClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRunsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: taskRunName, + Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TaskRunsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskRunName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TaskRunsClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskRunName": autorest.Encode("path", taskRunName), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", 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 TaskRunsClient) DeleteSender(req *http.Request) (future TaskRunsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TaskRunsClient) 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 detailed information for a given task run. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskRunName - the name of the task run. +func (client TaskRunsClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: taskRunName, + Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TaskRunsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskRunName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TaskRunsClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskRunName": autorest.Encode("path", taskRunName), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", 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 TaskRunsClient) 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 TaskRunsClient) GetResponder(resp *http.Response) (result TaskRun, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDetails gets the detailed information for a given task run that includes all secrets. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskRunName - the name of the task run. +func (client TaskRunsClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (result TaskRun, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.GetDetails") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: taskRunName, + Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TaskRunsClient", "GetDetails", err.Error()) + } + + req, err := client.GetDetailsPreparer(ctx, resourceGroupName, registryName, taskRunName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", nil, "Failure preparing request") + return + } + + resp, err := client.GetDetailsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", resp, "Failure sending request") + return + } + + result, err = client.GetDetailsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "GetDetails", resp, "Failure responding to request") + return + } + + return +} + +// GetDetailsPreparer prepares the GetDetails request. +func (client TaskRunsClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskRunName": autorest.Encode("path", taskRunName), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDetailsSender sends the GetDetails request. The method will close the +// http.Response Body if it receives an error. +func (client TaskRunsClient) GetDetailsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDetailsResponder handles the response to the GetDetails request. The method always +// closes the http.Response Body. +func (client TaskRunsClient) GetDetailsResponder(resp *http.Response) (result TaskRun, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the task runs for a specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client TaskRunsClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.List") + defer func() { + sc := -1 + if result.trlr.Response.Response != nil { + sc = result.trlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TaskRunsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.trlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure sending request") + return + } + + result.trlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "List", resp, "Failure responding to request") + return + } + if result.trlr.hasNextLink() && result.trlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client TaskRunsClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/taskRuns", 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 TaskRunsClient) 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 TaskRunsClient) ListResponder(resp *http.Response) (result TaskRunListResult, 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 TaskRunsClient) listNextResults(ctx context.Context, lastResults TaskRunListResult) (result TaskRunListResult, err error) { + req, err := lastResults.taskRunListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "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, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TaskRunsClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskRunListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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, registryName) + return +} + +// Update updates a task run with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskRunName - the name of the task run. +// updateParameters - the parameters for updating a task run. +func (client TaskRunsClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (result TaskRunsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TaskRunsClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: taskRunName, + Constraints: []validation.Constraint{{Target: "taskRunName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "taskRunName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "taskRunName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TaskRunsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskRunName, updateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TaskRunsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TaskRunsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskRunName string, updateParameters TaskRunUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskRunName": autorest.Encode("path", taskRunName), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}", pathParameters), + autorest.WithJSON(updateParameters), + 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 TaskRunsClient) UpdateSender(req *http.Request) (future TaskRunsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client TaskRunsClient) UpdateResponder(resp *http.Response) (result TaskRun, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/tasks.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/tasks.go new file mode 100644 index 000000000000..3af51765a125 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/tasks.go @@ -0,0 +1,645 @@ +package containerregistry + +// 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" +) + +// TasksClient is the client for the Tasks methods of the Containerregistry service. +type TasksClient struct { + BaseClient +} + +// NewTasksClient creates an instance of the TasksClient client. +func NewTasksClient(subscriptionID string) TasksClient { + return NewTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTasksClientWithBaseURI creates an instance of the TasksClient 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 NewTasksClientWithBaseURI(baseURI string, subscriptionID string) TasksClient { + return TasksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a task for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskName - the name of the container registry task. +// taskCreateParameters - the parameters for creating a task. +func (client TasksClient) Create(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task) (result TasksCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: taskName, + Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}, + {TargetValue: taskCreateParameters, + Constraints: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.InclusiveMaximum, Rule: int64(28800), Chain: nil}, + {Target: "taskCreateParameters.TaskProperties.Timeout", Name: validation.InclusiveMinimum, Rule: int64(300), Chain: nil}, + }}, + {Target: "taskCreateParameters.TaskProperties.Trigger", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Trigger.BaseImageTrigger", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "taskCreateParameters.TaskProperties.Trigger.BaseImageTrigger.Name", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("containerregistry.TasksClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, taskName, taskCreateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client TasksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskCreateParameters Task) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskName": autorest.Encode("path", taskName), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", pathParameters), + autorest.WithJSON(taskCreateParameters), + 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 TasksClient) CreateSender(req *http.Request) (future TasksCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client TasksClient) CreateResponder(resp *http.Response) (result Task, 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 specified task. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskName - the name of the container registry task. +func (client TasksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result TasksDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: taskName, + Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TasksClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, taskName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TasksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskName": autorest.Encode("path", taskName), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", 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 TasksClient) DeleteSender(req *http.Request) (future TasksDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TasksClient) 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 the properties of a specified task. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskName - the name of the container registry task. +func (client TasksClient) Get(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result Task, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: taskName, + Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TasksClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, taskName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TasksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskName": autorest.Encode("path", taskName), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", 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 TasksClient) 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 TasksClient) GetResponder(resp *http.Response) (result Task, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetDetails returns a task with extended information that includes all secrets. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskName - the name of the container registry task. +func (client TasksClient) GetDetails(ctx context.Context, resourceGroupName string, registryName string, taskName string) (result Task, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.GetDetails") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: taskName, + Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TasksClient", "GetDetails", err.Error()) + } + + req, err := client.GetDetailsPreparer(ctx, resourceGroupName, registryName, taskName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", nil, "Failure preparing request") + return + } + + resp, err := client.GetDetailsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", resp, "Failure sending request") + return + } + + result, err = client.GetDetailsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "GetDetails", resp, "Failure responding to request") + return + } + + return +} + +// GetDetailsPreparer prepares the GetDetails request. +func (client TasksClient) GetDetailsPreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskName": autorest.Encode("path", taskName), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDetailsSender sends the GetDetails request. The method will close the +// http.Response Body if it receives an error. +func (client TasksClient) GetDetailsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetDetailsResponder handles the response to the GetDetails request. The method always +// closes the http.Response Body. +func (client TasksClient) GetDetailsResponder(resp *http.Response) (result Task, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the tasks for a specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client TasksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TaskListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.List") + defer func() { + sc := -1 + if result.tlr.Response.Response != nil { + sc = result.tlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TasksClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.tlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", resp, "Failure sending request") + return + } + + result.tlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "List", resp, "Failure responding to request") + return + } + if result.tlr.hasNextLink() && result.tlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client TasksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/tasks", 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 TasksClient) 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 TasksClient) ListResponder(resp *http.Response) (result TaskListResult, 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 TasksClient) listNextResults(ctx context.Context, lastResults TaskListResult) (result TaskListResult, err error) { + req, err := lastResults.taskListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.TasksClient", "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, "containerregistry.TasksClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TasksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TaskListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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, registryName) + return +} + +// Update updates a task with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// taskName - the name of the container registry task. +// taskUpdateParameters - the parameters for updating a task. +func (client TasksClient) Update(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters) (result TasksUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TasksClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: taskName, + Constraints: []validation.Constraint{{Target: "taskName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "taskName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "taskName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-_]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TasksClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, taskName, taskUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TasksClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TasksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, taskName string, taskUpdateParameters TaskUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskName": autorest.Encode("path", taskName), + } + + const APIVersion = "2019-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.ContainerRegistry/registries/{registryName}/tasks/{taskName}", pathParameters), + autorest.WithJSON(taskUpdateParameters), + 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 TasksClient) UpdateSender(req *http.Request) (future TasksUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client TasksClient) UpdateResponder(resp *http.Response) (result Task, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/tokens.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/tokens.go new file mode 100644 index 000000000000..82cf405d1dd8 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/tokens.go @@ -0,0 +1,542 @@ +package containerregistry + +// 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" +) + +// TokensClient is the client for the Tokens methods of the Containerregistry service. +type TokensClient struct { + BaseClient +} + +// NewTokensClient creates an instance of the TokensClient client. +func NewTokensClient(subscriptionID string) TokensClient { + return NewTokensClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTokensClientWithBaseURI creates an instance of the TokensClient 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 NewTokensClientWithBaseURI(baseURI string, subscriptionID string) TokensClient { + return TokensClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a token for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// tokenName - the name of the token. +// tokenCreateParameters - the parameters for creating a token. +func (client TokensClient) Create(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token) (result TokensCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: tokenName, + Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TokensClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, tokenName, tokenCreateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client TokensClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenCreateParameters Token) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tokenName": autorest.Encode("path", tokenName), + } + + 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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", pathParameters), + autorest.WithJSON(tokenCreateParameters), + 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 TokensClient) CreateSender(req *http.Request) (future TokensCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client TokensClient) CreateResponder(resp *http.Response) (result Token, 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 token from a container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// tokenName - the name of the token. +func (client TokensClient) Delete(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result TokensDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: tokenName, + Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TokensClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, tokenName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TokensClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tokenName": autorest.Encode("path", tokenName), + } + + 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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", 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 TokensClient) DeleteSender(req *http.Request) (future TokensDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TokensClient) 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 properties of the specified token. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// tokenName - the name of the token. +func (client TokensClient) Get(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (result Token, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: tokenName, + Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TokensClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, tokenName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TokensClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tokenName": autorest.Encode("path", tokenName), + } + + 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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", 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 TokensClient) 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 TokensClient) GetResponder(resp *http.Response) (result Token, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the tokens for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client TokensClient) List(ctx context.Context, resourceGroupName string, registryName string) (result TokenListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.List") + defer func() { + sc := -1 + if result.tlr.Response.Response != nil { + sc = result.tlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TokensClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.tlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", resp, "Failure sending request") + return + } + + result.tlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "List", resp, "Failure responding to request") + return + } + if result.tlr.hasNextLink() && result.tlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client TokensClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/tokens", 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 TokensClient) 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 TokensClient) ListResponder(resp *http.Response) (result TokenListResult, 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 TokensClient) listNextResults(ctx context.Context, lastResults TokenListResult) (result TokenListResult, err error) { + req, err := lastResults.tokenListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.TokensClient", "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, "containerregistry.TokensClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TokensClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result TokenListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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, registryName) + return +} + +// Update updates a token with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// tokenName - the name of the token. +// tokenUpdateParameters - the parameters for updating a token. +func (client TokensClient) Update(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters) (result TokensUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TokensClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: tokenName, + Constraints: []validation.Constraint{{Target: "tokenName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "tokenName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "tokenName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9-]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.TokensClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, tokenName, tokenUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.TokensClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TokensClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, tokenName string, tokenUpdateParameters TokenUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tokenName": autorest.Encode("path", tokenName), + } + + 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.ContainerRegistry/registries/{registryName}/tokens/{tokenName}", pathParameters), + autorest.WithJSON(tokenUpdateParameters), + 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 TokensClient) UpdateSender(req *http.Request) (future TokensUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client TokensClient) UpdateResponder(resp *http.Response) (result Token, 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/containerregistry/mgmt/2021-06-01-preview/containerregistry/version.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/version.go new file mode 100644 index 000000000000..72dd28110325 --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/version.go @@ -0,0 +1,19 @@ +package containerregistry + +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() + " containerregistry/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/containerregistry/mgmt/2021-06-01-preview/containerregistry/webhooks.go b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/webhooks.go new file mode 100644 index 000000000000..4229a1cc1dfc --- /dev/null +++ b/services/preview/containerregistry/mgmt/2021-06-01-preview/containerregistry/webhooks.go @@ -0,0 +1,866 @@ +package containerregistry + +// 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" +) + +// WebhooksClient is the client for the Webhooks methods of the Containerregistry service. +type WebhooksClient struct { + BaseClient +} + +// NewWebhooksClient creates an instance of the WebhooksClient client. +func NewWebhooksClient(subscriptionID string) WebhooksClient { + return NewWebhooksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWebhooksClientWithBaseURI creates an instance of the WebhooksClient 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 NewWebhooksClientWithBaseURI(baseURI string, subscriptionID string) WebhooksClient { + return WebhooksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create creates a webhook for a container registry with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// webhookName - the name of the webhook. +// webhookCreateParameters - the parameters for creating a webhook. +func (client WebhooksClient) Create(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (result WebhooksCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: webhookName, + Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: webhookCreateParameters, + Constraints: []validation.Constraint{{Target: "webhookCreateParameters.Location", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.ServiceURI", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "webhookCreateParameters.WebhookPropertiesCreateParameters.Actions", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("containerregistry.WebhooksClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookCreateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client WebhooksClient) CreatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookCreateParameters WebhookCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webhookName": autorest.Encode("path", webhookName), + } + + 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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), + autorest.WithJSON(webhookCreateParameters), + 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 WebhooksClient) CreateSender(req *http.Request) (future WebhooksCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client WebhooksClient) CreateResponder(resp *http.Response) (result Webhook, 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 webhook from a container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// webhookName - the name of the webhook. +func (client WebhooksClient) Delete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result WebhooksDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: webhookName, + Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.WebhooksClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, registryName, webhookName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WebhooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webhookName": autorest.Encode("path", webhookName), + } + + 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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) DeleteSender(req *http.Request) (future WebhooksDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WebhooksClient) 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 properties of the specified webhook. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// webhookName - the name of the webhook. +func (client WebhooksClient) Get(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result Webhook, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: webhookName, + Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.WebhooksClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, registryName, webhookName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WebhooksClient) GetPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webhookName": autorest.Encode("path", webhookName), + } + + 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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", 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 WebhooksClient) 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 WebhooksClient) GetResponder(resp *http.Response) (result Webhook, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCallbackConfig gets the configuration of service URI and custom headers for the webhook. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// webhookName - the name of the webhook. +func (client WebhooksClient) GetCallbackConfig(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result CallbackConfig, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.GetCallbackConfig") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: webhookName, + Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.WebhooksClient", "GetCallbackConfig", err.Error()) + } + + req, err := client.GetCallbackConfigPreparer(ctx, resourceGroupName, registryName, webhookName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", nil, "Failure preparing request") + return + } + + resp, err := client.GetCallbackConfigSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure sending request") + return + } + + result, err = client.GetCallbackConfigResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "GetCallbackConfig", resp, "Failure responding to request") + return + } + + return +} + +// GetCallbackConfigPreparer prepares the GetCallbackConfig request. +func (client WebhooksClient) GetCallbackConfigPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webhookName": autorest.Encode("path", webhookName), + } + + 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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/getCallbackConfig", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCallbackConfigSender sends the GetCallbackConfig request. The method will close the +// http.Response Body if it receives an error. +func (client WebhooksClient) GetCallbackConfigSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetCallbackConfigResponder handles the response to the GetCallbackConfig request. The method always +// closes the http.Response Body. +func (client WebhooksClient) GetCallbackConfigResponder(resp *http.Response) (result CallbackConfig, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the webhooks for the specified container registry. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +func (client WebhooksClient) List(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.List") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.WebhooksClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, registryName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.wlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure sending request") + return + } + + result.wlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "List", resp, "Failure responding to request") + return + } + if result.wlr.hasNextLink() && result.wlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WebhooksClient) ListPreparer(ctx context.Context, resourceGroupName string, registryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "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.ContainerRegistry/registries/{registryName}/webhooks", 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 WebhooksClient) 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 WebhooksClient) ListResponder(resp *http.Response) (result WebhookListResult, 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 WebhooksClient) listNextResults(ctx context.Context, lastResults WebhookListResult) (result WebhookListResult, err error) { + req, err := lastResults.webhookListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "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, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client WebhooksClient) ListComplete(ctx context.Context, resourceGroupName string, registryName string) (result WebhookListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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, registryName) + return +} + +// ListEvents lists recent events for the specified webhook. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// webhookName - the name of the webhook. +func (client WebhooksClient) ListEvents(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") + defer func() { + sc := -1 + if result.elr.Response.Response != nil { + sc = result.elr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: webhookName, + Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.WebhooksClient", "ListEvents", err.Error()) + } + + result.fn = client.listEventsNextResults + req, err := client.ListEventsPreparer(ctx, resourceGroupName, registryName, webhookName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", nil, "Failure preparing request") + return + } + + resp, err := client.ListEventsSender(req) + if err != nil { + result.elr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure sending request") + return + } + + result.elr, err = client.ListEventsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "ListEvents", resp, "Failure responding to request") + return + } + if result.elr.hasNextLink() && result.elr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListEventsPreparer prepares the ListEvents request. +func (client WebhooksClient) ListEventsPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webhookName": autorest.Encode("path", webhookName), + } + + 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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/listEvents", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListEventsSender sends the ListEvents request. The method will close the +// http.Response Body if it receives an error. +func (client WebhooksClient) ListEventsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListEventsResponder handles the response to the ListEvents request. The method always +// closes the http.Response Body. +func (client WebhooksClient) ListEventsResponder(resp *http.Response) (result EventListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listEventsNextResults retrieves the next set of results, if any. +func (client WebhooksClient) listEventsNextResults(ctx context.Context, lastResults EventListResult) (result EventListResult, err error) { + req, err := lastResults.eventListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListEventsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListEventsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "listEventsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListEventsComplete enumerates all values, automatically crossing page boundaries as required. +func (client WebhooksClient) ListEventsComplete(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.ListEvents") + 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.ListEvents(ctx, resourceGroupName, registryName, webhookName) + return +} + +// Ping triggers a ping event to be sent to the webhook. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// webhookName - the name of the webhook. +func (client WebhooksClient) Ping(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (result EventInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.Ping") + 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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: webhookName, + Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.WebhooksClient", "Ping", err.Error()) + } + + req, err := client.PingPreparer(ctx, resourceGroupName, registryName, webhookName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", nil, "Failure preparing request") + return + } + + resp, err := client.PingSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure sending request") + return + } + + result, err = client.PingResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Ping", resp, "Failure responding to request") + return + } + + return +} + +// PingPreparer prepares the Ping request. +func (client WebhooksClient) PingPreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webhookName": autorest.Encode("path", webhookName), + } + + 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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}/ping", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PingSender sends the Ping request. The method will close the +// http.Response Body if it receives an error. +func (client WebhooksClient) PingSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PingResponder handles the response to the Ping request. The method always +// closes the http.Response Body. +func (client WebhooksClient) PingResponder(resp *http.Response) (result EventInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates a webhook with the specified parameters. +// Parameters: +// resourceGroupName - the name of the resource group to which the container registry belongs. +// registryName - the name of the container registry. +// webhookName - the name of the webhook. +// webhookUpdateParameters - the parameters for updating a webhook. +func (client WebhooksClient) Update(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (result WebhooksUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebhooksClient.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.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: registryName, + Constraints: []validation.Constraint{{Target: "registryName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "registryName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "registryName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}, + {TargetValue: webhookName, + Constraints: []validation.Constraint{{Target: "webhookName", Name: validation.MaxLength, Rule: 50, Chain: nil}, + {Target: "webhookName", Name: validation.MinLength, Rule: 5, Chain: nil}, + {Target: "webhookName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]*$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerregistry.WebhooksClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, registryName, webhookName, webhookUpdateParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerregistry.WebhooksClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WebhooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, registryName string, webhookName string, webhookUpdateParameters WebhookUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "registryName": autorest.Encode("path", registryName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "webhookName": autorest.Encode("path", webhookName), + } + + 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.ContainerRegistry/registries/{registryName}/webhooks/{webhookName}", pathParameters), + autorest.WithJSON(webhookUpdateParameters), + 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 WebhooksClient) UpdateSender(req *http.Request) (future WebhooksUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WebhooksClient) UpdateResponder(resp *http.Response) (result Webhook, 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/version/version.go b/version/version.go index 21fd20f9f64c..27a1fe4231e1 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 = "v58.2.0" +const Number = "v58.3.0"