diff --git a/CHANGELOG.md b/CHANGELOG.md index 84515322f28d..1b19097393a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## `v60.1.0` + +### New Packages + +- `github.com/Azure/azure-sdk-for-go/services/elastic/mgmt/2020-07-01/elastic` +- `github.com/Azure/azure-sdk-for-go/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder` + ## `v60.0.0` ### New Packages @@ -12,7 +19,7 @@ | Package Path | Changelog | | :--- | :---: | -| `github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory` | [details](https://github.com/Azure/azure-sdk-for-go/tree/main/services/datafactory/mgmt/2018-06-01/datafactory/CHANGELOG.md) | +| `github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory` | [details](https://github.com/Azure/azure-sdk-for-go/blob/v60.0.0/services/datafactory/mgmt/2018-06-01/datafactory/CHANGELOG.md) | ## `v59.4.0` diff --git a/profiles/latest/elastic/mgmt/elastic/elasticapi/models.go b/profiles/latest/elastic/mgmt/elastic/elasticapi/models.go new file mode 100644 index 000000000000..dbb70687d2ac --- /dev/null +++ b/profiles/latest/elastic/mgmt/elastic/elasticapi/models.go @@ -0,0 +1,21 @@ +//go:build go1.9 +// +build go1.9 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/eng/tools/profileBuilder + +package elasticapi + +import original "github.com/Azure/azure-sdk-for-go/services/elastic/mgmt/2020-07-01/elastic/elasticapi" + +type DeploymentInfoClientAPI = original.DeploymentInfoClientAPI +type MonitoredResourcesClientAPI = original.MonitoredResourcesClientAPI +type MonitorsClientAPI = original.MonitorsClientAPI +type OperationsClientAPI = original.OperationsClientAPI +type TagRulesClientAPI = original.TagRulesClientAPI +type VMCollectionClientAPI = original.VMCollectionClientAPI +type VMHostClientAPI = original.VMHostClientAPI +type VMIngestionClientAPI = original.VMIngestionClientAPI diff --git a/profiles/latest/elastic/mgmt/elastic/models.go b/profiles/latest/elastic/mgmt/elastic/models.go new file mode 100644 index 000000000000..1ad24c62fbe6 --- /dev/null +++ b/profiles/latest/elastic/mgmt/elastic/models.go @@ -0,0 +1,261 @@ +//go:build go1.9 +// +build go1.9 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/eng/tools/profileBuilder + +package elastic + +import ( + "context" + + original "github.com/Azure/azure-sdk-for-go/services/elastic/mgmt/2020-07-01/elastic" +) + +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 DeploymentStatus = original.DeploymentStatus + +const ( + DeploymentStatusHealthy DeploymentStatus = original.DeploymentStatusHealthy + DeploymentStatusUnhealthy DeploymentStatus = original.DeploymentStatusUnhealthy +) + +type LiftrResourceCategories = original.LiftrResourceCategories + +const ( + LiftrResourceCategoriesMonitorLogs LiftrResourceCategories = original.LiftrResourceCategoriesMonitorLogs + LiftrResourceCategoriesUnknown LiftrResourceCategories = original.LiftrResourceCategoriesUnknown +) + +type ManagedIdentityTypes = original.ManagedIdentityTypes + +const ( + ManagedIdentityTypesSystemAssigned ManagedIdentityTypes = original.ManagedIdentityTypesSystemAssigned +) + +type MonitoringStatus = original.MonitoringStatus + +const ( + MonitoringStatusDisabled MonitoringStatus = original.MonitoringStatusDisabled + MonitoringStatusEnabled MonitoringStatus = original.MonitoringStatusEnabled +) + +type OperationName = original.OperationName + +const ( + OperationNameAdd OperationName = original.OperationNameAdd + OperationNameDelete OperationName = original.OperationNameDelete +) + +type ProvisioningState = original.ProvisioningState + +const ( + ProvisioningStateAccepted ProvisioningState = original.ProvisioningStateAccepted + ProvisioningStateCanceled ProvisioningState = original.ProvisioningStateCanceled + ProvisioningStateCreating ProvisioningState = original.ProvisioningStateCreating + ProvisioningStateDeleted ProvisioningState = original.ProvisioningStateDeleted + ProvisioningStateDeleting ProvisioningState = original.ProvisioningStateDeleting + ProvisioningStateFailed ProvisioningState = original.ProvisioningStateFailed + ProvisioningStateNotSpecified ProvisioningState = original.ProvisioningStateNotSpecified + ProvisioningStateSucceeded ProvisioningState = original.ProvisioningStateSucceeded + ProvisioningStateUpdating ProvisioningState = original.ProvisioningStateUpdating +) + +type SendingLogs = original.SendingLogs + +const ( + SendingLogsFalse SendingLogs = original.SendingLogsFalse + SendingLogsTrue SendingLogs = original.SendingLogsTrue +) + +type TagAction = original.TagAction + +const ( + TagActionExclude TagAction = original.TagActionExclude + TagActionInclude TagAction = original.TagActionInclude +) + +type BaseClient = original.BaseClient +type CloudDeployment = original.CloudDeployment +type CloudUser = original.CloudUser +type CompanyInfo = original.CompanyInfo +type DeploymentInfoClient = original.DeploymentInfoClient +type DeploymentInfoResponse = original.DeploymentInfoResponse +type ErrorResponseBody = original.ErrorResponseBody +type FilteringTag = original.FilteringTag +type IdentityProperties = original.IdentityProperties +type LogRules = original.LogRules +type MonitorProperties = original.MonitorProperties +type MonitorResource = original.MonitorResource +type MonitorResourceListResponse = original.MonitorResourceListResponse +type MonitorResourceListResponseIterator = original.MonitorResourceListResponseIterator +type MonitorResourceListResponsePage = original.MonitorResourceListResponsePage +type MonitorResourceUpdateParameters = original.MonitorResourceUpdateParameters +type MonitoredResource = original.MonitoredResource +type MonitoredResourceListResponse = original.MonitoredResourceListResponse +type MonitoredResourceListResponseIterator = original.MonitoredResourceListResponseIterator +type MonitoredResourceListResponsePage = original.MonitoredResourceListResponsePage +type MonitoredResourcesClient = original.MonitoredResourcesClient +type MonitoringTagRules = original.MonitoringTagRules +type MonitoringTagRulesListResponse = original.MonitoringTagRulesListResponse +type MonitoringTagRulesListResponseIterator = original.MonitoringTagRulesListResponseIterator +type MonitoringTagRulesListResponsePage = original.MonitoringTagRulesListResponsePage +type MonitoringTagRulesProperties = original.MonitoringTagRulesProperties +type MonitorsClient = original.MonitorsClient +type MonitorsCreateFuture = original.MonitorsCreateFuture +type MonitorsDeleteFuture = original.MonitorsDeleteFuture +type OperationDisplay = original.OperationDisplay +type OperationListResult = original.OperationListResult +type OperationListResultIterator = original.OperationListResultIterator +type OperationListResultPage = original.OperationListResultPage +type OperationResult = original.OperationResult +type OperationsClient = original.OperationsClient +type Properties = original.Properties +type ResourceProviderDefaultErrorResponse = original.ResourceProviderDefaultErrorResponse +type ResourceSku = original.ResourceSku +type SystemData = original.SystemData +type TagRulesClient = original.TagRulesClient +type TagRulesDeleteFuture = original.TagRulesDeleteFuture +type UserInfo = original.UserInfo +type VMCollectionClient = original.VMCollectionClient +type VMCollectionUpdate = original.VMCollectionUpdate +type VMHostClient = original.VMHostClient +type VMHostListResponse = original.VMHostListResponse +type VMHostListResponseIterator = original.VMHostListResponseIterator +type VMHostListResponsePage = original.VMHostListResponsePage +type VMIngestionClient = original.VMIngestionClient +type VMIngestionDetailsResponse = original.VMIngestionDetailsResponse +type VMResources = original.VMResources + +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) +} +func NewDeploymentInfoClient(subscriptionID string) DeploymentInfoClient { + return original.NewDeploymentInfoClient(subscriptionID) +} +func NewDeploymentInfoClientWithBaseURI(baseURI string, subscriptionID string) DeploymentInfoClient { + return original.NewDeploymentInfoClientWithBaseURI(baseURI, subscriptionID) +} +func NewMonitorResourceListResponseIterator(page MonitorResourceListResponsePage) MonitorResourceListResponseIterator { + return original.NewMonitorResourceListResponseIterator(page) +} +func NewMonitorResourceListResponsePage(cur MonitorResourceListResponse, getNextPage func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error)) MonitorResourceListResponsePage { + return original.NewMonitorResourceListResponsePage(cur, getNextPage) +} +func NewMonitoredResourceListResponseIterator(page MonitoredResourceListResponsePage) MonitoredResourceListResponseIterator { + return original.NewMonitoredResourceListResponseIterator(page) +} +func NewMonitoredResourceListResponsePage(cur MonitoredResourceListResponse, getNextPage func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error)) MonitoredResourceListResponsePage { + return original.NewMonitoredResourceListResponsePage(cur, getNextPage) +} +func NewMonitoredResourcesClient(subscriptionID string) MonitoredResourcesClient { + return original.NewMonitoredResourcesClient(subscriptionID) +} +func NewMonitoredResourcesClientWithBaseURI(baseURI string, subscriptionID string) MonitoredResourcesClient { + return original.NewMonitoredResourcesClientWithBaseURI(baseURI, subscriptionID) +} +func NewMonitoringTagRulesListResponseIterator(page MonitoringTagRulesListResponsePage) MonitoringTagRulesListResponseIterator { + return original.NewMonitoringTagRulesListResponseIterator(page) +} +func NewMonitoringTagRulesListResponsePage(cur MonitoringTagRulesListResponse, getNextPage func(context.Context, MonitoringTagRulesListResponse) (MonitoringTagRulesListResponse, error)) MonitoringTagRulesListResponsePage { + return original.NewMonitoringTagRulesListResponsePage(cur, getNextPage) +} +func NewMonitorsClient(subscriptionID string) MonitorsClient { + return original.NewMonitorsClient(subscriptionID) +} +func NewMonitorsClientWithBaseURI(baseURI string, subscriptionID string) MonitorsClient { + return original.NewMonitorsClientWithBaseURI(baseURI, subscriptionID) +} +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return original.NewOperationListResultIterator(page) +} +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return original.NewOperationListResultPage(cur, getNextPage) +} +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) +} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewTagRulesClient(subscriptionID string) TagRulesClient { + return original.NewTagRulesClient(subscriptionID) +} +func NewTagRulesClientWithBaseURI(baseURI string, subscriptionID string) TagRulesClient { + return original.NewTagRulesClientWithBaseURI(baseURI, subscriptionID) +} +func NewVMCollectionClient(subscriptionID string) VMCollectionClient { + return original.NewVMCollectionClient(subscriptionID) +} +func NewVMCollectionClientWithBaseURI(baseURI string, subscriptionID string) VMCollectionClient { + return original.NewVMCollectionClientWithBaseURI(baseURI, subscriptionID) +} +func NewVMHostClient(subscriptionID string) VMHostClient { + return original.NewVMHostClient(subscriptionID) +} +func NewVMHostClientWithBaseURI(baseURI string, subscriptionID string) VMHostClient { + return original.NewVMHostClientWithBaseURI(baseURI, subscriptionID) +} +func NewVMHostListResponseIterator(page VMHostListResponsePage) VMHostListResponseIterator { + return original.NewVMHostListResponseIterator(page) +} +func NewVMHostListResponsePage(cur VMHostListResponse, getNextPage func(context.Context, VMHostListResponse) (VMHostListResponse, error)) VMHostListResponsePage { + return original.NewVMHostListResponsePage(cur, getNextPage) +} +func NewVMIngestionClient(subscriptionID string) VMIngestionClient { + return original.NewVMIngestionClient(subscriptionID) +} +func NewVMIngestionClientWithBaseURI(baseURI string, subscriptionID string) VMIngestionClient { + return original.NewVMIngestionClientWithBaseURI(baseURI, subscriptionID) +} +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) +} +func PossibleCreatedByTypeValues() []CreatedByType { + return original.PossibleCreatedByTypeValues() +} +func PossibleDeploymentStatusValues() []DeploymentStatus { + return original.PossibleDeploymentStatusValues() +} +func PossibleLiftrResourceCategoriesValues() []LiftrResourceCategories { + return original.PossibleLiftrResourceCategoriesValues() +} +func PossibleManagedIdentityTypesValues() []ManagedIdentityTypes { + return original.PossibleManagedIdentityTypesValues() +} +func PossibleMonitoringStatusValues() []MonitoringStatus { + return original.PossibleMonitoringStatusValues() +} +func PossibleOperationNameValues() []OperationName { + return original.PossibleOperationNameValues() +} +func PossibleProvisioningStateValues() []ProvisioningState { + return original.PossibleProvisioningStateValues() +} +func PossibleSendingLogsValues() []SendingLogs { + return original.PossibleSendingLogsValues() +} +func PossibleTagActionValues() []TagAction { + return original.PossibleTagActionValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/latest" +} +func Version() string { + return original.Version() +} diff --git a/profiles/latest/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/models.go b/profiles/latest/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/models.go index 13318a79759f..692c09a43d39 100644 --- a/profiles/latest/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/models.go +++ b/profiles/latest/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/models.go @@ -12,13 +12,22 @@ package virtualmachineimagebuilder import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/virtualmachineimagebuilder/mgmt/2020-02-14/virtualmachineimagebuilder" + original "github.com/Azure/azure-sdk-for-go/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder" ) 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 ProvisioningErrorCode = original.ProvisioningErrorCode const ( @@ -108,12 +117,13 @@ const ( TypeBasicImageTemplateDistributorTypeVHD TypeBasicImageTemplateDistributor = original.TypeBasicImageTemplateDistributorTypeVHD ) -type APIError = original.APIError -type APIErrorBase = original.APIErrorBase +type AzureEntityResource = original.AzureEntityResource type BaseClient = original.BaseClient type BasicImageTemplateCustomizer = original.BasicImageTemplateCustomizer type BasicImageTemplateDistributor = original.BasicImageTemplateDistributor type BasicImageTemplateSource = original.BasicImageTemplateSource +type CloudError = original.CloudError +type CloudErrorBody = original.CloudErrorBody type ImageTemplate = original.ImageTemplate type ImageTemplateCustomizer = original.ImageTemplateCustomizer type ImageTemplateDistributor = original.ImageTemplateDistributor @@ -138,7 +148,6 @@ type ImageTemplateUpdateParameters = original.ImageTemplateUpdateParameters type ImageTemplateVMProfile = original.ImageTemplateVMProfile type ImageTemplateVhdDistributor = original.ImageTemplateVhdDistributor type ImageTemplateWindowsUpdateCustomizer = original.ImageTemplateWindowsUpdateCustomizer -type InnerError = original.InnerError type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult @@ -147,6 +156,7 @@ type OperationListResultPage = original.OperationListResultPage type OperationsClient = original.OperationsClient type PlatformImagePurchasePlan = original.PlatformImagePurchasePlan type ProvisioningError = original.ProvisioningError +type ProxyResource = original.ProxyResource type Resource = original.Resource type RunOutput = original.RunOutput type RunOutputCollection = original.RunOutputCollection @@ -154,6 +164,8 @@ type RunOutputCollectionIterator = original.RunOutputCollectionIterator type RunOutputCollectionPage = original.RunOutputCollectionPage type RunOutputProperties = original.RunOutputProperties type SubResource = original.SubResource +type SystemData = original.SystemData +type TrackedResource = original.TrackedResource type VirtualMachineImageTemplatesCancelFuture = original.VirtualMachineImageTemplatesCancelFuture type VirtualMachineImageTemplatesClient = original.VirtualMachineImageTemplatesClient type VirtualMachineImageTemplatesCreateOrUpdateFuture = original.VirtualMachineImageTemplatesCreateOrUpdateFuture @@ -198,6 +210,9 @@ func NewVirtualMachineImageTemplatesClientWithBaseURI(baseURI string, subscripti func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } +func PossibleCreatedByTypeValues() []CreatedByType { + return original.PossibleCreatedByTypeValues() +} func PossibleProvisioningErrorCodeValues() []ProvisioningErrorCode { return original.PossibleProvisioningErrorCodeValues() } diff --git a/profiles/latest/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/virtualmachineimagebuilderapi/models.go b/profiles/latest/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/virtualmachineimagebuilderapi/models.go index 4cdda4fbfc19..871adbaeef5d 100644 --- a/profiles/latest/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/virtualmachineimagebuilderapi/models.go +++ b/profiles/latest/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/virtualmachineimagebuilderapi/models.go @@ -9,7 +9,7 @@ package virtualmachineimagebuilderapi -import original "github.com/Azure/azure-sdk-for-go/services/virtualmachineimagebuilder/mgmt/2020-02-14/virtualmachineimagebuilder/virtualmachineimagebuilderapi" +import original "github.com/Azure/azure-sdk-for-go/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/virtualmachineimagebuilderapi" type OperationsClientAPI = original.OperationsClientAPI type VirtualMachineImageTemplatesClientAPI = original.VirtualMachineImageTemplatesClientAPI diff --git a/profiles/preview/elastic/mgmt/elastic/elasticapi/models.go b/profiles/preview/elastic/mgmt/elastic/elasticapi/models.go new file mode 100644 index 000000000000..dbb70687d2ac --- /dev/null +++ b/profiles/preview/elastic/mgmt/elastic/elasticapi/models.go @@ -0,0 +1,21 @@ +//go:build go1.9 +// +build go1.9 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/eng/tools/profileBuilder + +package elasticapi + +import original "github.com/Azure/azure-sdk-for-go/services/elastic/mgmt/2020-07-01/elastic/elasticapi" + +type DeploymentInfoClientAPI = original.DeploymentInfoClientAPI +type MonitoredResourcesClientAPI = original.MonitoredResourcesClientAPI +type MonitorsClientAPI = original.MonitorsClientAPI +type OperationsClientAPI = original.OperationsClientAPI +type TagRulesClientAPI = original.TagRulesClientAPI +type VMCollectionClientAPI = original.VMCollectionClientAPI +type VMHostClientAPI = original.VMHostClientAPI +type VMIngestionClientAPI = original.VMIngestionClientAPI diff --git a/profiles/preview/elastic/mgmt/elastic/models.go b/profiles/preview/elastic/mgmt/elastic/models.go new file mode 100644 index 000000000000..499852190401 --- /dev/null +++ b/profiles/preview/elastic/mgmt/elastic/models.go @@ -0,0 +1,261 @@ +//go:build go1.9 +// +build go1.9 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This code was auto-generated by: +// github.com/Azure/azure-sdk-for-go/eng/tools/profileBuilder + +package elastic + +import ( + "context" + + original "github.com/Azure/azure-sdk-for-go/services/elastic/mgmt/2020-07-01/elastic" +) + +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 DeploymentStatus = original.DeploymentStatus + +const ( + DeploymentStatusHealthy DeploymentStatus = original.DeploymentStatusHealthy + DeploymentStatusUnhealthy DeploymentStatus = original.DeploymentStatusUnhealthy +) + +type LiftrResourceCategories = original.LiftrResourceCategories + +const ( + LiftrResourceCategoriesMonitorLogs LiftrResourceCategories = original.LiftrResourceCategoriesMonitorLogs + LiftrResourceCategoriesUnknown LiftrResourceCategories = original.LiftrResourceCategoriesUnknown +) + +type ManagedIdentityTypes = original.ManagedIdentityTypes + +const ( + ManagedIdentityTypesSystemAssigned ManagedIdentityTypes = original.ManagedIdentityTypesSystemAssigned +) + +type MonitoringStatus = original.MonitoringStatus + +const ( + MonitoringStatusDisabled MonitoringStatus = original.MonitoringStatusDisabled + MonitoringStatusEnabled MonitoringStatus = original.MonitoringStatusEnabled +) + +type OperationName = original.OperationName + +const ( + OperationNameAdd OperationName = original.OperationNameAdd + OperationNameDelete OperationName = original.OperationNameDelete +) + +type ProvisioningState = original.ProvisioningState + +const ( + ProvisioningStateAccepted ProvisioningState = original.ProvisioningStateAccepted + ProvisioningStateCanceled ProvisioningState = original.ProvisioningStateCanceled + ProvisioningStateCreating ProvisioningState = original.ProvisioningStateCreating + ProvisioningStateDeleted ProvisioningState = original.ProvisioningStateDeleted + ProvisioningStateDeleting ProvisioningState = original.ProvisioningStateDeleting + ProvisioningStateFailed ProvisioningState = original.ProvisioningStateFailed + ProvisioningStateNotSpecified ProvisioningState = original.ProvisioningStateNotSpecified + ProvisioningStateSucceeded ProvisioningState = original.ProvisioningStateSucceeded + ProvisioningStateUpdating ProvisioningState = original.ProvisioningStateUpdating +) + +type SendingLogs = original.SendingLogs + +const ( + SendingLogsFalse SendingLogs = original.SendingLogsFalse + SendingLogsTrue SendingLogs = original.SendingLogsTrue +) + +type TagAction = original.TagAction + +const ( + TagActionExclude TagAction = original.TagActionExclude + TagActionInclude TagAction = original.TagActionInclude +) + +type BaseClient = original.BaseClient +type CloudDeployment = original.CloudDeployment +type CloudUser = original.CloudUser +type CompanyInfo = original.CompanyInfo +type DeploymentInfoClient = original.DeploymentInfoClient +type DeploymentInfoResponse = original.DeploymentInfoResponse +type ErrorResponseBody = original.ErrorResponseBody +type FilteringTag = original.FilteringTag +type IdentityProperties = original.IdentityProperties +type LogRules = original.LogRules +type MonitorProperties = original.MonitorProperties +type MonitorResource = original.MonitorResource +type MonitorResourceListResponse = original.MonitorResourceListResponse +type MonitorResourceListResponseIterator = original.MonitorResourceListResponseIterator +type MonitorResourceListResponsePage = original.MonitorResourceListResponsePage +type MonitorResourceUpdateParameters = original.MonitorResourceUpdateParameters +type MonitoredResource = original.MonitoredResource +type MonitoredResourceListResponse = original.MonitoredResourceListResponse +type MonitoredResourceListResponseIterator = original.MonitoredResourceListResponseIterator +type MonitoredResourceListResponsePage = original.MonitoredResourceListResponsePage +type MonitoredResourcesClient = original.MonitoredResourcesClient +type MonitoringTagRules = original.MonitoringTagRules +type MonitoringTagRulesListResponse = original.MonitoringTagRulesListResponse +type MonitoringTagRulesListResponseIterator = original.MonitoringTagRulesListResponseIterator +type MonitoringTagRulesListResponsePage = original.MonitoringTagRulesListResponsePage +type MonitoringTagRulesProperties = original.MonitoringTagRulesProperties +type MonitorsClient = original.MonitorsClient +type MonitorsCreateFuture = original.MonitorsCreateFuture +type MonitorsDeleteFuture = original.MonitorsDeleteFuture +type OperationDisplay = original.OperationDisplay +type OperationListResult = original.OperationListResult +type OperationListResultIterator = original.OperationListResultIterator +type OperationListResultPage = original.OperationListResultPage +type OperationResult = original.OperationResult +type OperationsClient = original.OperationsClient +type Properties = original.Properties +type ResourceProviderDefaultErrorResponse = original.ResourceProviderDefaultErrorResponse +type ResourceSku = original.ResourceSku +type SystemData = original.SystemData +type TagRulesClient = original.TagRulesClient +type TagRulesDeleteFuture = original.TagRulesDeleteFuture +type UserInfo = original.UserInfo +type VMCollectionClient = original.VMCollectionClient +type VMCollectionUpdate = original.VMCollectionUpdate +type VMHostClient = original.VMHostClient +type VMHostListResponse = original.VMHostListResponse +type VMHostListResponseIterator = original.VMHostListResponseIterator +type VMHostListResponsePage = original.VMHostListResponsePage +type VMIngestionClient = original.VMIngestionClient +type VMIngestionDetailsResponse = original.VMIngestionDetailsResponse +type VMResources = original.VMResources + +func New(subscriptionID string) BaseClient { + return original.New(subscriptionID) +} +func NewDeploymentInfoClient(subscriptionID string) DeploymentInfoClient { + return original.NewDeploymentInfoClient(subscriptionID) +} +func NewDeploymentInfoClientWithBaseURI(baseURI string, subscriptionID string) DeploymentInfoClient { + return original.NewDeploymentInfoClientWithBaseURI(baseURI, subscriptionID) +} +func NewMonitorResourceListResponseIterator(page MonitorResourceListResponsePage) MonitorResourceListResponseIterator { + return original.NewMonitorResourceListResponseIterator(page) +} +func NewMonitorResourceListResponsePage(cur MonitorResourceListResponse, getNextPage func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error)) MonitorResourceListResponsePage { + return original.NewMonitorResourceListResponsePage(cur, getNextPage) +} +func NewMonitoredResourceListResponseIterator(page MonitoredResourceListResponsePage) MonitoredResourceListResponseIterator { + return original.NewMonitoredResourceListResponseIterator(page) +} +func NewMonitoredResourceListResponsePage(cur MonitoredResourceListResponse, getNextPage func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error)) MonitoredResourceListResponsePage { + return original.NewMonitoredResourceListResponsePage(cur, getNextPage) +} +func NewMonitoredResourcesClient(subscriptionID string) MonitoredResourcesClient { + return original.NewMonitoredResourcesClient(subscriptionID) +} +func NewMonitoredResourcesClientWithBaseURI(baseURI string, subscriptionID string) MonitoredResourcesClient { + return original.NewMonitoredResourcesClientWithBaseURI(baseURI, subscriptionID) +} +func NewMonitoringTagRulesListResponseIterator(page MonitoringTagRulesListResponsePage) MonitoringTagRulesListResponseIterator { + return original.NewMonitoringTagRulesListResponseIterator(page) +} +func NewMonitoringTagRulesListResponsePage(cur MonitoringTagRulesListResponse, getNextPage func(context.Context, MonitoringTagRulesListResponse) (MonitoringTagRulesListResponse, error)) MonitoringTagRulesListResponsePage { + return original.NewMonitoringTagRulesListResponsePage(cur, getNextPage) +} +func NewMonitorsClient(subscriptionID string) MonitorsClient { + return original.NewMonitorsClient(subscriptionID) +} +func NewMonitorsClientWithBaseURI(baseURI string, subscriptionID string) MonitorsClient { + return original.NewMonitorsClientWithBaseURI(baseURI, subscriptionID) +} +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return original.NewOperationListResultIterator(page) +} +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return original.NewOperationListResultPage(cur, getNextPage) +} +func NewOperationsClient(subscriptionID string) OperationsClient { + return original.NewOperationsClient(subscriptionID) +} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) +} +func NewTagRulesClient(subscriptionID string) TagRulesClient { + return original.NewTagRulesClient(subscriptionID) +} +func NewTagRulesClientWithBaseURI(baseURI string, subscriptionID string) TagRulesClient { + return original.NewTagRulesClientWithBaseURI(baseURI, subscriptionID) +} +func NewVMCollectionClient(subscriptionID string) VMCollectionClient { + return original.NewVMCollectionClient(subscriptionID) +} +func NewVMCollectionClientWithBaseURI(baseURI string, subscriptionID string) VMCollectionClient { + return original.NewVMCollectionClientWithBaseURI(baseURI, subscriptionID) +} +func NewVMHostClient(subscriptionID string) VMHostClient { + return original.NewVMHostClient(subscriptionID) +} +func NewVMHostClientWithBaseURI(baseURI string, subscriptionID string) VMHostClient { + return original.NewVMHostClientWithBaseURI(baseURI, subscriptionID) +} +func NewVMHostListResponseIterator(page VMHostListResponsePage) VMHostListResponseIterator { + return original.NewVMHostListResponseIterator(page) +} +func NewVMHostListResponsePage(cur VMHostListResponse, getNextPage func(context.Context, VMHostListResponse) (VMHostListResponse, error)) VMHostListResponsePage { + return original.NewVMHostListResponsePage(cur, getNextPage) +} +func NewVMIngestionClient(subscriptionID string) VMIngestionClient { + return original.NewVMIngestionClient(subscriptionID) +} +func NewVMIngestionClientWithBaseURI(baseURI string, subscriptionID string) VMIngestionClient { + return original.NewVMIngestionClientWithBaseURI(baseURI, subscriptionID) +} +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return original.NewWithBaseURI(baseURI, subscriptionID) +} +func PossibleCreatedByTypeValues() []CreatedByType { + return original.PossibleCreatedByTypeValues() +} +func PossibleDeploymentStatusValues() []DeploymentStatus { + return original.PossibleDeploymentStatusValues() +} +func PossibleLiftrResourceCategoriesValues() []LiftrResourceCategories { + return original.PossibleLiftrResourceCategoriesValues() +} +func PossibleManagedIdentityTypesValues() []ManagedIdentityTypes { + return original.PossibleManagedIdentityTypesValues() +} +func PossibleMonitoringStatusValues() []MonitoringStatus { + return original.PossibleMonitoringStatusValues() +} +func PossibleOperationNameValues() []OperationName { + return original.PossibleOperationNameValues() +} +func PossibleProvisioningStateValues() []ProvisioningState { + return original.PossibleProvisioningStateValues() +} +func PossibleSendingLogsValues() []SendingLogs { + return original.PossibleSendingLogsValues() +} +func PossibleTagActionValues() []TagAction { + return original.PossibleTagActionValues() +} +func UserAgent() string { + return original.UserAgent() + " profiles/preview" +} +func Version() string { + return original.Version() +} diff --git a/profiles/preview/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/models.go b/profiles/preview/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/models.go index c7f06f2e0d71..5d52ed923a48 100644 --- a/profiles/preview/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/models.go +++ b/profiles/preview/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/models.go @@ -12,13 +12,22 @@ package virtualmachineimagebuilder import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/virtualmachineimagebuilder/mgmt/2020-02-14/virtualmachineimagebuilder" + original "github.com/Azure/azure-sdk-for-go/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder" ) 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 ProvisioningErrorCode = original.ProvisioningErrorCode const ( @@ -108,12 +117,13 @@ const ( TypeBasicImageTemplateDistributorTypeVHD TypeBasicImageTemplateDistributor = original.TypeBasicImageTemplateDistributorTypeVHD ) -type APIError = original.APIError -type APIErrorBase = original.APIErrorBase +type AzureEntityResource = original.AzureEntityResource type BaseClient = original.BaseClient type BasicImageTemplateCustomizer = original.BasicImageTemplateCustomizer type BasicImageTemplateDistributor = original.BasicImageTemplateDistributor type BasicImageTemplateSource = original.BasicImageTemplateSource +type CloudError = original.CloudError +type CloudErrorBody = original.CloudErrorBody type ImageTemplate = original.ImageTemplate type ImageTemplateCustomizer = original.ImageTemplateCustomizer type ImageTemplateDistributor = original.ImageTemplateDistributor @@ -138,7 +148,6 @@ type ImageTemplateUpdateParameters = original.ImageTemplateUpdateParameters type ImageTemplateVMProfile = original.ImageTemplateVMProfile type ImageTemplateVhdDistributor = original.ImageTemplateVhdDistributor type ImageTemplateWindowsUpdateCustomizer = original.ImageTemplateWindowsUpdateCustomizer -type InnerError = original.InnerError type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult @@ -147,6 +156,7 @@ type OperationListResultPage = original.OperationListResultPage type OperationsClient = original.OperationsClient type PlatformImagePurchasePlan = original.PlatformImagePurchasePlan type ProvisioningError = original.ProvisioningError +type ProxyResource = original.ProxyResource type Resource = original.Resource type RunOutput = original.RunOutput type RunOutputCollection = original.RunOutputCollection @@ -154,6 +164,8 @@ type RunOutputCollectionIterator = original.RunOutputCollectionIterator type RunOutputCollectionPage = original.RunOutputCollectionPage type RunOutputProperties = original.RunOutputProperties type SubResource = original.SubResource +type SystemData = original.SystemData +type TrackedResource = original.TrackedResource type VirtualMachineImageTemplatesCancelFuture = original.VirtualMachineImageTemplatesCancelFuture type VirtualMachineImageTemplatesClient = original.VirtualMachineImageTemplatesClient type VirtualMachineImageTemplatesCreateOrUpdateFuture = original.VirtualMachineImageTemplatesCreateOrUpdateFuture @@ -198,6 +210,9 @@ func NewVirtualMachineImageTemplatesClientWithBaseURI(baseURI string, subscripti func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } +func PossibleCreatedByTypeValues() []CreatedByType { + return original.PossibleCreatedByTypeValues() +} func PossibleProvisioningErrorCodeValues() []ProvisioningErrorCode { return original.PossibleProvisioningErrorCodeValues() } diff --git a/profiles/preview/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/virtualmachineimagebuilderapi/models.go b/profiles/preview/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/virtualmachineimagebuilderapi/models.go index 4cdda4fbfc19..871adbaeef5d 100644 --- a/profiles/preview/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/virtualmachineimagebuilderapi/models.go +++ b/profiles/preview/virtualmachineimagebuilder/mgmt/virtualmachineimagebuilder/virtualmachineimagebuilderapi/models.go @@ -9,7 +9,7 @@ package virtualmachineimagebuilderapi -import original "github.com/Azure/azure-sdk-for-go/services/virtualmachineimagebuilder/mgmt/2020-02-14/virtualmachineimagebuilder/virtualmachineimagebuilderapi" +import original "github.com/Azure/azure-sdk-for-go/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/virtualmachineimagebuilderapi" type OperationsClientAPI = original.OperationsClientAPI type VirtualMachineImageTemplatesClientAPI = original.VirtualMachineImageTemplatesClientAPI diff --git a/services/elastic/mgmt/2020-07-01/elastic/CHANGELOG.md b/services/elastic/mgmt/2020-07-01/elastic/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/elastic/mgmt/2020-07-01/elastic/_meta.json b/services/elastic/mgmt/2020-07-01/elastic/_meta.json new file mode 100644 index 000000000000..5936b4ce3d47 --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "fe0ddc1279ffbfc3b971ba46d4c62ed597b571ae", + "readme": "/_/azure-rest-api-specs/specification/elastic/resource-manager/readme.md", + "tag": "package-2020-07-01", + "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-2020-07-01 --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/elastic/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/elastic/mgmt/2020-07-01/elastic/client.go b/services/elastic/mgmt/2020-07-01/elastic/client.go new file mode 100644 index 000000000000..b82b428912f7 --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/client.go @@ -0,0 +1,41 @@ +// Package elastic implements the Azure ARM Elastic service API version 2020-07-01. +// +// +package elastic + +// 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 Elastic + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Elastic. +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/elastic/mgmt/2020-07-01/elastic/deploymentinfo.go b/services/elastic/mgmt/2020-07-01/elastic/deploymentinfo.go new file mode 100644 index 000000000000..96bf961a12fa --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/deploymentinfo.go @@ -0,0 +1,107 @@ +package elastic + +// 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" +) + +// DeploymentInfoClient is the client for the DeploymentInfo methods of the Elastic service. +type DeploymentInfoClient struct { + BaseClient +} + +// NewDeploymentInfoClient creates an instance of the DeploymentInfoClient client. +func NewDeploymentInfoClient(subscriptionID string) DeploymentInfoClient { + return NewDeploymentInfoClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeploymentInfoClientWithBaseURI creates an instance of the DeploymentInfoClient 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 NewDeploymentInfoClientWithBaseURI(baseURI string, subscriptionID string) DeploymentInfoClient { + return DeploymentInfoClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +func (client DeploymentInfoClient) List(ctx context.Context, resourceGroupName string, monitorName string) (result DeploymentInfoResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentInfoClient.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, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.DeploymentInfoClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "elastic.DeploymentInfoClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.DeploymentInfoClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DeploymentInfoClient) ListPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-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.Elastic/monitors/{monitorName}/listDeploymentInfo", 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 DeploymentInfoClient) 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 DeploymentInfoClient) ListResponder(resp *http.Response) (result DeploymentInfoResponse, 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/elastic/mgmt/2020-07-01/elastic/elasticapi/interfaces.go b/services/elastic/mgmt/2020-07-01/elastic/elasticapi/interfaces.go new file mode 100644 index 000000000000..3c0322650377 --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/elasticapi/interfaces.go @@ -0,0 +1,83 @@ +package elasticapi + +// 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/elastic/mgmt/2020-07-01/elastic" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result elastic.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result elastic.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*elastic.OperationsClient)(nil) + +// MonitorsClientAPI contains the set of methods on the MonitorsClient type. +type MonitorsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, monitorName string, body *elastic.MonitorResource) (result elastic.MonitorsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, monitorName string) (result elastic.MonitorsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, monitorName string) (result elastic.MonitorResource, err error) + List(ctx context.Context) (result elastic.MonitorResourceListResponsePage, err error) + ListComplete(ctx context.Context) (result elastic.MonitorResourceListResponseIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result elastic.MonitorResourceListResponsePage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result elastic.MonitorResourceListResponseIterator, err error) + Update(ctx context.Context, resourceGroupName string, monitorName string, body *elastic.MonitorResourceUpdateParameters) (result elastic.MonitorResource, err error) +} + +var _ MonitorsClientAPI = (*elastic.MonitorsClient)(nil) + +// MonitoredResourcesClientAPI contains the set of methods on the MonitoredResourcesClient type. +type MonitoredResourcesClientAPI interface { + List(ctx context.Context, resourceGroupName string, monitorName string) (result elastic.MonitoredResourceListResponsePage, err error) + ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result elastic.MonitoredResourceListResponseIterator, err error) +} + +var _ MonitoredResourcesClientAPI = (*elastic.MonitoredResourcesClient)(nil) + +// DeploymentInfoClientAPI contains the set of methods on the DeploymentInfoClient type. +type DeploymentInfoClientAPI interface { + List(ctx context.Context, resourceGroupName string, monitorName string) (result elastic.DeploymentInfoResponse, err error) +} + +var _ DeploymentInfoClientAPI = (*elastic.DeploymentInfoClient)(nil) + +// TagRulesClientAPI contains the set of methods on the TagRulesClient type. +type TagRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, body *elastic.MonitoringTagRules) (result elastic.MonitoringTagRules, err error) + Delete(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result elastic.TagRulesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result elastic.MonitoringTagRules, err error) + List(ctx context.Context, resourceGroupName string, monitorName string) (result elastic.MonitoringTagRulesListResponsePage, err error) + ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result elastic.MonitoringTagRulesListResponseIterator, err error) +} + +var _ TagRulesClientAPI = (*elastic.TagRulesClient)(nil) + +// VMHostClientAPI contains the set of methods on the VMHostClient type. +type VMHostClientAPI interface { + List(ctx context.Context, resourceGroupName string, monitorName string) (result elastic.VMHostListResponsePage, err error) + ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result elastic.VMHostListResponseIterator, err error) +} + +var _ VMHostClientAPI = (*elastic.VMHostClient)(nil) + +// VMIngestionClientAPI contains the set of methods on the VMIngestionClient type. +type VMIngestionClientAPI interface { + Details(ctx context.Context, resourceGroupName string, monitorName string) (result elastic.VMIngestionDetailsResponse, err error) +} + +var _ VMIngestionClientAPI = (*elastic.VMIngestionClient)(nil) + +// VMCollectionClientAPI contains the set of methods on the VMCollectionClient type. +type VMCollectionClientAPI interface { + Update(ctx context.Context, resourceGroupName string, monitorName string, body *elastic.VMCollectionUpdate) (result autorest.Response, err error) +} + +var _ VMCollectionClientAPI = (*elastic.VMCollectionClient)(nil) diff --git a/services/elastic/mgmt/2020-07-01/elastic/enums.go b/services/elastic/mgmt/2020-07-01/elastic/enums.go new file mode 100644 index 000000000000..0373c6ab906d --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/enums.go @@ -0,0 +1,158 @@ +package elastic + +// 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} +} + +// DeploymentStatus enumerates the values for deployment status. +type DeploymentStatus string + +const ( + // DeploymentStatusHealthy ... + DeploymentStatusHealthy DeploymentStatus = "Healthy" + // DeploymentStatusUnhealthy ... + DeploymentStatusUnhealthy DeploymentStatus = "Unhealthy" +) + +// PossibleDeploymentStatusValues returns an array of possible values for the DeploymentStatus const type. +func PossibleDeploymentStatusValues() []DeploymentStatus { + return []DeploymentStatus{DeploymentStatusHealthy, DeploymentStatusUnhealthy} +} + +// LiftrResourceCategories enumerates the values for liftr resource categories. +type LiftrResourceCategories string + +const ( + // LiftrResourceCategoriesMonitorLogs ... + LiftrResourceCategoriesMonitorLogs LiftrResourceCategories = "MonitorLogs" + // LiftrResourceCategoriesUnknown ... + LiftrResourceCategoriesUnknown LiftrResourceCategories = "Unknown" +) + +// PossibleLiftrResourceCategoriesValues returns an array of possible values for the LiftrResourceCategories const type. +func PossibleLiftrResourceCategoriesValues() []LiftrResourceCategories { + return []LiftrResourceCategories{LiftrResourceCategoriesMonitorLogs, LiftrResourceCategoriesUnknown} +} + +// ManagedIdentityTypes enumerates the values for managed identity types. +type ManagedIdentityTypes string + +const ( + // ManagedIdentityTypesSystemAssigned ... + ManagedIdentityTypesSystemAssigned ManagedIdentityTypes = "SystemAssigned" +) + +// PossibleManagedIdentityTypesValues returns an array of possible values for the ManagedIdentityTypes const type. +func PossibleManagedIdentityTypesValues() []ManagedIdentityTypes { + return []ManagedIdentityTypes{ManagedIdentityTypesSystemAssigned} +} + +// MonitoringStatus enumerates the values for monitoring status. +type MonitoringStatus string + +const ( + // MonitoringStatusDisabled ... + MonitoringStatusDisabled MonitoringStatus = "Disabled" + // MonitoringStatusEnabled ... + MonitoringStatusEnabled MonitoringStatus = "Enabled" +) + +// PossibleMonitoringStatusValues returns an array of possible values for the MonitoringStatus const type. +func PossibleMonitoringStatusValues() []MonitoringStatus { + return []MonitoringStatus{MonitoringStatusDisabled, MonitoringStatusEnabled} +} + +// OperationName enumerates the values for operation name. +type OperationName string + +const ( + // OperationNameAdd ... + OperationNameAdd OperationName = "Add" + // OperationNameDelete ... + OperationNameDelete OperationName = "Delete" +) + +// PossibleOperationNameValues returns an array of possible values for the OperationName const type. +func PossibleOperationNameValues() []OperationName { + return []OperationName{OperationNameAdd, OperationNameDelete} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted ... + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted ... + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateNotSpecified ... + ProvisioningStateNotSpecified ProvisioningState = "NotSpecified" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateAccepted, ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateNotSpecified, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// SendingLogs enumerates the values for sending logs. +type SendingLogs string + +const ( + // SendingLogsFalse ... + SendingLogsFalse SendingLogs = "False" + // SendingLogsTrue ... + SendingLogsTrue SendingLogs = "True" +) + +// PossibleSendingLogsValues returns an array of possible values for the SendingLogs const type. +func PossibleSendingLogsValues() []SendingLogs { + return []SendingLogs{SendingLogsFalse, SendingLogsTrue} +} + +// TagAction enumerates the values for tag action. +type TagAction string + +const ( + // TagActionExclude ... + TagActionExclude TagAction = "Exclude" + // TagActionInclude ... + TagActionInclude TagAction = "Include" +) + +// PossibleTagActionValues returns an array of possible values for the TagAction const type. +func PossibleTagActionValues() []TagAction { + return []TagAction{TagActionExclude, TagActionInclude} +} diff --git a/services/elastic/mgmt/2020-07-01/elastic/models.go b/services/elastic/mgmt/2020-07-01/elastic/models.go new file mode 100644 index 000000000000..2c72030996ff --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/models.go @@ -0,0 +1,1305 @@ +package elastic + +// 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/elastic/mgmt/2020-07-01/elastic" + +// CloudDeployment details of the user's elastic deployment associated with the monitor resource. +type CloudDeployment struct { + // Name - READ-ONLY; Elastic deployment name + Name *string `json:"name,omitempty"` + // DeploymentID - READ-ONLY; Elastic deployment Id + DeploymentID *string `json:"deploymentId,omitempty"` + // AzureSubscriptionID - READ-ONLY; Associated Azure subscription Id for the elastic deployment. + AzureSubscriptionID *string `json:"azureSubscriptionId,omitempty"` + // ElasticsearchRegion - READ-ONLY; Region where Deployment at Elastic side took place. + ElasticsearchRegion *string `json:"elasticsearchRegion,omitempty"` + // ElasticsearchServiceURL - READ-ONLY; Elasticsearch ingestion endpoint of the Elastic deployment. + ElasticsearchServiceURL *string `json:"elasticsearchServiceUrl,omitempty"` + // KibanaServiceURL - READ-ONLY; Kibana endpoint of the Elastic deployment. + KibanaServiceURL *string `json:"kibanaServiceUrl,omitempty"` + // KibanaSsoURL - READ-ONLY; Kibana dashboard sso URL of the Elastic deployment. + KibanaSsoURL *string `json:"kibanaSsoUrl,omitempty"` +} + +// MarshalJSON is the custom marshaler for CloudDeployment. +func (cd CloudDeployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CloudUser details of the user's elastic account. +type CloudUser struct { + // EmailAddress - READ-ONLY; Email of the Elastic User Account. + EmailAddress *string `json:"emailAddress,omitempty"` + // ID - READ-ONLY; User Id of the elastic account of the User. + ID *string `json:"id,omitempty"` + // ElasticCloudSsoDefaultURL - READ-ONLY; Elastic cloud default dashboard sso URL of the Elastic user account. + ElasticCloudSsoDefaultURL *string `json:"elasticCloudSsoDefaultUrl,omitempty"` +} + +// MarshalJSON is the custom marshaler for CloudUser. +func (cu CloudUser) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CompanyInfo company information of the user to be passed to partners. +type CompanyInfo struct { + // Domain - Domain of the company + Domain *string `json:"domain,omitempty"` + // Business - Business of the company + Business *string `json:"business,omitempty"` + // EmployeesNumber - Number of employees in the company + EmployeesNumber *string `json:"employeesNumber,omitempty"` + // State - State of the company location. + State *string `json:"state,omitempty"` + // Country - Country of the company location. + Country *string `json:"country,omitempty"` +} + +// DeploymentInfoResponse the properties of deployment in Elastic cloud corresponding to the Elastic +// monitor resource. +type DeploymentInfoResponse struct { + autorest.Response `json:"-"` + // Status - READ-ONLY; The Elastic deployment status. Possible values include: 'DeploymentStatusHealthy', 'DeploymentStatusUnhealthy' + Status DeploymentStatus `json:"status,omitempty"` + // Version - READ-ONLY; Version of the elasticsearch in Elastic cloud deployment. + Version *string `json:"version,omitempty"` + // MemoryCapacity - READ-ONLY; RAM capacity of the elasticsearch in Elastic cloud deployment. + MemoryCapacity *string `json:"memoryCapacity,omitempty"` + // DiskCapacity - READ-ONLY; Disk capacity of the elasticsearch in Elastic cloud deployment. + DiskCapacity *string `json:"diskCapacity,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentInfoResponse. +func (dir DeploymentInfoResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponseBody error response body. +type ErrorResponseBody struct { + // Code - Error code. + Code *string `json:"code,omitempty"` + // Message - Error message. + Message *string `json:"message,omitempty"` + // Target - Error target. + Target *string `json:"target,omitempty"` + // Details - Error details. + Details *[]ErrorResponseBody `json:"details,omitempty"` +} + +// FilteringTag the definition of a filtering tag. Filtering tags are used for capturing resources and +// include/exclude them from being monitored. +type FilteringTag struct { + // Name - The name (also known as the key) of the tag. + Name *string `json:"name,omitempty"` + // Value - The value of the tag. + Value *string `json:"value,omitempty"` + // Action - Valid actions for a filtering tag. Possible values include: 'TagActionInclude', 'TagActionExclude' + Action TagAction `json:"action,omitempty"` +} + +// IdentityProperties identity properties. +type IdentityProperties struct { + // PrincipalID - READ-ONLY; The identity ID. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - Managed identity type. Possible values include: 'ManagedIdentityTypesSystemAssigned' + Type ManagedIdentityTypes `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for IdentityProperties. +func (IP IdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if IP.Type != "" { + objectMap["type"] = IP.Type + } + return json.Marshal(objectMap) +} + +// LogRules set of rules for sending logs for the Monitor resource. +type LogRules struct { + // SendAadLogs - Flag specifying if AAD logs should be sent for the Monitor resource. + SendAadLogs *bool `json:"sendAadLogs,omitempty"` + // SendSubscriptionLogs - Flag specifying if subscription logs should be sent for the Monitor resource. + SendSubscriptionLogs *bool `json:"sendSubscriptionLogs,omitempty"` + // SendActivityLogs - Flag specifying if activity logs from Azure resources should be sent for the Monitor resource. + SendActivityLogs *bool `json:"sendActivityLogs,omitempty"` + // FilteringTags - List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags. + FilteringTags *[]FilteringTag `json:"filteringTags,omitempty"` +} + +// MonitoredResource the properties of a resource currently being monitored by the Elastic monitor +// resource. +type MonitoredResource struct { + // ID - The ARM id of the resource. + ID *string `json:"id,omitempty"` + // SendingLogs - Flag indicating the status of the resource for sending logs operation to Elastic. Possible values include: 'SendingLogsTrue', 'SendingLogsFalse' + SendingLogs SendingLogs `json:"sendingLogs,omitempty"` + // ReasonForLogsStatus - Reason for why the resource is sending logs (or why it is not sending). + ReasonForLogsStatus *string `json:"reasonForLogsStatus,omitempty"` +} + +// MonitoredResourceListResponse response of a list operation. +type MonitoredResourceListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]MonitoredResource `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MonitoredResourceListResponseIterator provides access to a complete listing of MonitoredResource values. +type MonitoredResourceListResponseIterator struct { + i int + page MonitoredResourceListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MonitoredResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoredResourceListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MonitoredResourceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MonitoredResourceListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MonitoredResourceListResponseIterator) Response() MonitoredResourceListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MonitoredResourceListResponseIterator) Value() MonitoredResource { + if !iter.page.NotDone() { + return MonitoredResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MonitoredResourceListResponseIterator type. +func NewMonitoredResourceListResponseIterator(page MonitoredResourceListResponsePage) MonitoredResourceListResponseIterator { + return MonitoredResourceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mrlr MonitoredResourceListResponse) IsEmpty() bool { + return mrlr.Value == nil || len(*mrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mrlr MonitoredResourceListResponse) hasNextLink() bool { + return mrlr.NextLink != nil && len(*mrlr.NextLink) != 0 +} + +// monitoredResourceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mrlr MonitoredResourceListResponse) monitoredResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !mrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mrlr.NextLink))) +} + +// MonitoredResourceListResponsePage contains a page of MonitoredResource values. +type MonitoredResourceListResponsePage struct { + fn func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error) + mrlr MonitoredResourceListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MonitoredResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoredResourceListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mrlr) + if err != nil { + return err + } + page.mrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MonitoredResourceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MonitoredResourceListResponsePage) NotDone() bool { + return !page.mrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MonitoredResourceListResponsePage) Response() MonitoredResourceListResponse { + return page.mrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MonitoredResourceListResponsePage) Values() []MonitoredResource { + if page.mrlr.IsEmpty() { + return nil + } + return *page.mrlr.Value +} + +// Creates a new instance of the MonitoredResourceListResponsePage type. +func NewMonitoredResourceListResponsePage(cur MonitoredResourceListResponse, getNextPage func(context.Context, MonitoredResourceListResponse) (MonitoredResourceListResponse, error)) MonitoredResourceListResponsePage { + return MonitoredResourceListResponsePage{ + fn: getNextPage, + mrlr: cur, + } +} + +// MonitoringTagRules capture logs and metrics of Azure resources based on ARM tags. +type MonitoringTagRules struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; Name of the rule set. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; The id of the rule set. + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; The type of the rule set. + Type *string `json:"type,omitempty"` + // Properties - Properties of the monitoring tag rules. + Properties *MonitoringTagRulesProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to this resource + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitoringTagRules. +func (mtr MonitoringTagRules) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mtr.Properties != nil { + objectMap["properties"] = mtr.Properties + } + return json.Marshal(objectMap) +} + +// MonitoringTagRulesListResponse response of a list operation. +type MonitoringTagRulesListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]MonitoringTagRules `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MonitoringTagRulesListResponseIterator provides access to a complete listing of MonitoringTagRules +// values. +type MonitoringTagRulesListResponseIterator struct { + i int + page MonitoringTagRulesListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MonitoringTagRulesListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringTagRulesListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MonitoringTagRulesListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MonitoringTagRulesListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MonitoringTagRulesListResponseIterator) Response() MonitoringTagRulesListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MonitoringTagRulesListResponseIterator) Value() MonitoringTagRules { + if !iter.page.NotDone() { + return MonitoringTagRules{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MonitoringTagRulesListResponseIterator type. +func NewMonitoringTagRulesListResponseIterator(page MonitoringTagRulesListResponsePage) MonitoringTagRulesListResponseIterator { + return MonitoringTagRulesListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mtrlr MonitoringTagRulesListResponse) IsEmpty() bool { + return mtrlr.Value == nil || len(*mtrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mtrlr MonitoringTagRulesListResponse) hasNextLink() bool { + return mtrlr.NextLink != nil && len(*mtrlr.NextLink) != 0 +} + +// monitoringTagRulesListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mtrlr MonitoringTagRulesListResponse) monitoringTagRulesListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !mtrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mtrlr.NextLink))) +} + +// MonitoringTagRulesListResponsePage contains a page of MonitoringTagRules values. +type MonitoringTagRulesListResponsePage struct { + fn func(context.Context, MonitoringTagRulesListResponse) (MonitoringTagRulesListResponse, error) + mtrlr MonitoringTagRulesListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MonitoringTagRulesListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringTagRulesListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mtrlr) + if err != nil { + return err + } + page.mtrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MonitoringTagRulesListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MonitoringTagRulesListResponsePage) NotDone() bool { + return !page.mtrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MonitoringTagRulesListResponsePage) Response() MonitoringTagRulesListResponse { + return page.mtrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MonitoringTagRulesListResponsePage) Values() []MonitoringTagRules { + if page.mtrlr.IsEmpty() { + return nil + } + return *page.mtrlr.Value +} + +// Creates a new instance of the MonitoringTagRulesListResponsePage type. +func NewMonitoringTagRulesListResponsePage(cur MonitoringTagRulesListResponse, getNextPage func(context.Context, MonitoringTagRulesListResponse) (MonitoringTagRulesListResponse, error)) MonitoringTagRulesListResponsePage { + return MonitoringTagRulesListResponsePage{ + fn: getNextPage, + mtrlr: cur, + } +} + +// MonitoringTagRulesProperties definition of the properties for a TagRules resource. +type MonitoringTagRulesProperties struct { + // ProvisioningState - Provisioning state of the monitoring tag rules. Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted', 'ProvisioningStateNotSpecified' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // LogRules - Rules for sending logs. + LogRules *LogRules `json:"logRules,omitempty"` +} + +// MonitorProperties properties specific to the monitor resource. +type MonitorProperties struct { + // ProvisioningState - Provisioning state of the monitor resource. Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted', 'ProvisioningStateNotSpecified' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // MonitoringStatus - Flag specifying if the resource monitoring is enabled or disabled. Possible values include: 'MonitoringStatusEnabled', 'MonitoringStatusDisabled' + MonitoringStatus MonitoringStatus `json:"monitoringStatus,omitempty"` + // ElasticProperties - Elastic cloud properties. + ElasticProperties *Properties `json:"elasticProperties,omitempty"` + // UserInfo - User information. + UserInfo *UserInfo `json:"userInfo,omitempty"` + // LiftrResourceCategory - Possible values include: 'LiftrResourceCategoriesUnknown', 'LiftrResourceCategoriesMonitorLogs' + LiftrResourceCategory LiftrResourceCategories `json:"liftrResourceCategory,omitempty"` + // LiftrResourcePreference - READ-ONLY; The priority of the resource. + LiftrResourcePreference *int32 `json:"liftrResourcePreference,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitorProperties. +func (mp MonitorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.ProvisioningState != "" { + objectMap["provisioningState"] = mp.ProvisioningState + } + if mp.MonitoringStatus != "" { + objectMap["monitoringStatus"] = mp.MonitoringStatus + } + if mp.ElasticProperties != nil { + objectMap["elasticProperties"] = mp.ElasticProperties + } + if mp.UserInfo != nil { + objectMap["userInfo"] = mp.UserInfo + } + if mp.LiftrResourceCategory != "" { + objectMap["liftrResourceCategory"] = mp.LiftrResourceCategory + } + return json.Marshal(objectMap) +} + +// MonitorResource monitor resource. +type MonitorResource struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; ARM id of the monitor resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the monitor resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the monitor resource. + Type *string `json:"type,omitempty"` + // Sku - SKU of the monitor resource. + Sku *ResourceSku `json:"sku,omitempty"` + // Properties - Properties of the monitor resource. + Properties *MonitorProperties `json:"properties,omitempty"` + // Identity - Identity properties of the monitor resource. + Identity *IdentityProperties `json:"identity,omitempty"` + // Tags - The tags of the monitor resource. + Tags map[string]*string `json:"tags"` + // Location - The location of the monitor resource + Location *string `json:"location,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to this resource + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitorResource. +func (mr MonitorResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mr.Sku != nil { + objectMap["sku"] = mr.Sku + } + if mr.Properties != nil { + objectMap["properties"] = mr.Properties + } + if mr.Identity != nil { + objectMap["identity"] = mr.Identity + } + if mr.Tags != nil { + objectMap["tags"] = mr.Tags + } + if mr.Location != nil { + objectMap["location"] = mr.Location + } + return json.Marshal(objectMap) +} + +// MonitorResourceListResponse response of a list operation. +type MonitorResourceListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]MonitorResource `json:"value,omitempty"` + // NextLink - Link to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MonitorResourceListResponseIterator provides access to a complete listing of MonitorResource values. +type MonitorResourceListResponseIterator struct { + i int + page MonitorResourceListResponsePage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MonitorResourceListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorResourceListResponseIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MonitorResourceListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MonitorResourceListResponseIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MonitorResourceListResponseIterator) Response() MonitorResourceListResponse { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MonitorResourceListResponseIterator) Value() MonitorResource { + if !iter.page.NotDone() { + return MonitorResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MonitorResourceListResponseIterator type. +func NewMonitorResourceListResponseIterator(page MonitorResourceListResponsePage) MonitorResourceListResponseIterator { + return MonitorResourceListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mrlr MonitorResourceListResponse) IsEmpty() bool { + return mrlr.Value == nil || len(*mrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mrlr MonitorResourceListResponse) hasNextLink() bool { + return mrlr.NextLink != nil && len(*mrlr.NextLink) != 0 +} + +// monitorResourceListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mrlr MonitorResourceListResponse) monitorResourceListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !mrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mrlr.NextLink))) +} + +// MonitorResourceListResponsePage contains a page of MonitorResource values. +type MonitorResourceListResponsePage struct { + fn func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error) + mrlr MonitorResourceListResponse +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MonitorResourceListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorResourceListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mrlr) + if err != nil { + return err + } + page.mrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MonitorResourceListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MonitorResourceListResponsePage) NotDone() bool { + return !page.mrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MonitorResourceListResponsePage) Response() MonitorResourceListResponse { + return page.mrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MonitorResourceListResponsePage) Values() []MonitorResource { + if page.mrlr.IsEmpty() { + return nil + } + return *page.mrlr.Value +} + +// Creates a new instance of the MonitorResourceListResponsePage type. +func NewMonitorResourceListResponsePage(cur MonitorResourceListResponse, getNextPage func(context.Context, MonitorResourceListResponse) (MonitorResourceListResponse, error)) MonitorResourceListResponsePage { + return MonitorResourceListResponsePage{ + fn: getNextPage, + mrlr: cur, + } +} + +// MonitorResourceUpdateParameters monitor resource update parameters. +type MonitorResourceUpdateParameters struct { + // Tags - elastic monitor resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for MonitorResourceUpdateParameters. +func (mrup MonitorResourceUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mrup.Tags != nil { + objectMap["tags"] = mrup.Tags + } + return json.Marshal(objectMap) +} + +// MonitorsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type MonitorsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitorsClient) (MonitorResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitorsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for MonitorsCreateFuture.Result. +func (future *MonitorsCreateFuture) result(client MonitorsClient) (mr MonitorResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("elastic.MonitorsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mr.Response.Response, err = future.GetResult(sender); err == nil && mr.Response.Response.StatusCode != http.StatusNoContent { + mr, err = client.CreateResponder(mr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsCreateFuture", "Result", mr.Response.Response, "Failure responding to request") + } + } + return +} + +// MonitorsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type MonitorsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitorsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitorsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for MonitorsDeleteFuture.Result. +func (future *MonitorsDeleteFuture) result(client MonitorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("elastic.MonitorsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - Service provider, i.e., Microsoft.Elastic. + Provider *string `json:"provider,omitempty"` + // Resource - Type on which the operation is performed, e.g., 'monitors'. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type, e.g., read, write, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation, e.g., 'Write monitors'. + Description *string `json:"description,omitempty"` +} + +// OperationListResult result of GET request to list the Microsoft.Elastic operations. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of operations supported by the Microsoft.Elastic provider. + Value *[]OperationResult `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of OperationResult values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() OperationResult { + if !iter.page.NotDone() { + return OperationResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of OperationResult values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []OperationResult { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// OperationResult a Microsoft.Elastic REST API operation. +type OperationResult struct { + // Name - Operation name, i.e., {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - Origin of the operation + Origin *string `json:"origin,omitempty"` +} + +// Properties elastic Resource Properties. +type Properties struct { + // ElasticCloudUser - Details of the user's elastic account. + ElasticCloudUser *CloudUser `json:"elasticCloudUser,omitempty"` + // ElasticCloudDeployment - Details of the elastic cloud deployment. + ElasticCloudDeployment *CloudDeployment `json:"elasticCloudDeployment,omitempty"` +} + +// ResourceProviderDefaultErrorResponse RP default error response. +type ResourceProviderDefaultErrorResponse struct { + // Error - READ-ONLY; Response body of Error + Error *ErrorResponseBody `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderDefaultErrorResponse. +func (rpder ResourceProviderDefaultErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceSku microsoft.Elastic SKU. +type ResourceSku struct { + // Name - Name of the SKU. + Name *string `json:"name,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TagRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TagRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TagRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TagRulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for TagRulesDeleteFuture.Result. +func (future *TagRulesDeleteFuture) result(client TagRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.TagRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("elastic.TagRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// UserInfo user Information to be passed to partners. +type UserInfo struct { + // FirstName - First name of the user + FirstName *string `json:"firstName,omitempty"` + // LastName - Last name of the user + LastName *string `json:"lastName,omitempty"` + // CompanyName - Company name of the user + CompanyName *string `json:"companyName,omitempty"` + // EmailAddress - Email of the user used by Elastic for contacting them if needed + EmailAddress *string `json:"emailAddress,omitempty"` + // CompanyInfo - Company information of the user to be passed to partners. + CompanyInfo *CompanyInfo `json:"companyInfo,omitempty"` +} + +// VMCollectionUpdate update VM resource collection. +type VMCollectionUpdate struct { + // VMResourceID - ARM id of the VM resource. + VMResourceID *string `json:"vmResourceId,omitempty"` + // OperationName - Operation to be performed for given VM. Possible values include: 'OperationNameAdd', 'OperationNameDelete' + OperationName OperationName `json:"operationName,omitempty"` +} + +// VMHostListResponse response of a list operation. +type VMHostListResponse struct { + autorest.Response `json:"-"` + // Value - Results of a list operation. + Value *[]VMResources `json:"value,omitempty"` + // NextLink - Link to the next Vm resource Id, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// VMHostListResponseIterator provides access to a complete listing of VMResources values. +type VMHostListResponseIterator struct { + i int + page VMHostListResponsePage +} + +// 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 *VMHostListResponseIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VMHostListResponseIterator.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 *VMHostListResponseIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VMHostListResponseIterator) 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 VMHostListResponseIterator) Response() VMHostListResponse { + 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 VMHostListResponseIterator) Value() VMResources { + if !iter.page.NotDone() { + return VMResources{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VMHostListResponseIterator type. +func NewVMHostListResponseIterator(page VMHostListResponsePage) VMHostListResponseIterator { + return VMHostListResponseIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vhlr VMHostListResponse) IsEmpty() bool { + return vhlr.Value == nil || len(*vhlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vhlr VMHostListResponse) hasNextLink() bool { + return vhlr.NextLink != nil && len(*vhlr.NextLink) != 0 +} + +// vMHostListResponsePreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vhlr VMHostListResponse) vMHostListResponsePreparer(ctx context.Context) (*http.Request, error) { + if !vhlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vhlr.NextLink))) +} + +// VMHostListResponsePage contains a page of VMResources values. +type VMHostListResponsePage struct { + fn func(context.Context, VMHostListResponse) (VMHostListResponse, error) + vhlr VMHostListResponse +} + +// 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 *VMHostListResponsePage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VMHostListResponsePage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vhlr) + if err != nil { + return err + } + page.vhlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VMHostListResponsePage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VMHostListResponsePage) NotDone() bool { + return !page.vhlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VMHostListResponsePage) Response() VMHostListResponse { + return page.vhlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VMHostListResponsePage) Values() []VMResources { + if page.vhlr.IsEmpty() { + return nil + } + return *page.vhlr.Value +} + +// Creates a new instance of the VMHostListResponsePage type. +func NewVMHostListResponsePage(cur VMHostListResponse, getNextPage func(context.Context, VMHostListResponse) (VMHostListResponse, error)) VMHostListResponsePage { + return VMHostListResponsePage{ + fn: getNextPage, + vhlr: cur, + } +} + +// VMIngestionDetailsResponse the vm ingestion details to install an agent. +type VMIngestionDetailsResponse struct { + autorest.Response `json:"-"` + // CloudID - The cloudId of given Elastic monitor resource. + CloudID *string `json:"cloudId,omitempty"` + // IngestionKey - Ingestion details to install agent on given VM. + IngestionKey *string `json:"ingestionKey,omitempty"` +} + +// VMResources the vm resource properties that is currently being monitored by the Elastic monitor +// resource. +type VMResources struct { + // VMResourceID - The ARM id of the VM resource. + VMResourceID *string `json:"vmResourceId,omitempty"` +} diff --git a/services/elastic/mgmt/2020-07-01/elastic/monitoredresources.go b/services/elastic/mgmt/2020-07-01/elastic/monitoredresources.go new file mode 100644 index 000000000000..c7d2a10f24d1 --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/monitoredresources.go @@ -0,0 +1,150 @@ +package elastic + +// 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" +) + +// MonitoredResourcesClient is the client for the MonitoredResources methods of the Elastic service. +type MonitoredResourcesClient struct { + BaseClient +} + +// NewMonitoredResourcesClient creates an instance of the MonitoredResourcesClient client. +func NewMonitoredResourcesClient(subscriptionID string) MonitoredResourcesClient { + return NewMonitoredResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMonitoredResourcesClientWithBaseURI creates an instance of the MonitoredResourcesClient 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 NewMonitoredResourcesClientWithBaseURI(baseURI string, subscriptionID string) MonitoredResourcesClient { + return MonitoredResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +func (client MonitoredResourcesClient) List(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoredResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoredResourcesClient.List") + defer func() { + sc := -1 + if result.mrlr.Response.Response != nil { + sc = result.mrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitoredResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "elastic.MonitoredResourcesClient", "List", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitoredResourcesClient", "List", resp, "Failure responding to request") + return + } + if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MonitoredResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-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.Elastic/monitors/{monitorName}/listMonitoredResources", 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 MonitoredResourcesClient) 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 MonitoredResourcesClient) ListResponder(resp *http.Response) (result MonitoredResourceListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client MonitoredResourcesClient) listNextResults(ctx context.Context, lastResults MonitoredResourceListResponse) (result MonitoredResourceListResponse, err error) { + req, err := lastResults.monitoredResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "elastic.MonitoredResourcesClient", "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, "elastic.MonitoredResourcesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitoredResourcesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitoredResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoredResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoredResourcesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, monitorName) + return +} diff --git a/services/elastic/mgmt/2020-07-01/elastic/monitors.go b/services/elastic/mgmt/2020-07-01/elastic/monitors.go new file mode 100644 index 000000000000..85247d415aa6 --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/monitors.go @@ -0,0 +1,620 @@ +package elastic + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// MonitorsClient is the client for the Monitors methods of the Elastic service. +type MonitorsClient struct { + BaseClient +} + +// NewMonitorsClient creates an instance of the MonitorsClient client. +func NewMonitorsClient(subscriptionID string) MonitorsClient { + return NewMonitorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMonitorsClientWithBaseURI creates an instance of the MonitorsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewMonitorsClientWithBaseURI(baseURI string, subscriptionID string) MonitorsClient { + return MonitorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create sends the create request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +// body - elastic monitor resource model +func (client MonitorsClient) Create(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResource) (result MonitorsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: body, + Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "body.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.FirstName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.FirstName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.UserInfo.LastName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.LastName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.UserInfo.CompanyName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.CompanyName", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.UserInfo.EmailAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.EmailAddress", Name: validation.Pattern, Rule: `^([^<>()\[\]\.,;:\s@"]+(\.[^<>()\[\]\.,;:\s@"]+)*)@(([a-zA-Z-_0-9]+\.)+[a-zA-Z]{2,})$`, Chain: nil}}}, + {Target: "body.Properties.UserInfo.CompanyInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.CompanyInfo.Domain", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.CompanyInfo.Domain", Name: validation.MaxLength, Rule: 250, Chain: nil}}}, + {Target: "body.Properties.UserInfo.CompanyInfo.Business", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.CompanyInfo.Business", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.UserInfo.CompanyInfo.EmployeesNumber", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.CompanyInfo.EmployeesNumber", Name: validation.MaxLength, Rule: 20, Chain: nil}}}, + {Target: "body.Properties.UserInfo.CompanyInfo.State", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.CompanyInfo.State", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + {Target: "body.Properties.UserInfo.CompanyInfo.Country", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "body.Properties.UserInfo.CompanyInfo.Country", Name: validation.MaxLength, Rule: 50, Chain: nil}}}, + }}, + }}, + }}, + {Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("elastic.MonitorsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, monitorName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client MonitorsClient) CreatePreparer(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.ID = nil + body.Name = nil + body.Type = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) CreateSender(req *http.Request) (future MonitorsCreateFuture, err error) { + var resp *http.Response + 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 MonitorsClient) CreateResponder(resp *http.Response) (result MonitorResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +func (client MonitorsClient) Delete(ctx context.Context, resourceGroupName string, monitorName string) (result MonitorsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MonitorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-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.Elastic/monitors/{monitorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) DeleteSender(req *http.Request) (future MonitorsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MonitorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +func (client MonitorsClient) Get(ctx context.Context, resourceGroupName string, monitorName string) (result MonitorResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MonitorsClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-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.Elastic/monitors/{monitorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MonitorsClient) GetResponder(resp *http.Response) (result MonitorResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client MonitorsClient) List(ctx context.Context) (result MonitorResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.List") + defer func() { + sc := -1 + if result.mrlr.Response.Response != nil { + sc = result.mrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "List", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "List", resp, "Failure responding to request") + return + } + if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MonitorsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Elastic/monitors", 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 MonitorsClient) 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 MonitorsClient) ListResponder(resp *http.Response) (result MonitorResourceListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listNextResults(ctx context.Context, lastResults MonitorResourceListResponse) (result MonitorResourceListResponse, err error) { + req, err := lastResults.monitorResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "elastic.MonitorsClient", "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, "elastic.MonitorsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListComplete(ctx context.Context) (result MonitorResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.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 to which the Elastic resource belongs. +func (client MonitorsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result MonitorResourceListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.mrlr.Response.Response != nil { + sc = result.mrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.mrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.mrlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.mrlr.hasNextLink() && result.mrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client MonitorsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-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.Elastic/monitors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client MonitorsClient) ListByResourceGroupResponder(resp *http.Response) (result MonitorResourceListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client MonitorsClient) listByResourceGroupNextResults(ctx context.Context, lastResults MonitorResourceListResponse) (result MonitorResourceListResponse, err error) { + req, err := lastResults.monitorResourceListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "elastic.MonitorsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "elastic.MonitorsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitorsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result MonitorResourceListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +// body - elastic resource model update parameters. +func (client MonitorsClient) Update(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResourceUpdateParameters) (result MonitorResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, monitorName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.MonitorsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client MonitorsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResourceUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-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.Elastic/monitors/{monitorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client MonitorsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client MonitorsClient) UpdateResponder(resp *http.Response) (result MonitorResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/elastic/mgmt/2020-07-01/elastic/operations.go b/services/elastic/mgmt/2020-07-01/elastic/operations.go new file mode 100644 index 000000000000..02347322bb05 --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/operations.go @@ -0,0 +1,140 @@ +package elastic + +// 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 Elastic service. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.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, "elastic.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2020-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Elastic/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, "elastic.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, "elastic.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.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/elastic/mgmt/2020-07-01/elastic/tagrules.go b/services/elastic/mgmt/2020-07-01/elastic/tagrules.go new file mode 100644 index 000000000000..b4507271ffd0 --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/tagrules.go @@ -0,0 +1,395 @@ +package elastic + +// 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" +) + +// TagRulesClient is the client for the TagRules methods of the Elastic service. +type TagRulesClient struct { + BaseClient +} + +// NewTagRulesClient creates an instance of the TagRulesClient client. +func NewTagRulesClient(subscriptionID string) TagRulesClient { + return NewTagRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTagRulesClientWithBaseURI creates an instance of the TagRulesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewTagRulesClientWithBaseURI(baseURI string, subscriptionID string) TagRulesClient { + return TagRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +// ruleSetName - tag Rule Set resource name +// body - request body of MonitoringTagRules +func (client TagRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, body *MonitoringTagRules) (result MonitoringTagRules, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, monitorName, ruleSetName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.TagRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "elastic.TagRulesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.TagRulesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TagRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string, body *MonitoringTagRules) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + body.Name = nil + body.ID = nil + body.Type = nil + body.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client TagRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TagRulesClient) CreateOrUpdateResponder(resp *http.Response) (result MonitoringTagRules, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +// ruleSetName - tag Rule Set resource name +func (client TagRulesClient) Delete(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result TagRulesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, monitorName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.TagRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.TagRulesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TagRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-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.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client TagRulesClient) DeleteSender(req *http.Request) (future TagRulesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TagRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +// ruleSetName - tag Rule Set resource name +func (client TagRulesClient) Get(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (result MonitoringTagRules, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, monitorName, ruleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.TagRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "elastic.TagRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.TagRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TagRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, monitorName string, ruleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleSetName": autorest.Encode("path", ruleSetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-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.Elastic/monitors/{monitorName}/tagRules/{ruleSetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TagRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TagRulesClient) GetResponder(resp *http.Response) (result MonitoringTagRules, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +func (client TagRulesClient) List(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoringTagRulesListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.List") + defer func() { + sc := -1 + if result.mtrlr.Response.Response != nil { + sc = result.mtrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.TagRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mtrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "elastic.TagRulesClient", "List", resp, "Failure sending request") + return + } + + result.mtrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.TagRulesClient", "List", resp, "Failure responding to request") + return + } + if result.mtrlr.hasNextLink() && result.mtrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client TagRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-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.Elastic/monitors/{monitorName}/tagRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TagRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TagRulesClient) ListResponder(resp *http.Response) (result MonitoringTagRulesListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client TagRulesClient) listNextResults(ctx context.Context, lastResults MonitoringTagRulesListResponse) (result MonitoringTagRulesListResponse, err error) { + req, err := lastResults.monitoringTagRulesListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "elastic.TagRulesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "elastic.TagRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.TagRulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TagRulesClient) ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result MonitoringTagRulesListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TagRulesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, monitorName) + return +} diff --git a/services/elastic/mgmt/2020-07-01/elastic/version.go b/services/elastic/mgmt/2020-07-01/elastic/version.go new file mode 100644 index 000000000000..bf5796317cba --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/version.go @@ -0,0 +1,19 @@ +package elastic + +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() + " elastic/2020-07-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/elastic/mgmt/2020-07-01/elastic/vmcollection.go b/services/elastic/mgmt/2020-07-01/elastic/vmcollection.go new file mode 100644 index 000000000000..f851d38526ae --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/vmcollection.go @@ -0,0 +1,112 @@ +package elastic + +// 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" +) + +// VMCollectionClient is the client for the VMCollection methods of the Elastic service. +type VMCollectionClient struct { + BaseClient +} + +// NewVMCollectionClient creates an instance of the VMCollectionClient client. +func NewVMCollectionClient(subscriptionID string) VMCollectionClient { + return NewVMCollectionClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVMCollectionClientWithBaseURI creates an instance of the VMCollectionClient 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 NewVMCollectionClientWithBaseURI(baseURI string, subscriptionID string) VMCollectionClient { + return VMCollectionClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +// body - VM resource Id +func (client VMCollectionClient) Update(ctx context.Context, resourceGroupName string, monitorName string, body *VMCollectionUpdate) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VMCollectionClient.Update") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, monitorName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.VMCollectionClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "elastic.VMCollectionClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.VMCollectionClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VMCollectionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, monitorName string, body *VMCollectionUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-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.Elastic/monitors/{monitorName}/vmCollectionUpdate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if body != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(body)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client VMCollectionClient) 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 VMCollectionClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/elastic/mgmt/2020-07-01/elastic/vmhost.go b/services/elastic/mgmt/2020-07-01/elastic/vmhost.go new file mode 100644 index 000000000000..02b7eae79783 --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/vmhost.go @@ -0,0 +1,149 @@ +package elastic + +// 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" +) + +// VMHostClient is the client for the VMHost methods of the Elastic service. +type VMHostClient struct { + BaseClient +} + +// NewVMHostClient creates an instance of the VMHostClient client. +func NewVMHostClient(subscriptionID string) VMHostClient { + return NewVMHostClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVMHostClientWithBaseURI creates an instance of the VMHostClient 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 NewVMHostClientWithBaseURI(baseURI string, subscriptionID string) VMHostClient { + return VMHostClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +func (client VMHostClient) List(ctx context.Context, resourceGroupName string, monitorName string) (result VMHostListResponsePage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VMHostClient.List") + defer func() { + sc := -1 + if result.vhlr.Response.Response != nil { + sc = result.vhlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.VMHostClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vhlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "elastic.VMHostClient", "List", resp, "Failure sending request") + return + } + + result.vhlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.VMHostClient", "List", resp, "Failure responding to request") + return + } + if result.vhlr.hasNextLink() && result.vhlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VMHostClient) ListPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-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.Elastic/monitors/{monitorName}/listVMHost", 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 VMHostClient) 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 VMHostClient) ListResponder(resp *http.Response) (result VMHostListResponse, 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 VMHostClient) listNextResults(ctx context.Context, lastResults VMHostListResponse) (result VMHostListResponse, err error) { + req, err := lastResults.vMHostListResponsePreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "elastic.VMHostClient", "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, "elastic.VMHostClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.VMHostClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VMHostClient) ListComplete(ctx context.Context, resourceGroupName string, monitorName string) (result VMHostListResponseIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VMHostClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, monitorName) + return +} diff --git a/services/elastic/mgmt/2020-07-01/elastic/vmingestion.go b/services/elastic/mgmt/2020-07-01/elastic/vmingestion.go new file mode 100644 index 000000000000..68fb8e6b19e1 --- /dev/null +++ b/services/elastic/mgmt/2020-07-01/elastic/vmingestion.go @@ -0,0 +1,107 @@ +package elastic + +// 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" +) + +// VMIngestionClient is the client for the VMIngestion methods of the Elastic service. +type VMIngestionClient struct { + BaseClient +} + +// NewVMIngestionClient creates an instance of the VMIngestionClient client. +func NewVMIngestionClient(subscriptionID string) VMIngestionClient { + return NewVMIngestionClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVMIngestionClientWithBaseURI creates an instance of the VMIngestionClient 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 NewVMIngestionClientWithBaseURI(baseURI string, subscriptionID string) VMIngestionClient { + return VMIngestionClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Details sends the details request. +// Parameters: +// resourceGroupName - the name of the resource group to which the Elastic resource belongs. +// monitorName - monitor resource name +func (client VMIngestionClient) Details(ctx context.Context, resourceGroupName string, monitorName string) (result VMIngestionDetailsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VMIngestionClient.Details") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DetailsPreparer(ctx, resourceGroupName, monitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.VMIngestionClient", "Details", nil, "Failure preparing request") + return + } + + resp, err := client.DetailsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "elastic.VMIngestionClient", "Details", resp, "Failure sending request") + return + } + + result, err = client.DetailsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "elastic.VMIngestionClient", "Details", resp, "Failure responding to request") + return + } + + return +} + +// DetailsPreparer prepares the Details request. +func (client VMIngestionClient) DetailsPreparer(ctx context.Context, resourceGroupName string, monitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "monitorName": autorest.Encode("path", monitorName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-07-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.Elastic/monitors/{monitorName}/vmIngestionDetails", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetailsSender sends the Details request. The method will close the +// http.Response Body if it receives an error. +func (client VMIngestionClient) DetailsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DetailsResponder handles the response to the Details request. The method always +// closes the http.Response Body. +func (client VMIngestionClient) DetailsResponder(resp *http.Response) (result VMIngestionDetailsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/applyupdates.go b/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/applyupdates.go old mode 100755 new mode 100644 diff --git a/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/client.go b/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/client.go old mode 100755 new mode 100644 diff --git a/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/configurationassignments.go b/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/configurationassignments.go old mode 100755 new mode 100644 diff --git a/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/configurations.go b/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/configurations.go old mode 100755 new mode 100644 diff --git a/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/maintenanceapi/interfaces.go b/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/maintenanceapi/interfaces.go old mode 100755 new mode 100644 diff --git a/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/models.go b/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/models.go old mode 100755 new mode 100644 diff --git a/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/operations.go b/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/operations.go old mode 100755 new mode 100644 diff --git a/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/updates.go b/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/updates.go old mode 100755 new mode 100644 diff --git a/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/version.go b/services/preview/maintenance/mgmt/2018-06-01-preview/maintenance/version.go old mode 100755 new mode 100644 diff --git a/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/CHANGELOG.md b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/_meta.json b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/_meta.json new file mode 100644 index 000000000000..24a7593d84de --- /dev/null +++ b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "fe0ddc1279ffbfc3b971ba46d4c62ed597b571ae", + "readme": "/_/azure-rest-api-specs/specification/imagebuilder/resource-manager/readme.md", + "tag": "package-2021-10", + "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-10 --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/imagebuilder/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/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/client.go b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/client.go new file mode 100644 index 000000000000..6b8d72b201e4 --- /dev/null +++ b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/client.go @@ -0,0 +1,42 @@ +// Package virtualmachineimagebuilder implements the Azure ARM Virtualmachineimagebuilder service API version +// 2021-10-01. +// +// Azure Virtual Machine Image Builder Client +package virtualmachineimagebuilder + +// 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 Virtualmachineimagebuilder + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Virtualmachineimagebuilder. +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/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/enums.go b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/enums.go new file mode 100644 index 000000000000..ca81a54163f8 --- /dev/null +++ b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/enums.go @@ -0,0 +1,213 @@ +package virtualmachineimagebuilder + +// 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} +} + +// ProvisioningErrorCode enumerates the values for provisioning error code. +type ProvisioningErrorCode string + +const ( + // ProvisioningErrorCodeBadCustomizerType ... + ProvisioningErrorCodeBadCustomizerType ProvisioningErrorCode = "BadCustomizerType" + // ProvisioningErrorCodeBadDistributeType ... + ProvisioningErrorCodeBadDistributeType ProvisioningErrorCode = "BadDistributeType" + // ProvisioningErrorCodeBadManagedImageSource ... + ProvisioningErrorCodeBadManagedImageSource ProvisioningErrorCode = "BadManagedImageSource" + // ProvisioningErrorCodeBadPIRSource ... + ProvisioningErrorCodeBadPIRSource ProvisioningErrorCode = "BadPIRSource" + // ProvisioningErrorCodeBadSharedImageDistribute ... + ProvisioningErrorCodeBadSharedImageDistribute ProvisioningErrorCode = "BadSharedImageDistribute" + // ProvisioningErrorCodeBadSharedImageVersionSource ... + ProvisioningErrorCodeBadSharedImageVersionSource ProvisioningErrorCode = "BadSharedImageVersionSource" + // ProvisioningErrorCodeBadSourceType ... + ProvisioningErrorCodeBadSourceType ProvisioningErrorCode = "BadSourceType" + // ProvisioningErrorCodeNoCustomizerScript ... + ProvisioningErrorCodeNoCustomizerScript ProvisioningErrorCode = "NoCustomizerScript" + // ProvisioningErrorCodeOther ... + ProvisioningErrorCodeOther ProvisioningErrorCode = "Other" + // ProvisioningErrorCodeServerError ... + ProvisioningErrorCodeServerError ProvisioningErrorCode = "ServerError" + // ProvisioningErrorCodeUnsupportedCustomizerType ... + ProvisioningErrorCodeUnsupportedCustomizerType ProvisioningErrorCode = "UnsupportedCustomizerType" +) + +// PossibleProvisioningErrorCodeValues returns an array of possible values for the ProvisioningErrorCode const type. +func PossibleProvisioningErrorCodeValues() []ProvisioningErrorCode { + return []ProvisioningErrorCode{ProvisioningErrorCodeBadCustomizerType, ProvisioningErrorCodeBadDistributeType, ProvisioningErrorCodeBadManagedImageSource, ProvisioningErrorCodeBadPIRSource, ProvisioningErrorCodeBadSharedImageDistribute, ProvisioningErrorCodeBadSharedImageVersionSource, ProvisioningErrorCodeBadSourceType, ProvisioningErrorCodeNoCustomizerScript, ProvisioningErrorCodeOther, ProvisioningErrorCodeServerError, ProvisioningErrorCodeUnsupportedCustomizerType} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // 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{ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone ... + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeUserAssigned ... + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeUserAssigned} +} + +// RunState enumerates the values for run state. +type RunState string + +const ( + // RunStateCanceled ... + RunStateCanceled RunState = "Canceled" + // RunStateCanceling ... + RunStateCanceling RunState = "Canceling" + // RunStateFailed ... + RunStateFailed RunState = "Failed" + // RunStatePartiallySucceeded ... + RunStatePartiallySucceeded RunState = "PartiallySucceeded" + // RunStateRunning ... + RunStateRunning RunState = "Running" + // RunStateSucceeded ... + RunStateSucceeded RunState = "Succeeded" +) + +// PossibleRunStateValues returns an array of possible values for the RunState const type. +func PossibleRunStateValues() []RunState { + return []RunState{RunStateCanceled, RunStateCanceling, RunStateFailed, RunStatePartiallySucceeded, RunStateRunning, RunStateSucceeded} +} + +// RunSubState enumerates the values for run sub state. +type RunSubState string + +const ( + // RunSubStateBuilding ... + RunSubStateBuilding RunSubState = "Building" + // RunSubStateCustomizing ... + RunSubStateCustomizing RunSubState = "Customizing" + // RunSubStateDistributing ... + RunSubStateDistributing RunSubState = "Distributing" + // RunSubStateQueued ... + RunSubStateQueued RunSubState = "Queued" +) + +// PossibleRunSubStateValues returns an array of possible values for the RunSubState const type. +func PossibleRunSubStateValues() []RunSubState { + return []RunSubState{RunSubStateBuilding, RunSubStateCustomizing, RunSubStateDistributing, RunSubStateQueued} +} + +// SharedImageStorageAccountType enumerates the values for shared image storage account type. +type SharedImageStorageAccountType string + +const ( + // SharedImageStorageAccountTypeStandardLRS ... + SharedImageStorageAccountTypeStandardLRS SharedImageStorageAccountType = "Standard_LRS" + // SharedImageStorageAccountTypeStandardZRS ... + SharedImageStorageAccountTypeStandardZRS SharedImageStorageAccountType = "Standard_ZRS" +) + +// PossibleSharedImageStorageAccountTypeValues returns an array of possible values for the SharedImageStorageAccountType const type. +func PossibleSharedImageStorageAccountTypeValues() []SharedImageStorageAccountType { + return []SharedImageStorageAccountType{SharedImageStorageAccountTypeStandardLRS, SharedImageStorageAccountTypeStandardZRS} +} + +// Type enumerates the values for type. +type Type string + +const ( + // TypeImageTemplateSource ... + TypeImageTemplateSource Type = "ImageTemplateSource" + // TypeManagedImage ... + TypeManagedImage Type = "ManagedImage" + // TypePlatformImage ... + TypePlatformImage Type = "PlatformImage" + // TypeSharedImageVersion ... + TypeSharedImageVersion Type = "SharedImageVersion" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{TypeImageTemplateSource, TypeManagedImage, TypePlatformImage, TypeSharedImageVersion} +} + +// TypeBasicImageTemplateCustomizer enumerates the values for type basic image template customizer. +type TypeBasicImageTemplateCustomizer string + +const ( + // TypeBasicImageTemplateCustomizerTypeFile ... + TypeBasicImageTemplateCustomizerTypeFile TypeBasicImageTemplateCustomizer = "File" + // TypeBasicImageTemplateCustomizerTypeImageTemplateCustomizer ... + TypeBasicImageTemplateCustomizerTypeImageTemplateCustomizer TypeBasicImageTemplateCustomizer = "ImageTemplateCustomizer" + // TypeBasicImageTemplateCustomizerTypePowerShell ... + TypeBasicImageTemplateCustomizerTypePowerShell TypeBasicImageTemplateCustomizer = "PowerShell" + // TypeBasicImageTemplateCustomizerTypeShell ... + TypeBasicImageTemplateCustomizerTypeShell TypeBasicImageTemplateCustomizer = "Shell" + // TypeBasicImageTemplateCustomizerTypeWindowsRestart ... + TypeBasicImageTemplateCustomizerTypeWindowsRestart TypeBasicImageTemplateCustomizer = "WindowsRestart" + // TypeBasicImageTemplateCustomizerTypeWindowsUpdate ... + TypeBasicImageTemplateCustomizerTypeWindowsUpdate TypeBasicImageTemplateCustomizer = "WindowsUpdate" +) + +// PossibleTypeBasicImageTemplateCustomizerValues returns an array of possible values for the TypeBasicImageTemplateCustomizer const type. +func PossibleTypeBasicImageTemplateCustomizerValues() []TypeBasicImageTemplateCustomizer { + return []TypeBasicImageTemplateCustomizer{TypeBasicImageTemplateCustomizerTypeFile, TypeBasicImageTemplateCustomizerTypeImageTemplateCustomizer, TypeBasicImageTemplateCustomizerTypePowerShell, TypeBasicImageTemplateCustomizerTypeShell, TypeBasicImageTemplateCustomizerTypeWindowsRestart, TypeBasicImageTemplateCustomizerTypeWindowsUpdate} +} + +// TypeBasicImageTemplateDistributor enumerates the values for type basic image template distributor. +type TypeBasicImageTemplateDistributor string + +const ( + // TypeBasicImageTemplateDistributorTypeImageTemplateDistributor ... + TypeBasicImageTemplateDistributorTypeImageTemplateDistributor TypeBasicImageTemplateDistributor = "ImageTemplateDistributor" + // TypeBasicImageTemplateDistributorTypeManagedImage ... + TypeBasicImageTemplateDistributorTypeManagedImage TypeBasicImageTemplateDistributor = "ManagedImage" + // TypeBasicImageTemplateDistributorTypeSharedImage ... + TypeBasicImageTemplateDistributorTypeSharedImage TypeBasicImageTemplateDistributor = "SharedImage" + // TypeBasicImageTemplateDistributorTypeVHD ... + TypeBasicImageTemplateDistributorTypeVHD TypeBasicImageTemplateDistributor = "VHD" +) + +// PossibleTypeBasicImageTemplateDistributorValues returns an array of possible values for the TypeBasicImageTemplateDistributor const type. +func PossibleTypeBasicImageTemplateDistributorValues() []TypeBasicImageTemplateDistributor { + return []TypeBasicImageTemplateDistributor{TypeBasicImageTemplateDistributorTypeImageTemplateDistributor, TypeBasicImageTemplateDistributorTypeManagedImage, TypeBasicImageTemplateDistributorTypeSharedImage, TypeBasicImageTemplateDistributorTypeVHD} +} diff --git a/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/models.go b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/models.go new file mode 100644 index 000000000000..0a66f91a11bd --- /dev/null +++ b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/models.go @@ -0,0 +1,2337 @@ +package virtualmachineimagebuilder + +// 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/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder" + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CloudError an error response from the Azure VM Image Builder service. +type CloudError struct { + // Error - Details about the error. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the Azure VM Image Builder 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"` +} + +// ImageTemplate image template is an ARM resource managed by Microsoft.VirtualMachineImages provider +type ImageTemplate struct { + autorest.Response `json:"-"` + // ImageTemplateProperties - The properties of the image template + *ImageTemplateProperties `json:"properties,omitempty"` + // Identity - The identity of the image template, if configured. + Identity *ImageTemplateIdentity `json:"identity,omitempty"` + // SystemData - Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplate. +func (it ImageTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if it.ImageTemplateProperties != nil { + objectMap["properties"] = it.ImageTemplateProperties + } + if it.Identity != nil { + objectMap["identity"] = it.Identity + } + if it.SystemData != nil { + objectMap["systemData"] = it.SystemData + } + if it.Tags != nil { + objectMap["tags"] = it.Tags + } + if it.Location != nil { + objectMap["location"] = it.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ImageTemplate struct. +func (it *ImageTemplate) 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 imageTemplateProperties ImageTemplateProperties + err = json.Unmarshal(*v, &imageTemplateProperties) + if err != nil { + return err + } + it.ImageTemplateProperties = &imageTemplateProperties + } + case "identity": + if v != nil { + var identity ImageTemplateIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + it.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + it.SystemData = &systemData + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + it.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + it.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + it.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + it.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + it.Type = &typeVar + } + } + } + + return nil +} + +// BasicImageTemplateCustomizer describes a unit of image customization +type BasicImageTemplateCustomizer interface { + AsImageTemplateShellCustomizer() (*ImageTemplateShellCustomizer, bool) + AsImageTemplateRestartCustomizer() (*ImageTemplateRestartCustomizer, bool) + AsImageTemplateWindowsUpdateCustomizer() (*ImageTemplateWindowsUpdateCustomizer, bool) + AsImageTemplatePowerShellCustomizer() (*ImageTemplatePowerShellCustomizer, bool) + AsImageTemplateFileCustomizer() (*ImageTemplateFileCustomizer, bool) + AsImageTemplateCustomizer() (*ImageTemplateCustomizer, bool) +} + +// ImageTemplateCustomizer describes a unit of image customization +type ImageTemplateCustomizer struct { + // Name - Friendly Name to provide context on what this customization step does + Name *string `json:"name,omitempty"` + // Type - Possible values include: 'TypeBasicImageTemplateCustomizerTypeImageTemplateCustomizer', 'TypeBasicImageTemplateCustomizerTypeShell', 'TypeBasicImageTemplateCustomizerTypeWindowsRestart', 'TypeBasicImageTemplateCustomizerTypeWindowsUpdate', 'TypeBasicImageTemplateCustomizerTypePowerShell', 'TypeBasicImageTemplateCustomizerTypeFile' + Type TypeBasicImageTemplateCustomizer `json:"type,omitempty"` +} + +func unmarshalBasicImageTemplateCustomizer(body []byte) (BasicImageTemplateCustomizer, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicImageTemplateCustomizerTypeShell): + var itsc ImageTemplateShellCustomizer + err := json.Unmarshal(body, &itsc) + return itsc, err + case string(TypeBasicImageTemplateCustomizerTypeWindowsRestart): + var itrc ImageTemplateRestartCustomizer + err := json.Unmarshal(body, &itrc) + return itrc, err + case string(TypeBasicImageTemplateCustomizerTypeWindowsUpdate): + var itwuc ImageTemplateWindowsUpdateCustomizer + err := json.Unmarshal(body, &itwuc) + return itwuc, err + case string(TypeBasicImageTemplateCustomizerTypePowerShell): + var itpsc ImageTemplatePowerShellCustomizer + err := json.Unmarshal(body, &itpsc) + return itpsc, err + case string(TypeBasicImageTemplateCustomizerTypeFile): + var itfc ImageTemplateFileCustomizer + err := json.Unmarshal(body, &itfc) + return itfc, err + default: + var itc ImageTemplateCustomizer + err := json.Unmarshal(body, &itc) + return itc, err + } +} +func unmarshalBasicImageTemplateCustomizerArray(body []byte) ([]BasicImageTemplateCustomizer, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + itcArray := make([]BasicImageTemplateCustomizer, len(rawMessages)) + + for index, rawMessage := range rawMessages { + itc, err := unmarshalBasicImageTemplateCustomizer(*rawMessage) + if err != nil { + return nil, err + } + itcArray[index] = itc + } + return itcArray, nil +} + +// MarshalJSON is the custom marshaler for ImageTemplateCustomizer. +func (itc ImageTemplateCustomizer) MarshalJSON() ([]byte, error) { + itc.Type = TypeBasicImageTemplateCustomizerTypeImageTemplateCustomizer + objectMap := make(map[string]interface{}) + if itc.Name != nil { + objectMap["name"] = itc.Name + } + if itc.Type != "" { + objectMap["type"] = itc.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplateShellCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateCustomizer. +func (itc ImageTemplateCustomizer) AsImageTemplateShellCustomizer() (*ImageTemplateShellCustomizer, bool) { + return nil, false +} + +// AsImageTemplateRestartCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateCustomizer. +func (itc ImageTemplateCustomizer) AsImageTemplateRestartCustomizer() (*ImageTemplateRestartCustomizer, bool) { + return nil, false +} + +// AsImageTemplateWindowsUpdateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateCustomizer. +func (itc ImageTemplateCustomizer) AsImageTemplateWindowsUpdateCustomizer() (*ImageTemplateWindowsUpdateCustomizer, bool) { + return nil, false +} + +// AsImageTemplatePowerShellCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateCustomizer. +func (itc ImageTemplateCustomizer) AsImageTemplatePowerShellCustomizer() (*ImageTemplatePowerShellCustomizer, bool) { + return nil, false +} + +// AsImageTemplateFileCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateCustomizer. +func (itc ImageTemplateCustomizer) AsImageTemplateFileCustomizer() (*ImageTemplateFileCustomizer, bool) { + return nil, false +} + +// AsImageTemplateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateCustomizer. +func (itc ImageTemplateCustomizer) AsImageTemplateCustomizer() (*ImageTemplateCustomizer, bool) { + return &itc, true +} + +// AsBasicImageTemplateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateCustomizer. +func (itc ImageTemplateCustomizer) AsBasicImageTemplateCustomizer() (BasicImageTemplateCustomizer, bool) { + return &itc, true +} + +// BasicImageTemplateDistributor generic distribution object +type BasicImageTemplateDistributor interface { + AsImageTemplateManagedImageDistributor() (*ImageTemplateManagedImageDistributor, bool) + AsImageTemplateSharedImageDistributor() (*ImageTemplateSharedImageDistributor, bool) + AsImageTemplateVhdDistributor() (*ImageTemplateVhdDistributor, bool) + AsImageTemplateDistributor() (*ImageTemplateDistributor, bool) +} + +// ImageTemplateDistributor generic distribution object +type ImageTemplateDistributor struct { + // RunOutputName - The name to be used for the associated RunOutput. + RunOutputName *string `json:"runOutputName,omitempty"` + // ArtifactTags - Tags that will be applied to the artifact once it has been created/updated by the distributor. + ArtifactTags map[string]*string `json:"artifactTags"` + // Type - Possible values include: 'TypeBasicImageTemplateDistributorTypeImageTemplateDistributor', 'TypeBasicImageTemplateDistributorTypeManagedImage', 'TypeBasicImageTemplateDistributorTypeSharedImage', 'TypeBasicImageTemplateDistributorTypeVHD' + Type TypeBasicImageTemplateDistributor `json:"type,omitempty"` +} + +func unmarshalBasicImageTemplateDistributor(body []byte) (BasicImageTemplateDistributor, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeBasicImageTemplateDistributorTypeManagedImage): + var itmid ImageTemplateManagedImageDistributor + err := json.Unmarshal(body, &itmid) + return itmid, err + case string(TypeBasicImageTemplateDistributorTypeSharedImage): + var itsid ImageTemplateSharedImageDistributor + err := json.Unmarshal(body, &itsid) + return itsid, err + case string(TypeBasicImageTemplateDistributorTypeVHD): + var itvd ImageTemplateVhdDistributor + err := json.Unmarshal(body, &itvd) + return itvd, err + default: + var itd ImageTemplateDistributor + err := json.Unmarshal(body, &itd) + return itd, err + } +} +func unmarshalBasicImageTemplateDistributorArray(body []byte) ([]BasicImageTemplateDistributor, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + itdArray := make([]BasicImageTemplateDistributor, len(rawMessages)) + + for index, rawMessage := range rawMessages { + itd, err := unmarshalBasicImageTemplateDistributor(*rawMessage) + if err != nil { + return nil, err + } + itdArray[index] = itd + } + return itdArray, nil +} + +// MarshalJSON is the custom marshaler for ImageTemplateDistributor. +func (itd ImageTemplateDistributor) MarshalJSON() ([]byte, error) { + itd.Type = TypeBasicImageTemplateDistributorTypeImageTemplateDistributor + objectMap := make(map[string]interface{}) + if itd.RunOutputName != nil { + objectMap["runOutputName"] = itd.RunOutputName + } + if itd.ArtifactTags != nil { + objectMap["artifactTags"] = itd.ArtifactTags + } + if itd.Type != "" { + objectMap["type"] = itd.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplateManagedImageDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateDistributor. +func (itd ImageTemplateDistributor) AsImageTemplateManagedImageDistributor() (*ImageTemplateManagedImageDistributor, bool) { + return nil, false +} + +// AsImageTemplateSharedImageDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateDistributor. +func (itd ImageTemplateDistributor) AsImageTemplateSharedImageDistributor() (*ImageTemplateSharedImageDistributor, bool) { + return nil, false +} + +// AsImageTemplateVhdDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateDistributor. +func (itd ImageTemplateDistributor) AsImageTemplateVhdDistributor() (*ImageTemplateVhdDistributor, bool) { + return nil, false +} + +// AsImageTemplateDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateDistributor. +func (itd ImageTemplateDistributor) AsImageTemplateDistributor() (*ImageTemplateDistributor, bool) { + return &itd, true +} + +// AsBasicImageTemplateDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateDistributor. +func (itd ImageTemplateDistributor) AsBasicImageTemplateDistributor() (BasicImageTemplateDistributor, bool) { + return &itd, true +} + +// ImageTemplateFileCustomizer uploads files to VMs (Linux, Windows). Corresponds to Packer file +// provisioner +type ImageTemplateFileCustomizer struct { + // SourceURI - The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc + SourceURI *string `json:"sourceUri,omitempty"` + // Sha256Checksum - SHA256 checksum of the file provided in the sourceUri field above + Sha256Checksum *string `json:"sha256Checksum,omitempty"` + // Destination - The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM + Destination *string `json:"destination,omitempty"` + // Name - Friendly Name to provide context on what this customization step does + Name *string `json:"name,omitempty"` + // Type - Possible values include: 'TypeBasicImageTemplateCustomizerTypeImageTemplateCustomizer', 'TypeBasicImageTemplateCustomizerTypeShell', 'TypeBasicImageTemplateCustomizerTypeWindowsRestart', 'TypeBasicImageTemplateCustomizerTypeWindowsUpdate', 'TypeBasicImageTemplateCustomizerTypePowerShell', 'TypeBasicImageTemplateCustomizerTypeFile' + Type TypeBasicImageTemplateCustomizer `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplateFileCustomizer. +func (itfc ImageTemplateFileCustomizer) MarshalJSON() ([]byte, error) { + itfc.Type = TypeBasicImageTemplateCustomizerTypeFile + objectMap := make(map[string]interface{}) + if itfc.SourceURI != nil { + objectMap["sourceUri"] = itfc.SourceURI + } + if itfc.Sha256Checksum != nil { + objectMap["sha256Checksum"] = itfc.Sha256Checksum + } + if itfc.Destination != nil { + objectMap["destination"] = itfc.Destination + } + if itfc.Name != nil { + objectMap["name"] = itfc.Name + } + if itfc.Type != "" { + objectMap["type"] = itfc.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplateShellCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateFileCustomizer. +func (itfc ImageTemplateFileCustomizer) AsImageTemplateShellCustomizer() (*ImageTemplateShellCustomizer, bool) { + return nil, false +} + +// AsImageTemplateRestartCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateFileCustomizer. +func (itfc ImageTemplateFileCustomizer) AsImageTemplateRestartCustomizer() (*ImageTemplateRestartCustomizer, bool) { + return nil, false +} + +// AsImageTemplateWindowsUpdateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateFileCustomizer. +func (itfc ImageTemplateFileCustomizer) AsImageTemplateWindowsUpdateCustomizer() (*ImageTemplateWindowsUpdateCustomizer, bool) { + return nil, false +} + +// AsImageTemplatePowerShellCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateFileCustomizer. +func (itfc ImageTemplateFileCustomizer) AsImageTemplatePowerShellCustomizer() (*ImageTemplatePowerShellCustomizer, bool) { + return nil, false +} + +// AsImageTemplateFileCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateFileCustomizer. +func (itfc ImageTemplateFileCustomizer) AsImageTemplateFileCustomizer() (*ImageTemplateFileCustomizer, bool) { + return &itfc, true +} + +// AsImageTemplateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateFileCustomizer. +func (itfc ImageTemplateFileCustomizer) AsImageTemplateCustomizer() (*ImageTemplateCustomizer, bool) { + return nil, false +} + +// AsBasicImageTemplateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateFileCustomizer. +func (itfc ImageTemplateFileCustomizer) AsBasicImageTemplateCustomizer() (BasicImageTemplateCustomizer, bool) { + return &itfc, true +} + +// ImageTemplateIdentity identity for the image template. +type ImageTemplateIdentity struct { + // Type - The type of identity used for the image template. The type 'None' will remove any identities from the image template. Possible values include: 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with the image template. 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]*ImageTemplateIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ImageTemplateIdentity. +func (iti ImageTemplateIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iti.Type != "" { + objectMap["type"] = iti.Type + } + if iti.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = iti.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ImageTemplateIdentityUserAssignedIdentitiesValue ... +type ImageTemplateIdentityUserAssignedIdentitiesValue 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 ImageTemplateIdentityUserAssignedIdentitiesValue. +func (itiAiv ImageTemplateIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ImageTemplateLastRunStatus describes the latest status of running an image template +type ImageTemplateLastRunStatus struct { + // StartTime - Start time of the last run (UTC) + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - End time of the last run (UTC) + EndTime *date.Time `json:"endTime,omitempty"` + // RunState - State of the last run. Possible values include: 'RunStateRunning', 'RunStateCanceling', 'RunStateSucceeded', 'RunStatePartiallySucceeded', 'RunStateFailed', 'RunStateCanceled' + RunState RunState `json:"runState,omitempty"` + // RunSubState - Sub-state of the last run. Possible values include: 'RunSubStateQueued', 'RunSubStateBuilding', 'RunSubStateCustomizing', 'RunSubStateDistributing' + RunSubState RunSubState `json:"runSubState,omitempty"` + // Message - Verbose information about the last run state + Message *string `json:"message,omitempty"` +} + +// ImageTemplateListResult the result of List image templates operation +type ImageTemplateListResult struct { + autorest.Response `json:"-"` + // Value - An array of image templates + Value *[]ImageTemplate `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// ImageTemplateListResultIterator provides access to a complete listing of ImageTemplate values. +type ImageTemplateListResultIterator struct { + i int + page ImageTemplateListResultPage +} + +// 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 *ImageTemplateListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImageTemplateListResultIterator.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 *ImageTemplateListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ImageTemplateListResultIterator) 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 ImageTemplateListResultIterator) Response() ImageTemplateListResult { + 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 ImageTemplateListResultIterator) Value() ImageTemplate { + if !iter.page.NotDone() { + return ImageTemplate{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ImageTemplateListResultIterator type. +func NewImageTemplateListResultIterator(page ImageTemplateListResultPage) ImageTemplateListResultIterator { + return ImageTemplateListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (itlr ImageTemplateListResult) IsEmpty() bool { + return itlr.Value == nil || len(*itlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (itlr ImageTemplateListResult) hasNextLink() bool { + return itlr.NextLink != nil && len(*itlr.NextLink) != 0 +} + +// imageTemplateListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (itlr ImageTemplateListResult) imageTemplateListResultPreparer(ctx context.Context) (*http.Request, error) { + if !itlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(itlr.NextLink))) +} + +// ImageTemplateListResultPage contains a page of ImageTemplate values. +type ImageTemplateListResultPage struct { + fn func(context.Context, ImageTemplateListResult) (ImageTemplateListResult, error) + itlr ImageTemplateListResult +} + +// 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 *ImageTemplateListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ImageTemplateListResultPage.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.itlr) + if err != nil { + return err + } + page.itlr = 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 *ImageTemplateListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ImageTemplateListResultPage) NotDone() bool { + return !page.itlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ImageTemplateListResultPage) Response() ImageTemplateListResult { + return page.itlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ImageTemplateListResultPage) Values() []ImageTemplate { + if page.itlr.IsEmpty() { + return nil + } + return *page.itlr.Value +} + +// Creates a new instance of the ImageTemplateListResultPage type. +func NewImageTemplateListResultPage(cur ImageTemplateListResult, getNextPage func(context.Context, ImageTemplateListResult) (ImageTemplateListResult, error)) ImageTemplateListResultPage { + return ImageTemplateListResultPage{ + fn: getNextPage, + itlr: cur, + } +} + +// ImageTemplateManagedImageDistributor distribute as a Managed Disk Image. +type ImageTemplateManagedImageDistributor struct { + // ImageID - Resource Id of the Managed Disk Image + ImageID *string `json:"imageId,omitempty"` + // Location - Azure location for the image, should match if image already exists + Location *string `json:"location,omitempty"` + // RunOutputName - The name to be used for the associated RunOutput. + RunOutputName *string `json:"runOutputName,omitempty"` + // ArtifactTags - Tags that will be applied to the artifact once it has been created/updated by the distributor. + ArtifactTags map[string]*string `json:"artifactTags"` + // Type - Possible values include: 'TypeBasicImageTemplateDistributorTypeImageTemplateDistributor', 'TypeBasicImageTemplateDistributorTypeManagedImage', 'TypeBasicImageTemplateDistributorTypeSharedImage', 'TypeBasicImageTemplateDistributorTypeVHD' + Type TypeBasicImageTemplateDistributor `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplateManagedImageDistributor. +func (itmid ImageTemplateManagedImageDistributor) MarshalJSON() ([]byte, error) { + itmid.Type = TypeBasicImageTemplateDistributorTypeManagedImage + objectMap := make(map[string]interface{}) + if itmid.ImageID != nil { + objectMap["imageId"] = itmid.ImageID + } + if itmid.Location != nil { + objectMap["location"] = itmid.Location + } + if itmid.RunOutputName != nil { + objectMap["runOutputName"] = itmid.RunOutputName + } + if itmid.ArtifactTags != nil { + objectMap["artifactTags"] = itmid.ArtifactTags + } + if itmid.Type != "" { + objectMap["type"] = itmid.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplateManagedImageDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateManagedImageDistributor. +func (itmid ImageTemplateManagedImageDistributor) AsImageTemplateManagedImageDistributor() (*ImageTemplateManagedImageDistributor, bool) { + return &itmid, true +} + +// AsImageTemplateSharedImageDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateManagedImageDistributor. +func (itmid ImageTemplateManagedImageDistributor) AsImageTemplateSharedImageDistributor() (*ImageTemplateSharedImageDistributor, bool) { + return nil, false +} + +// AsImageTemplateVhdDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateManagedImageDistributor. +func (itmid ImageTemplateManagedImageDistributor) AsImageTemplateVhdDistributor() (*ImageTemplateVhdDistributor, bool) { + return nil, false +} + +// AsImageTemplateDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateManagedImageDistributor. +func (itmid ImageTemplateManagedImageDistributor) AsImageTemplateDistributor() (*ImageTemplateDistributor, bool) { + return nil, false +} + +// AsBasicImageTemplateDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateManagedImageDistributor. +func (itmid ImageTemplateManagedImageDistributor) AsBasicImageTemplateDistributor() (BasicImageTemplateDistributor, bool) { + return &itmid, true +} + +// ImageTemplateManagedImageSource describes an image source that is a managed image in customer +// subscription. +type ImageTemplateManagedImageSource struct { + // ImageID - ARM resource id of the managed image in customer subscription + ImageID *string `json:"imageId,omitempty"` + // Type - Possible values include: 'TypeImageTemplateSource', 'TypePlatformImage', 'TypeManagedImage', 'TypeSharedImageVersion' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplateManagedImageSource. +func (itmis ImageTemplateManagedImageSource) MarshalJSON() ([]byte, error) { + itmis.Type = TypeManagedImage + objectMap := make(map[string]interface{}) + if itmis.ImageID != nil { + objectMap["imageId"] = itmis.ImageID + } + if itmis.Type != "" { + objectMap["type"] = itmis.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplatePlatformImageSource is the BasicImageTemplateSource implementation for ImageTemplateManagedImageSource. +func (itmis ImageTemplateManagedImageSource) AsImageTemplatePlatformImageSource() (*ImageTemplatePlatformImageSource, bool) { + return nil, false +} + +// AsImageTemplateManagedImageSource is the BasicImageTemplateSource implementation for ImageTemplateManagedImageSource. +func (itmis ImageTemplateManagedImageSource) AsImageTemplateManagedImageSource() (*ImageTemplateManagedImageSource, bool) { + return &itmis, true +} + +// AsImageTemplateSharedImageVersionSource is the BasicImageTemplateSource implementation for ImageTemplateManagedImageSource. +func (itmis ImageTemplateManagedImageSource) AsImageTemplateSharedImageVersionSource() (*ImageTemplateSharedImageVersionSource, bool) { + return nil, false +} + +// AsImageTemplateSource is the BasicImageTemplateSource implementation for ImageTemplateManagedImageSource. +func (itmis ImageTemplateManagedImageSource) AsImageTemplateSource() (*ImageTemplateSource, bool) { + return nil, false +} + +// AsBasicImageTemplateSource is the BasicImageTemplateSource implementation for ImageTemplateManagedImageSource. +func (itmis ImageTemplateManagedImageSource) AsBasicImageTemplateSource() (BasicImageTemplateSource, bool) { + return &itmis, true +} + +// ImageTemplatePlatformImageSource describes an image source from [Azure Gallery +// Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). +type ImageTemplatePlatformImageSource struct { + // Publisher - Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + Publisher *string `json:"publisher,omitempty"` + // Offer - Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + Offer *string `json:"offer,omitempty"` + // Sku - Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + Sku *string `json:"sku,omitempty"` + // Version - Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). If 'latest' is specified here, the version is evaluated when the image build takes place, not when the template is submitted. + Version *string `json:"version,omitempty"` + // ExactVersion - READ-ONLY; Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). This readonly field differs from 'version', only if the value specified in 'version' field is 'latest'. + ExactVersion *string `json:"exactVersion,omitempty"` + // PlanInfo - Optional configuration of purchase plan for platform image. + PlanInfo *PlatformImagePurchasePlan `json:"planInfo,omitempty"` + // Type - Possible values include: 'TypeImageTemplateSource', 'TypePlatformImage', 'TypeManagedImage', 'TypeSharedImageVersion' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplatePlatformImageSource. +func (itpis ImageTemplatePlatformImageSource) MarshalJSON() ([]byte, error) { + itpis.Type = TypePlatformImage + objectMap := make(map[string]interface{}) + if itpis.Publisher != nil { + objectMap["publisher"] = itpis.Publisher + } + if itpis.Offer != nil { + objectMap["offer"] = itpis.Offer + } + if itpis.Sku != nil { + objectMap["sku"] = itpis.Sku + } + if itpis.Version != nil { + objectMap["version"] = itpis.Version + } + if itpis.PlanInfo != nil { + objectMap["planInfo"] = itpis.PlanInfo + } + if itpis.Type != "" { + objectMap["type"] = itpis.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplatePlatformImageSource is the BasicImageTemplateSource implementation for ImageTemplatePlatformImageSource. +func (itpis ImageTemplatePlatformImageSource) AsImageTemplatePlatformImageSource() (*ImageTemplatePlatformImageSource, bool) { + return &itpis, true +} + +// AsImageTemplateManagedImageSource is the BasicImageTemplateSource implementation for ImageTemplatePlatformImageSource. +func (itpis ImageTemplatePlatformImageSource) AsImageTemplateManagedImageSource() (*ImageTemplateManagedImageSource, bool) { + return nil, false +} + +// AsImageTemplateSharedImageVersionSource is the BasicImageTemplateSource implementation for ImageTemplatePlatformImageSource. +func (itpis ImageTemplatePlatformImageSource) AsImageTemplateSharedImageVersionSource() (*ImageTemplateSharedImageVersionSource, bool) { + return nil, false +} + +// AsImageTemplateSource is the BasicImageTemplateSource implementation for ImageTemplatePlatformImageSource. +func (itpis ImageTemplatePlatformImageSource) AsImageTemplateSource() (*ImageTemplateSource, bool) { + return nil, false +} + +// AsBasicImageTemplateSource is the BasicImageTemplateSource implementation for ImageTemplatePlatformImageSource. +func (itpis ImageTemplatePlatformImageSource) AsBasicImageTemplateSource() (BasicImageTemplateSource, bool) { + return &itpis, true +} + +// ImageTemplatePowerShellCustomizer runs the specified PowerShell on the VM (Windows). Corresponds to +// Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified. +type ImageTemplatePowerShellCustomizer struct { + // ScriptURI - URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc + ScriptURI *string `json:"scriptUri,omitempty"` + // Sha256Checksum - SHA256 checksum of the power shell script provided in the scriptUri field above + Sha256Checksum *string `json:"sha256Checksum,omitempty"` + // Inline - Array of PowerShell commands to execute + Inline *[]string `json:"inline,omitempty"` + // RunElevated - If specified, the PowerShell script will be run with elevated privileges + RunElevated *bool `json:"runElevated,omitempty"` + // RunAsSystem - If specified, the PowerShell script will be run with elevated privileges using the Local System user. Can only be true when the runElevated field above is set to true. + RunAsSystem *bool `json:"runAsSystem,omitempty"` + // ValidExitCodes - Valid exit codes for the PowerShell script. [Default: 0] + ValidExitCodes *[]int32 `json:"validExitCodes,omitempty"` + // Name - Friendly Name to provide context on what this customization step does + Name *string `json:"name,omitempty"` + // Type - Possible values include: 'TypeBasicImageTemplateCustomizerTypeImageTemplateCustomizer', 'TypeBasicImageTemplateCustomizerTypeShell', 'TypeBasicImageTemplateCustomizerTypeWindowsRestart', 'TypeBasicImageTemplateCustomizerTypeWindowsUpdate', 'TypeBasicImageTemplateCustomizerTypePowerShell', 'TypeBasicImageTemplateCustomizerTypeFile' + Type TypeBasicImageTemplateCustomizer `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplatePowerShellCustomizer. +func (itpsc ImageTemplatePowerShellCustomizer) MarshalJSON() ([]byte, error) { + itpsc.Type = TypeBasicImageTemplateCustomizerTypePowerShell + objectMap := make(map[string]interface{}) + if itpsc.ScriptURI != nil { + objectMap["scriptUri"] = itpsc.ScriptURI + } + if itpsc.Sha256Checksum != nil { + objectMap["sha256Checksum"] = itpsc.Sha256Checksum + } + if itpsc.Inline != nil { + objectMap["inline"] = itpsc.Inline + } + if itpsc.RunElevated != nil { + objectMap["runElevated"] = itpsc.RunElevated + } + if itpsc.RunAsSystem != nil { + objectMap["runAsSystem"] = itpsc.RunAsSystem + } + if itpsc.ValidExitCodes != nil { + objectMap["validExitCodes"] = itpsc.ValidExitCodes + } + if itpsc.Name != nil { + objectMap["name"] = itpsc.Name + } + if itpsc.Type != "" { + objectMap["type"] = itpsc.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplateShellCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplatePowerShellCustomizer. +func (itpsc ImageTemplatePowerShellCustomizer) AsImageTemplateShellCustomizer() (*ImageTemplateShellCustomizer, bool) { + return nil, false +} + +// AsImageTemplateRestartCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplatePowerShellCustomizer. +func (itpsc ImageTemplatePowerShellCustomizer) AsImageTemplateRestartCustomizer() (*ImageTemplateRestartCustomizer, bool) { + return nil, false +} + +// AsImageTemplateWindowsUpdateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplatePowerShellCustomizer. +func (itpsc ImageTemplatePowerShellCustomizer) AsImageTemplateWindowsUpdateCustomizer() (*ImageTemplateWindowsUpdateCustomizer, bool) { + return nil, false +} + +// AsImageTemplatePowerShellCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplatePowerShellCustomizer. +func (itpsc ImageTemplatePowerShellCustomizer) AsImageTemplatePowerShellCustomizer() (*ImageTemplatePowerShellCustomizer, bool) { + return &itpsc, true +} + +// AsImageTemplateFileCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplatePowerShellCustomizer. +func (itpsc ImageTemplatePowerShellCustomizer) AsImageTemplateFileCustomizer() (*ImageTemplateFileCustomizer, bool) { + return nil, false +} + +// AsImageTemplateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplatePowerShellCustomizer. +func (itpsc ImageTemplatePowerShellCustomizer) AsImageTemplateCustomizer() (*ImageTemplateCustomizer, bool) { + return nil, false +} + +// AsBasicImageTemplateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplatePowerShellCustomizer. +func (itpsc ImageTemplatePowerShellCustomizer) AsBasicImageTemplateCustomizer() (BasicImageTemplateCustomizer, bool) { + return &itpsc, true +} + +// ImageTemplateProperties describes the properties of an image template +type ImageTemplateProperties struct { + // Source - Specifies the properties used to describe the source image. + Source BasicImageTemplateSource `json:"source,omitempty"` + // Customize - Specifies the properties used to describe the customization steps of the image, like Image source etc + Customize *[]BasicImageTemplateCustomizer `json:"customize,omitempty"` + // Distribute - The distribution targets where the image output needs to go to. + Distribute *[]BasicImageTemplateDistributor `json:"distribute,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ProvisioningError - READ-ONLY; Provisioning error, if any + ProvisioningError *ProvisioningError `json:"provisioningError,omitempty"` + // LastRunStatus - READ-ONLY; State of 'run' that is currently executing or was last executed. + LastRunStatus *ImageTemplateLastRunStatus `json:"lastRunStatus,omitempty"` + // BuildTimeoutInMinutes - Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). + BuildTimeoutInMinutes *int32 `json:"buildTimeoutInMinutes,omitempty"` + // VMProfile - Describes how virtual machine is set up to build images + VMProfile *ImageTemplateVMProfile `json:"vmProfile,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplateProperties. +func (itp ImageTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["source"] = itp.Source + if itp.Customize != nil { + objectMap["customize"] = itp.Customize + } + if itp.Distribute != nil { + objectMap["distribute"] = itp.Distribute + } + if itp.BuildTimeoutInMinutes != nil { + objectMap["buildTimeoutInMinutes"] = itp.BuildTimeoutInMinutes + } + if itp.VMProfile != nil { + objectMap["vmProfile"] = itp.VMProfile + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ImageTemplateProperties struct. +func (itp *ImageTemplateProperties) 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 "source": + if v != nil { + source, err := unmarshalBasicImageTemplateSource(*v) + if err != nil { + return err + } + itp.Source = source + } + case "customize": + if v != nil { + customize, err := unmarshalBasicImageTemplateCustomizerArray(*v) + if err != nil { + return err + } + itp.Customize = &customize + } + case "distribute": + if v != nil { + distribute, err := unmarshalBasicImageTemplateDistributorArray(*v) + if err != nil { + return err + } + itp.Distribute = &distribute + } + case "provisioningState": + if v != nil { + var provisioningState ProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + itp.ProvisioningState = provisioningState + } + case "provisioningError": + if v != nil { + var provisioningError ProvisioningError + err = json.Unmarshal(*v, &provisioningError) + if err != nil { + return err + } + itp.ProvisioningError = &provisioningError + } + case "lastRunStatus": + if v != nil { + var lastRunStatus ImageTemplateLastRunStatus + err = json.Unmarshal(*v, &lastRunStatus) + if err != nil { + return err + } + itp.LastRunStatus = &lastRunStatus + } + case "buildTimeoutInMinutes": + if v != nil { + var buildTimeoutInMinutes int32 + err = json.Unmarshal(*v, &buildTimeoutInMinutes) + if err != nil { + return err + } + itp.BuildTimeoutInMinutes = &buildTimeoutInMinutes + } + case "vmProfile": + if v != nil { + var VMProfile ImageTemplateVMProfile + err = json.Unmarshal(*v, &VMProfile) + if err != nil { + return err + } + itp.VMProfile = &VMProfile + } + } + } + + return nil +} + +// ImageTemplateRestartCustomizer reboots a VM and waits for it to come back online (Windows). Corresponds +// to Packer windows-restart provisioner +type ImageTemplateRestartCustomizer struct { + // RestartCommand - Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"'] + RestartCommand *string `json:"restartCommand,omitempty"` + // RestartCheckCommand - Command to check if restart succeeded [Default: ''] + RestartCheckCommand *string `json:"restartCheckCommand,omitempty"` + // RestartTimeout - Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'] + RestartTimeout *string `json:"restartTimeout,omitempty"` + // Name - Friendly Name to provide context on what this customization step does + Name *string `json:"name,omitempty"` + // Type - Possible values include: 'TypeBasicImageTemplateCustomizerTypeImageTemplateCustomizer', 'TypeBasicImageTemplateCustomizerTypeShell', 'TypeBasicImageTemplateCustomizerTypeWindowsRestart', 'TypeBasicImageTemplateCustomizerTypeWindowsUpdate', 'TypeBasicImageTemplateCustomizerTypePowerShell', 'TypeBasicImageTemplateCustomizerTypeFile' + Type TypeBasicImageTemplateCustomizer `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplateRestartCustomizer. +func (itrc ImageTemplateRestartCustomizer) MarshalJSON() ([]byte, error) { + itrc.Type = TypeBasicImageTemplateCustomizerTypeWindowsRestart + objectMap := make(map[string]interface{}) + if itrc.RestartCommand != nil { + objectMap["restartCommand"] = itrc.RestartCommand + } + if itrc.RestartCheckCommand != nil { + objectMap["restartCheckCommand"] = itrc.RestartCheckCommand + } + if itrc.RestartTimeout != nil { + objectMap["restartTimeout"] = itrc.RestartTimeout + } + if itrc.Name != nil { + objectMap["name"] = itrc.Name + } + if itrc.Type != "" { + objectMap["type"] = itrc.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplateShellCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateRestartCustomizer. +func (itrc ImageTemplateRestartCustomizer) AsImageTemplateShellCustomizer() (*ImageTemplateShellCustomizer, bool) { + return nil, false +} + +// AsImageTemplateRestartCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateRestartCustomizer. +func (itrc ImageTemplateRestartCustomizer) AsImageTemplateRestartCustomizer() (*ImageTemplateRestartCustomizer, bool) { + return &itrc, true +} + +// AsImageTemplateWindowsUpdateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateRestartCustomizer. +func (itrc ImageTemplateRestartCustomizer) AsImageTemplateWindowsUpdateCustomizer() (*ImageTemplateWindowsUpdateCustomizer, bool) { + return nil, false +} + +// AsImageTemplatePowerShellCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateRestartCustomizer. +func (itrc ImageTemplateRestartCustomizer) AsImageTemplatePowerShellCustomizer() (*ImageTemplatePowerShellCustomizer, bool) { + return nil, false +} + +// AsImageTemplateFileCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateRestartCustomizer. +func (itrc ImageTemplateRestartCustomizer) AsImageTemplateFileCustomizer() (*ImageTemplateFileCustomizer, bool) { + return nil, false +} + +// AsImageTemplateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateRestartCustomizer. +func (itrc ImageTemplateRestartCustomizer) AsImageTemplateCustomizer() (*ImageTemplateCustomizer, bool) { + return nil, false +} + +// AsBasicImageTemplateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateRestartCustomizer. +func (itrc ImageTemplateRestartCustomizer) AsBasicImageTemplateCustomizer() (BasicImageTemplateCustomizer, bool) { + return &itrc, true +} + +// ImageTemplateSharedImageDistributor distribute via Shared Image Gallery. +type ImageTemplateSharedImageDistributor struct { + // GalleryImageID - Resource Id of the Shared Image Gallery image + GalleryImageID *string `json:"galleryImageId,omitempty"` + // ReplicationRegions - A list of regions that the image will be replicated to + ReplicationRegions *[]string `json:"replicationRegions,omitempty"` + // ExcludeFromLatest - Flag that indicates whether created image version should be excluded from latest. Omit to use the default (false). + ExcludeFromLatest *bool `json:"excludeFromLatest,omitempty"` + // StorageAccountType - Storage account type to be used to store the shared image. Omit to use the default (Standard_LRS). Possible values include: 'SharedImageStorageAccountTypeStandardLRS', 'SharedImageStorageAccountTypeStandardZRS' + StorageAccountType SharedImageStorageAccountType `json:"storageAccountType,omitempty"` + // RunOutputName - The name to be used for the associated RunOutput. + RunOutputName *string `json:"runOutputName,omitempty"` + // ArtifactTags - Tags that will be applied to the artifact once it has been created/updated by the distributor. + ArtifactTags map[string]*string `json:"artifactTags"` + // Type - Possible values include: 'TypeBasicImageTemplateDistributorTypeImageTemplateDistributor', 'TypeBasicImageTemplateDistributorTypeManagedImage', 'TypeBasicImageTemplateDistributorTypeSharedImage', 'TypeBasicImageTemplateDistributorTypeVHD' + Type TypeBasicImageTemplateDistributor `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplateSharedImageDistributor. +func (itsid ImageTemplateSharedImageDistributor) MarshalJSON() ([]byte, error) { + itsid.Type = TypeBasicImageTemplateDistributorTypeSharedImage + objectMap := make(map[string]interface{}) + if itsid.GalleryImageID != nil { + objectMap["galleryImageId"] = itsid.GalleryImageID + } + if itsid.ReplicationRegions != nil { + objectMap["replicationRegions"] = itsid.ReplicationRegions + } + if itsid.ExcludeFromLatest != nil { + objectMap["excludeFromLatest"] = itsid.ExcludeFromLatest + } + if itsid.StorageAccountType != "" { + objectMap["storageAccountType"] = itsid.StorageAccountType + } + if itsid.RunOutputName != nil { + objectMap["runOutputName"] = itsid.RunOutputName + } + if itsid.ArtifactTags != nil { + objectMap["artifactTags"] = itsid.ArtifactTags + } + if itsid.Type != "" { + objectMap["type"] = itsid.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplateManagedImageDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateSharedImageDistributor. +func (itsid ImageTemplateSharedImageDistributor) AsImageTemplateManagedImageDistributor() (*ImageTemplateManagedImageDistributor, bool) { + return nil, false +} + +// AsImageTemplateSharedImageDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateSharedImageDistributor. +func (itsid ImageTemplateSharedImageDistributor) AsImageTemplateSharedImageDistributor() (*ImageTemplateSharedImageDistributor, bool) { + return &itsid, true +} + +// AsImageTemplateVhdDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateSharedImageDistributor. +func (itsid ImageTemplateSharedImageDistributor) AsImageTemplateVhdDistributor() (*ImageTemplateVhdDistributor, bool) { + return nil, false +} + +// AsImageTemplateDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateSharedImageDistributor. +func (itsid ImageTemplateSharedImageDistributor) AsImageTemplateDistributor() (*ImageTemplateDistributor, bool) { + return nil, false +} + +// AsBasicImageTemplateDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateSharedImageDistributor. +func (itsid ImageTemplateSharedImageDistributor) AsBasicImageTemplateDistributor() (BasicImageTemplateDistributor, bool) { + return &itsid, true +} + +// ImageTemplateSharedImageVersionSource describes an image source that is an image version in a shared +// image gallery. +type ImageTemplateSharedImageVersionSource struct { + // ImageVersionID - ARM resource id of the image version in the shared image gallery + ImageVersionID *string `json:"imageVersionId,omitempty"` + // Type - Possible values include: 'TypeImageTemplateSource', 'TypePlatformImage', 'TypeManagedImage', 'TypeSharedImageVersion' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplateSharedImageVersionSource. +func (itsivs ImageTemplateSharedImageVersionSource) MarshalJSON() ([]byte, error) { + itsivs.Type = TypeSharedImageVersion + objectMap := make(map[string]interface{}) + if itsivs.ImageVersionID != nil { + objectMap["imageVersionId"] = itsivs.ImageVersionID + } + if itsivs.Type != "" { + objectMap["type"] = itsivs.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplatePlatformImageSource is the BasicImageTemplateSource implementation for ImageTemplateSharedImageVersionSource. +func (itsivs ImageTemplateSharedImageVersionSource) AsImageTemplatePlatformImageSource() (*ImageTemplatePlatformImageSource, bool) { + return nil, false +} + +// AsImageTemplateManagedImageSource is the BasicImageTemplateSource implementation for ImageTemplateSharedImageVersionSource. +func (itsivs ImageTemplateSharedImageVersionSource) AsImageTemplateManagedImageSource() (*ImageTemplateManagedImageSource, bool) { + return nil, false +} + +// AsImageTemplateSharedImageVersionSource is the BasicImageTemplateSource implementation for ImageTemplateSharedImageVersionSource. +func (itsivs ImageTemplateSharedImageVersionSource) AsImageTemplateSharedImageVersionSource() (*ImageTemplateSharedImageVersionSource, bool) { + return &itsivs, true +} + +// AsImageTemplateSource is the BasicImageTemplateSource implementation for ImageTemplateSharedImageVersionSource. +func (itsivs ImageTemplateSharedImageVersionSource) AsImageTemplateSource() (*ImageTemplateSource, bool) { + return nil, false +} + +// AsBasicImageTemplateSource is the BasicImageTemplateSource implementation for ImageTemplateSharedImageVersionSource. +func (itsivs ImageTemplateSharedImageVersionSource) AsBasicImageTemplateSource() (BasicImageTemplateSource, bool) { + return &itsivs, true +} + +// ImageTemplateShellCustomizer runs a shell script during the customization phase (Linux). Corresponds to +// Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified. +type ImageTemplateShellCustomizer struct { + // ScriptURI - URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc + ScriptURI *string `json:"scriptUri,omitempty"` + // Sha256Checksum - SHA256 checksum of the shell script provided in the scriptUri field + Sha256Checksum *string `json:"sha256Checksum,omitempty"` + // Inline - Array of shell commands to execute + Inline *[]string `json:"inline,omitempty"` + // Name - Friendly Name to provide context on what this customization step does + Name *string `json:"name,omitempty"` + // Type - Possible values include: 'TypeBasicImageTemplateCustomizerTypeImageTemplateCustomizer', 'TypeBasicImageTemplateCustomizerTypeShell', 'TypeBasicImageTemplateCustomizerTypeWindowsRestart', 'TypeBasicImageTemplateCustomizerTypeWindowsUpdate', 'TypeBasicImageTemplateCustomizerTypePowerShell', 'TypeBasicImageTemplateCustomizerTypeFile' + Type TypeBasicImageTemplateCustomizer `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplateShellCustomizer. +func (itsc ImageTemplateShellCustomizer) MarshalJSON() ([]byte, error) { + itsc.Type = TypeBasicImageTemplateCustomizerTypeShell + objectMap := make(map[string]interface{}) + if itsc.ScriptURI != nil { + objectMap["scriptUri"] = itsc.ScriptURI + } + if itsc.Sha256Checksum != nil { + objectMap["sha256Checksum"] = itsc.Sha256Checksum + } + if itsc.Inline != nil { + objectMap["inline"] = itsc.Inline + } + if itsc.Name != nil { + objectMap["name"] = itsc.Name + } + if itsc.Type != "" { + objectMap["type"] = itsc.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplateShellCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateShellCustomizer. +func (itsc ImageTemplateShellCustomizer) AsImageTemplateShellCustomizer() (*ImageTemplateShellCustomizer, bool) { + return &itsc, true +} + +// AsImageTemplateRestartCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateShellCustomizer. +func (itsc ImageTemplateShellCustomizer) AsImageTemplateRestartCustomizer() (*ImageTemplateRestartCustomizer, bool) { + return nil, false +} + +// AsImageTemplateWindowsUpdateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateShellCustomizer. +func (itsc ImageTemplateShellCustomizer) AsImageTemplateWindowsUpdateCustomizer() (*ImageTemplateWindowsUpdateCustomizer, bool) { + return nil, false +} + +// AsImageTemplatePowerShellCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateShellCustomizer. +func (itsc ImageTemplateShellCustomizer) AsImageTemplatePowerShellCustomizer() (*ImageTemplatePowerShellCustomizer, bool) { + return nil, false +} + +// AsImageTemplateFileCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateShellCustomizer. +func (itsc ImageTemplateShellCustomizer) AsImageTemplateFileCustomizer() (*ImageTemplateFileCustomizer, bool) { + return nil, false +} + +// AsImageTemplateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateShellCustomizer. +func (itsc ImageTemplateShellCustomizer) AsImageTemplateCustomizer() (*ImageTemplateCustomizer, bool) { + return nil, false +} + +// AsBasicImageTemplateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateShellCustomizer. +func (itsc ImageTemplateShellCustomizer) AsBasicImageTemplateCustomizer() (BasicImageTemplateCustomizer, bool) { + return &itsc, true +} + +// BasicImageTemplateSource describes a virtual machine image source for building, customizing and distributing +type BasicImageTemplateSource interface { + AsImageTemplatePlatformImageSource() (*ImageTemplatePlatformImageSource, bool) + AsImageTemplateManagedImageSource() (*ImageTemplateManagedImageSource, bool) + AsImageTemplateSharedImageVersionSource() (*ImageTemplateSharedImageVersionSource, bool) + AsImageTemplateSource() (*ImageTemplateSource, bool) +} + +// ImageTemplateSource describes a virtual machine image source for building, customizing and distributing +type ImageTemplateSource struct { + // Type - Possible values include: 'TypeImageTemplateSource', 'TypePlatformImage', 'TypeManagedImage', 'TypeSharedImageVersion' + Type Type `json:"type,omitempty"` +} + +func unmarshalBasicImageTemplateSource(body []byte) (BasicImageTemplateSource, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypePlatformImage): + var itpis ImageTemplatePlatformImageSource + err := json.Unmarshal(body, &itpis) + return itpis, err + case string(TypeManagedImage): + var itmis ImageTemplateManagedImageSource + err := json.Unmarshal(body, &itmis) + return itmis, err + case string(TypeSharedImageVersion): + var itsivs ImageTemplateSharedImageVersionSource + err := json.Unmarshal(body, &itsivs) + return itsivs, err + default: + var its ImageTemplateSource + err := json.Unmarshal(body, &its) + return its, err + } +} +func unmarshalBasicImageTemplateSourceArray(body []byte) ([]BasicImageTemplateSource, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + itsArray := make([]BasicImageTemplateSource, len(rawMessages)) + + for index, rawMessage := range rawMessages { + its, err := unmarshalBasicImageTemplateSource(*rawMessage) + if err != nil { + return nil, err + } + itsArray[index] = its + } + return itsArray, nil +} + +// MarshalJSON is the custom marshaler for ImageTemplateSource. +func (its ImageTemplateSource) MarshalJSON() ([]byte, error) { + its.Type = TypeImageTemplateSource + objectMap := make(map[string]interface{}) + if its.Type != "" { + objectMap["type"] = its.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplatePlatformImageSource is the BasicImageTemplateSource implementation for ImageTemplateSource. +func (its ImageTemplateSource) AsImageTemplatePlatformImageSource() (*ImageTemplatePlatformImageSource, bool) { + return nil, false +} + +// AsImageTemplateManagedImageSource is the BasicImageTemplateSource implementation for ImageTemplateSource. +func (its ImageTemplateSource) AsImageTemplateManagedImageSource() (*ImageTemplateManagedImageSource, bool) { + return nil, false +} + +// AsImageTemplateSharedImageVersionSource is the BasicImageTemplateSource implementation for ImageTemplateSource. +func (its ImageTemplateSource) AsImageTemplateSharedImageVersionSource() (*ImageTemplateSharedImageVersionSource, bool) { + return nil, false +} + +// AsImageTemplateSource is the BasicImageTemplateSource implementation for ImageTemplateSource. +func (its ImageTemplateSource) AsImageTemplateSource() (*ImageTemplateSource, bool) { + return &its, true +} + +// AsBasicImageTemplateSource is the BasicImageTemplateSource implementation for ImageTemplateSource. +func (its ImageTemplateSource) AsBasicImageTemplateSource() (BasicImageTemplateSource, bool) { + return &its, true +} + +// ImageTemplateUpdateParameters parameters for updating an image template. +type ImageTemplateUpdateParameters struct { + // Identity - The identity of the image template, if configured. + Identity *ImageTemplateIdentity `json:"identity,omitempty"` + // Tags - The user-specified tags associated with the image template. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ImageTemplateUpdateParameters. +func (itup ImageTemplateUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if itup.Identity != nil { + objectMap["identity"] = itup.Identity + } + if itup.Tags != nil { + objectMap["tags"] = itup.Tags + } + return json.Marshal(objectMap) +} + +// ImageTemplateVhdDistributor distribute via VHD in a storage account. +type ImageTemplateVhdDistributor struct { + // RunOutputName - The name to be used for the associated RunOutput. + RunOutputName *string `json:"runOutputName,omitempty"` + // ArtifactTags - Tags that will be applied to the artifact once it has been created/updated by the distributor. + ArtifactTags map[string]*string `json:"artifactTags"` + // Type - Possible values include: 'TypeBasicImageTemplateDistributorTypeImageTemplateDistributor', 'TypeBasicImageTemplateDistributorTypeManagedImage', 'TypeBasicImageTemplateDistributorTypeSharedImage', 'TypeBasicImageTemplateDistributorTypeVHD' + Type TypeBasicImageTemplateDistributor `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplateVhdDistributor. +func (itvd ImageTemplateVhdDistributor) MarshalJSON() ([]byte, error) { + itvd.Type = TypeBasicImageTemplateDistributorTypeVHD + objectMap := make(map[string]interface{}) + if itvd.RunOutputName != nil { + objectMap["runOutputName"] = itvd.RunOutputName + } + if itvd.ArtifactTags != nil { + objectMap["artifactTags"] = itvd.ArtifactTags + } + if itvd.Type != "" { + objectMap["type"] = itvd.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplateManagedImageDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateVhdDistributor. +func (itvd ImageTemplateVhdDistributor) AsImageTemplateManagedImageDistributor() (*ImageTemplateManagedImageDistributor, bool) { + return nil, false +} + +// AsImageTemplateSharedImageDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateVhdDistributor. +func (itvd ImageTemplateVhdDistributor) AsImageTemplateSharedImageDistributor() (*ImageTemplateSharedImageDistributor, bool) { + return nil, false +} + +// AsImageTemplateVhdDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateVhdDistributor. +func (itvd ImageTemplateVhdDistributor) AsImageTemplateVhdDistributor() (*ImageTemplateVhdDistributor, bool) { + return &itvd, true +} + +// AsImageTemplateDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateVhdDistributor. +func (itvd ImageTemplateVhdDistributor) AsImageTemplateDistributor() (*ImageTemplateDistributor, bool) { + return nil, false +} + +// AsBasicImageTemplateDistributor is the BasicImageTemplateDistributor implementation for ImageTemplateVhdDistributor. +func (itvd ImageTemplateVhdDistributor) AsBasicImageTemplateDistributor() (BasicImageTemplateDistributor, bool) { + return &itvd, true +} + +// ImageTemplateVMProfile describes the virtual machine used to build, customize and capture images +type ImageTemplateVMProfile struct { + // VMSize - Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D2ds_v4). + VMSize *string `json:"vmSize,omitempty"` + // OsDiskSizeGB - Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // UserAssignedIdentities - Optional array of resource IDs of user assigned managed identities to be configured on the build VM. This may include the identity of the image template. + UserAssignedIdentities *[]string `json:"userAssignedIdentities,omitempty"` + // VnetConfig - Optional configuration of the virtual network to use to deploy the build virtual machine in. Omit if no specific virtual network needs to be used. + VnetConfig *VirtualNetworkConfig `json:"vnetConfig,omitempty"` +} + +// ImageTemplateWindowsUpdateCustomizer installs Windows Updates. Corresponds to Packer Windows Update +// Provisioner (https://github.com/rgl/packer-provisioner-windows-update) +type ImageTemplateWindowsUpdateCustomizer struct { + // SearchCriteria - Criteria to search updates. Omit or specify empty string to use the default (search all). Refer to above link for examples and detailed description of this field. + SearchCriteria *string `json:"searchCriteria,omitempty"` + // Filters - Array of filters to select updates to apply. Omit or specify empty array to use the default (no filter). Refer to above link for examples and detailed description of this field. + Filters *[]string `json:"filters,omitempty"` + // UpdateLimit - Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000) + UpdateLimit *int32 `json:"updateLimit,omitempty"` + // Name - Friendly Name to provide context on what this customization step does + Name *string `json:"name,omitempty"` + // Type - Possible values include: 'TypeBasicImageTemplateCustomizerTypeImageTemplateCustomizer', 'TypeBasicImageTemplateCustomizerTypeShell', 'TypeBasicImageTemplateCustomizerTypeWindowsRestart', 'TypeBasicImageTemplateCustomizerTypeWindowsUpdate', 'TypeBasicImageTemplateCustomizerTypePowerShell', 'TypeBasicImageTemplateCustomizerTypeFile' + Type TypeBasicImageTemplateCustomizer `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ImageTemplateWindowsUpdateCustomizer. +func (itwuc ImageTemplateWindowsUpdateCustomizer) MarshalJSON() ([]byte, error) { + itwuc.Type = TypeBasicImageTemplateCustomizerTypeWindowsUpdate + objectMap := make(map[string]interface{}) + if itwuc.SearchCriteria != nil { + objectMap["searchCriteria"] = itwuc.SearchCriteria + } + if itwuc.Filters != nil { + objectMap["filters"] = itwuc.Filters + } + if itwuc.UpdateLimit != nil { + objectMap["updateLimit"] = itwuc.UpdateLimit + } + if itwuc.Name != nil { + objectMap["name"] = itwuc.Name + } + if itwuc.Type != "" { + objectMap["type"] = itwuc.Type + } + return json.Marshal(objectMap) +} + +// AsImageTemplateShellCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateWindowsUpdateCustomizer. +func (itwuc ImageTemplateWindowsUpdateCustomizer) AsImageTemplateShellCustomizer() (*ImageTemplateShellCustomizer, bool) { + return nil, false +} + +// AsImageTemplateRestartCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateWindowsUpdateCustomizer. +func (itwuc ImageTemplateWindowsUpdateCustomizer) AsImageTemplateRestartCustomizer() (*ImageTemplateRestartCustomizer, bool) { + return nil, false +} + +// AsImageTemplateWindowsUpdateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateWindowsUpdateCustomizer. +func (itwuc ImageTemplateWindowsUpdateCustomizer) AsImageTemplateWindowsUpdateCustomizer() (*ImageTemplateWindowsUpdateCustomizer, bool) { + return &itwuc, true +} + +// AsImageTemplatePowerShellCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateWindowsUpdateCustomizer. +func (itwuc ImageTemplateWindowsUpdateCustomizer) AsImageTemplatePowerShellCustomizer() (*ImageTemplatePowerShellCustomizer, bool) { + return nil, false +} + +// AsImageTemplateFileCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateWindowsUpdateCustomizer. +func (itwuc ImageTemplateWindowsUpdateCustomizer) AsImageTemplateFileCustomizer() (*ImageTemplateFileCustomizer, bool) { + return nil, false +} + +// AsImageTemplateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateWindowsUpdateCustomizer. +func (itwuc ImageTemplateWindowsUpdateCustomizer) AsImageTemplateCustomizer() (*ImageTemplateCustomizer, bool) { + return nil, false +} + +// AsBasicImageTemplateCustomizer is the BasicImageTemplateCustomizer implementation for ImageTemplateWindowsUpdateCustomizer. +func (itwuc ImageTemplateWindowsUpdateCustomizer) AsBasicImageTemplateCustomizer() (BasicImageTemplateCustomizer, bool) { + return &itwuc, true +} + +// Operation ... +type Operation struct { + // Name - This is of the format {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + Display *OperationDisplay `json:"display,omitempty"` + Origin *string `json:"origin,omitempty"` + Properties interface{} `json:"properties,omitempty"` + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// OperationDisplay ... +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + // Operation - For example: read, write, delete, or listKeys/action + Operation *string `json:"operation,omitempty"` + Resource *string `json:"resource,omitempty"` + Description *string `json:"description,omitempty"` +} + +// OperationListResult ... +type OperationListResult struct { + autorest.Response `json:"-"` + Value *[]Operation `json:"value,omitempty"` + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// PlatformImagePurchasePlan purchase plan configuration for platform image. +type PlatformImagePurchasePlan struct { + // PlanName - Name of the purchase plan. + PlanName *string `json:"planName,omitempty"` + // PlanProduct - Product of the purchase plan. + PlanProduct *string `json:"planProduct,omitempty"` + // PlanPublisher - Publisher of the purchase plan. + PlanPublisher *string `json:"planPublisher,omitempty"` +} + +// ProvisioningError describes the error happened when create or update an image template +type ProvisioningError struct { + // ProvisioningErrorCode - Error code of the provisioning failure. Possible values include: 'ProvisioningErrorCodeBadSourceType', 'ProvisioningErrorCodeBadPIRSource', 'ProvisioningErrorCodeBadManagedImageSource', 'ProvisioningErrorCodeBadSharedImageVersionSource', 'ProvisioningErrorCodeBadCustomizerType', 'ProvisioningErrorCodeUnsupportedCustomizerType', 'ProvisioningErrorCodeNoCustomizerScript', 'ProvisioningErrorCodeBadDistributeType', 'ProvisioningErrorCodeBadSharedImageDistribute', 'ProvisioningErrorCodeServerError', 'ProvisioningErrorCodeOther' + ProvisioningErrorCode ProvisioningErrorCode `json:"provisioningErrorCode,omitempty"` + // Message - Verbose error message about the provisioning failure + Message *string `json:"message,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RunOutput represents an output that was created by running an image template. +type RunOutput struct { + autorest.Response `json:"-"` + // RunOutputProperties - The properties of the run output + *RunOutputProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for RunOutput. +func (ro RunOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ro.RunOutputProperties != nil { + objectMap["properties"] = ro.RunOutputProperties + } + if ro.Name != nil { + objectMap["name"] = ro.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RunOutput struct. +func (ro *RunOutput) 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 runOutputProperties RunOutputProperties + err = json.Unmarshal(*v, &runOutputProperties) + if err != nil { + return err + } + ro.RunOutputProperties = &runOutputProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ro.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ro.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ro.Type = &typeVar + } + } + } + + return nil +} + +// RunOutputCollection the result of List run outputs operation +type RunOutputCollection struct { + autorest.Response `json:"-"` + // Value - An array of run outputs + Value *[]RunOutput `json:"value,omitempty"` + // NextLink - The continuation token. + NextLink *string `json:"nextLink,omitempty"` +} + +// RunOutputCollectionIterator provides access to a complete listing of RunOutput values. +type RunOutputCollectionIterator struct { + i int + page RunOutputCollectionPage +} + +// 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 *RunOutputCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RunOutputCollectionIterator.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 *RunOutputCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RunOutputCollectionIterator) 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 RunOutputCollectionIterator) Response() RunOutputCollection { + 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 RunOutputCollectionIterator) Value() RunOutput { + if !iter.page.NotDone() { + return RunOutput{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RunOutputCollectionIterator type. +func NewRunOutputCollectionIterator(page RunOutputCollectionPage) RunOutputCollectionIterator { + return RunOutputCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (roc RunOutputCollection) IsEmpty() bool { + return roc.Value == nil || len(*roc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (roc RunOutputCollection) hasNextLink() bool { + return roc.NextLink != nil && len(*roc.NextLink) != 0 +} + +// runOutputCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (roc RunOutputCollection) runOutputCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !roc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(roc.NextLink))) +} + +// RunOutputCollectionPage contains a page of RunOutput values. +type RunOutputCollectionPage struct { + fn func(context.Context, RunOutputCollection) (RunOutputCollection, error) + roc RunOutputCollection +} + +// 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 *RunOutputCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RunOutputCollectionPage.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.roc) + if err != nil { + return err + } + page.roc = 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 *RunOutputCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RunOutputCollectionPage) NotDone() bool { + return !page.roc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RunOutputCollectionPage) Response() RunOutputCollection { + return page.roc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RunOutputCollectionPage) Values() []RunOutput { + if page.roc.IsEmpty() { + return nil + } + return *page.roc.Value +} + +// Creates a new instance of the RunOutputCollectionPage type. +func NewRunOutputCollectionPage(cur RunOutputCollection, getNextPage func(context.Context, RunOutputCollection) (RunOutputCollection, error)) RunOutputCollectionPage { + return RunOutputCollectionPage{ + fn: getNextPage, + roc: cur, + } +} + +// RunOutputProperties describes the properties of a run output +type RunOutputProperties struct { + // ArtifactID - The resource id of the artifact. + ArtifactID *string `json:"artifactId,omitempty"` + // ArtifactURI - The location URI of the artifact. + ArtifactURI *string `json:"artifactUri,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the resource. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RunOutputProperties. +func (rop RunOutputProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rop.ArtifactID != nil { + objectMap["artifactId"] = rop.ArtifactID + } + if rop.ArtifactURI != nil { + objectMap["artifactUri"] = rop.ArtifactURI + } + return json.Marshal(objectMap) +} + +// SubResource the Sub Resource model definition. +type SubResource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubResource. +func (sr SubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Name != nil { + objectMap["name"] = sr.Name + } + return json.Marshal(objectMap) +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// VirtualMachineImageTemplatesCancelFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineImageTemplatesCancelFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualMachineImageTemplatesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualMachineImageTemplatesCancelFuture) 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 VirtualMachineImageTemplatesCancelFuture.Result. +func (future *VirtualMachineImageTemplatesCancelFuture) result(client VirtualMachineImageTemplatesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesCancelFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("virtualmachineimagebuilder.VirtualMachineImageTemplatesCancelFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineImageTemplatesCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualMachineImageTemplatesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualMachineImageTemplatesClient) (ImageTemplate, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualMachineImageTemplatesCreateOrUpdateFuture) 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 VirtualMachineImageTemplatesCreateOrUpdateFuture.Result. +func (future *VirtualMachineImageTemplatesCreateOrUpdateFuture) result(client VirtualMachineImageTemplatesClient) (it ImageTemplate, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + it.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("virtualmachineimagebuilder.VirtualMachineImageTemplatesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if it.Response.Response, err = future.GetResult(sender); err == nil && it.Response.Response.StatusCode != http.StatusNoContent { + it, err = client.CreateOrUpdateResponder(it.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesCreateOrUpdateFuture", "Result", it.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualMachineImageTemplatesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineImageTemplatesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualMachineImageTemplatesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualMachineImageTemplatesDeleteFuture) 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 VirtualMachineImageTemplatesDeleteFuture.Result. +func (future *VirtualMachineImageTemplatesDeleteFuture) result(client VirtualMachineImageTemplatesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("virtualmachineimagebuilder.VirtualMachineImageTemplatesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineImageTemplatesRunFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineImageTemplatesRunFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualMachineImageTemplatesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualMachineImageTemplatesRunFuture) 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 VirtualMachineImageTemplatesRunFuture.Result. +func (future *VirtualMachineImageTemplatesRunFuture) result(client VirtualMachineImageTemplatesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesRunFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("virtualmachineimagebuilder.VirtualMachineImageTemplatesRunFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualMachineImageTemplatesUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualMachineImageTemplatesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualMachineImageTemplatesClient) (ImageTemplate, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualMachineImageTemplatesUpdateFuture) 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 VirtualMachineImageTemplatesUpdateFuture.Result. +func (future *VirtualMachineImageTemplatesUpdateFuture) result(client VirtualMachineImageTemplatesClient) (it ImageTemplate, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + it.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("virtualmachineimagebuilder.VirtualMachineImageTemplatesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if it.Response.Response, err = future.GetResult(sender); err == nil && it.Response.Response.StatusCode != http.StatusNoContent { + it, err = client.UpdateResponder(it.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesUpdateFuture", "Result", it.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkConfig virtual Network configuration. +type VirtualNetworkConfig struct { + // SubnetID - Resource id of a pre-existing subnet. + SubnetID *string `json:"subnetId,omitempty"` + // ProxyVMSize - Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2 for Gen1 images and Standard_D2ds_v4 for Gen2 images). + ProxyVMSize *string `json:"proxyVmSize,omitempty"` +} diff --git a/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/operations.go b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/operations.go new file mode 100644 index 000000000000..8712add6233a --- /dev/null +++ b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/operations.go @@ -0,0 +1,140 @@ +package virtualmachineimagebuilder + +// 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 Virtual Machine Image Builder Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists available operations for the Microsoft.VirtualMachineImages provider +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, "virtualmachineimagebuilder.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, "virtualmachineimagebuilder.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.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-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.VirtualMachineImages/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, "virtualmachineimagebuilder.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, "virtualmachineimagebuilder.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.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/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/version.go b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/version.go new file mode 100644 index 000000000000..7d00bca71900 --- /dev/null +++ b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/version.go @@ -0,0 +1,19 @@ +package virtualmachineimagebuilder + +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() + " virtualmachineimagebuilder/2021-10-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/virtualmachineimagebuilderapi/interfaces.go b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/virtualmachineimagebuilderapi/interfaces.go new file mode 100644 index 000000000000..6848214fdbd3 --- /dev/null +++ b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/virtualmachineimagebuilderapi/interfaces.go @@ -0,0 +1,39 @@ +package virtualmachineimagebuilderapi + +// 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/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder" +) + +// VirtualMachineImageTemplatesClientAPI contains the set of methods on the VirtualMachineImageTemplatesClient type. +type VirtualMachineImageTemplatesClientAPI interface { + Cancel(ctx context.Context, resourceGroupName string, imageTemplateName string) (result virtualmachineimagebuilder.VirtualMachineImageTemplatesCancelFuture, err error) + CreateOrUpdate(ctx context.Context, parameters virtualmachineimagebuilder.ImageTemplate, resourceGroupName string, imageTemplateName string) (result virtualmachineimagebuilder.VirtualMachineImageTemplatesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, imageTemplateName string) (result virtualmachineimagebuilder.VirtualMachineImageTemplatesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, imageTemplateName string) (result virtualmachineimagebuilder.ImageTemplate, err error) + GetRunOutput(ctx context.Context, resourceGroupName string, imageTemplateName string, runOutputName string) (result virtualmachineimagebuilder.RunOutput, err error) + List(ctx context.Context) (result virtualmachineimagebuilder.ImageTemplateListResultPage, err error) + ListComplete(ctx context.Context) (result virtualmachineimagebuilder.ImageTemplateListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result virtualmachineimagebuilder.ImageTemplateListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result virtualmachineimagebuilder.ImageTemplateListResultIterator, err error) + ListRunOutputs(ctx context.Context, resourceGroupName string, imageTemplateName string) (result virtualmachineimagebuilder.RunOutputCollectionPage, err error) + ListRunOutputsComplete(ctx context.Context, resourceGroupName string, imageTemplateName string) (result virtualmachineimagebuilder.RunOutputCollectionIterator, err error) + Run(ctx context.Context, resourceGroupName string, imageTemplateName string) (result virtualmachineimagebuilder.VirtualMachineImageTemplatesRunFuture, err error) + Update(ctx context.Context, parameters virtualmachineimagebuilder.ImageTemplateUpdateParameters, resourceGroupName string, imageTemplateName string) (result virtualmachineimagebuilder.VirtualMachineImageTemplatesUpdateFuture, err error) +} + +var _ VirtualMachineImageTemplatesClientAPI = (*virtualmachineimagebuilder.VirtualMachineImageTemplatesClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result virtualmachineimagebuilder.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result virtualmachineimagebuilder.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*virtualmachineimagebuilder.OperationsClient)(nil) diff --git a/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/virtualmachineimagetemplates.go b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/virtualmachineimagetemplates.go new file mode 100644 index 000000000000..80b8c078177c --- /dev/null +++ b/services/virtualmachineimagebuilder/mgmt/2021-10-01/virtualmachineimagebuilder/virtualmachineimagetemplates.go @@ -0,0 +1,995 @@ +package virtualmachineimagebuilder + +// 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" +) + +// VirtualMachineImageTemplatesClient is the azure Virtual Machine Image Builder Client +type VirtualMachineImageTemplatesClient struct { + BaseClient +} + +// NewVirtualMachineImageTemplatesClient creates an instance of the VirtualMachineImageTemplatesClient client. +func NewVirtualMachineImageTemplatesClient(subscriptionID string) VirtualMachineImageTemplatesClient { + return NewVirtualMachineImageTemplatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualMachineImageTemplatesClientWithBaseURI creates an instance of the VirtualMachineImageTemplatesClient +// 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 NewVirtualMachineImageTemplatesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineImageTemplatesClient { + return VirtualMachineImageTemplatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Cancel cancel the long running image build based on the image template +// Parameters: +// resourceGroupName - the name of the resource group. +// imageTemplateName - the name of the image Template +func (client VirtualMachineImageTemplatesClient) Cancel(ctx context.Context, resourceGroupName string, imageTemplateName string) (result VirtualMachineImageTemplatesCancelFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.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: imageTemplateName, + Constraints: []validation.Constraint{{Target: "imageTemplateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-_.]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Cancel", err.Error()) + } + + req, err := client.CancelPreparer(ctx, resourceGroupName, imageTemplateName) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Cancel", nil, "Failure preparing request") + return + } + + result, err = client.CancelSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Cancel", result.Response(), "Failure sending request") + return + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client VirtualMachineImageTemplatesClient) CancelPreparer(ctx context.Context, resourceGroupName string, imageTemplateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageTemplateName": autorest.Encode("path", imageTemplateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/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 VirtualMachineImageTemplatesClient) CancelSender(req *http.Request) (future VirtualMachineImageTemplatesCancelFuture, 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 VirtualMachineImageTemplatesClient) CancelResponder(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 +} + +// CreateOrUpdate create or update a virtual machine image template +// Parameters: +// parameters - parameters supplied to the CreateImageTemplate operation +// resourceGroupName - the name of the resource group. +// imageTemplateName - the name of the image Template +func (client VirtualMachineImageTemplatesClient) CreateOrUpdate(ctx context.Context, parameters ImageTemplate, resourceGroupName string, imageTemplateName string) (result VirtualMachineImageTemplatesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ImageTemplateProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ImageTemplateProperties.Distribute", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ImageTemplateProperties.BuildTimeoutInMinutes", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ImageTemplateProperties.BuildTimeoutInMinutes", Name: validation.InclusiveMaximum, Rule: int64(960), Chain: nil}, + {Target: "parameters.ImageTemplateProperties.BuildTimeoutInMinutes", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "parameters.ImageTemplateProperties.VMProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ImageTemplateProperties.VMProfile.OsDiskSizeGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ImageTemplateProperties.VMProfile.OsDiskSizeGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, + }}, + }}, + {Target: "parameters.Identity", Name: validation.Null, Rule: true, Chain: nil}}}, + {TargetValue: imageTemplateName, + Constraints: []validation.Constraint{{Target: "imageTemplateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-_.]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, parameters, resourceGroupName, imageTemplateName) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualMachineImageTemplatesClient) CreateOrUpdatePreparer(ctx context.Context, parameters ImageTemplate, resourceGroupName string, imageTemplateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageTemplateName": autorest.Encode("path", imageTemplateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}", 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 VirtualMachineImageTemplatesClient) CreateOrUpdateSender(req *http.Request) (future VirtualMachineImageTemplatesCreateOrUpdateFuture, 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 VirtualMachineImageTemplatesClient) CreateOrUpdateResponder(resp *http.Response) (result ImageTemplate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a virtual machine image template +// Parameters: +// resourceGroupName - the name of the resource group. +// imageTemplateName - the name of the image Template +func (client VirtualMachineImageTemplatesClient) Delete(ctx context.Context, resourceGroupName string, imageTemplateName string) (result VirtualMachineImageTemplatesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.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: imageTemplateName, + Constraints: []validation.Constraint{{Target: "imageTemplateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-_.]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, imageTemplateName) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualMachineImageTemplatesClient) DeletePreparer(ctx context.Context, resourceGroupName string, imageTemplateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageTemplateName": autorest.Encode("path", imageTemplateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}", 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 VirtualMachineImageTemplatesClient) DeleteSender(req *http.Request) (future VirtualMachineImageTemplatesDeleteFuture, 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 VirtualMachineImageTemplatesClient) 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 information about a virtual machine image template +// Parameters: +// resourceGroupName - the name of the resource group. +// imageTemplateName - the name of the image Template +func (client VirtualMachineImageTemplatesClient) Get(ctx context.Context, resourceGroupName string, imageTemplateName string) (result ImageTemplate, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.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: imageTemplateName, + Constraints: []validation.Constraint{{Target: "imageTemplateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-_.]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, imageTemplateName) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualMachineImageTemplatesClient) GetPreparer(ctx context.Context, resourceGroupName string, imageTemplateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageTemplateName": autorest.Encode("path", imageTemplateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}", 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 VirtualMachineImageTemplatesClient) 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 VirtualMachineImageTemplatesClient) GetResponder(resp *http.Response) (result ImageTemplate, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetRunOutput get the specified run output for the specified image template resource +// Parameters: +// resourceGroupName - the name of the resource group. +// imageTemplateName - the name of the image Template +// runOutputName - the name of the run output +func (client VirtualMachineImageTemplatesClient) GetRunOutput(ctx context.Context, resourceGroupName string, imageTemplateName string, runOutputName string) (result RunOutput, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.GetRunOutput") + 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: imageTemplateName, + Constraints: []validation.Constraint{{Target: "imageTemplateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-_.]{1,64}$`, Chain: nil}}}, + {TargetValue: runOutputName, + Constraints: []validation.Constraint{{Target: "runOutputName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-_.]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "GetRunOutput", err.Error()) + } + + req, err := client.GetRunOutputPreparer(ctx, resourceGroupName, imageTemplateName, runOutputName) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "GetRunOutput", nil, "Failure preparing request") + return + } + + resp, err := client.GetRunOutputSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "GetRunOutput", resp, "Failure sending request") + return + } + + result, err = client.GetRunOutputResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "GetRunOutput", resp, "Failure responding to request") + return + } + + return +} + +// GetRunOutputPreparer prepares the GetRunOutput request. +func (client VirtualMachineImageTemplatesClient) GetRunOutputPreparer(ctx context.Context, resourceGroupName string, imageTemplateName string, runOutputName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageTemplateName": autorest.Encode("path", imageTemplateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "runOutputName": autorest.Encode("path", runOutputName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs/{runOutputName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetRunOutputSender sends the GetRunOutput request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImageTemplatesClient) GetRunOutputSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetRunOutputResponder handles the response to the GetRunOutput request. The method always +// closes the http.Response Body. +func (client VirtualMachineImageTemplatesClient) GetRunOutputResponder(resp *http.Response) (result RunOutput, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets information about the VM image templates associated with the subscription. +func (client VirtualMachineImageTemplatesClient) List(ctx context.Context) (result ImageTemplateListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.List") + defer func() { + sc := -1 + if result.itlr.Response.Response != nil { + sc = result.itlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.itlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "List", resp, "Failure sending request") + return + } + + result.itlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "List", resp, "Failure responding to request") + return + } + if result.itlr.hasNextLink() && result.itlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualMachineImageTemplatesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.VirtualMachineImages/imageTemplates", 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 VirtualMachineImageTemplatesClient) 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 VirtualMachineImageTemplatesClient) ListResponder(resp *http.Response) (result ImageTemplateListResult, 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 VirtualMachineImageTemplatesClient) listNextResults(ctx context.Context, lastResults ImageTemplateListResult) (result ImageTemplateListResult, err error) { + req, err := lastResults.imageTemplateListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "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, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineImageTemplatesClient) ListComplete(ctx context.Context) (result ImageTemplateListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets information about the VM image templates associated with the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client VirtualMachineImageTemplatesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ImageTemplateListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.itlr.Response.Response != nil { + sc = result.itlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.itlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.itlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.itlr.hasNextLink() && result.itlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VirtualMachineImageTemplatesClient) 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-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates", 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 VirtualMachineImageTemplatesClient) 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 VirtualMachineImageTemplatesClient) ListByResourceGroupResponder(resp *http.Response) (result ImageTemplateListResult, 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 VirtualMachineImageTemplatesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ImageTemplateListResult) (result ImageTemplateListResult, err error) { + req, err := lastResults.imageTemplateListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "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, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineImageTemplatesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ImageTemplateListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.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 +} + +// ListRunOutputs list all run outputs for the specified Image Template resource +// Parameters: +// resourceGroupName - the name of the resource group. +// imageTemplateName - the name of the image Template +func (client VirtualMachineImageTemplatesClient) ListRunOutputs(ctx context.Context, resourceGroupName string, imageTemplateName string) (result RunOutputCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.ListRunOutputs") + defer func() { + sc := -1 + if result.roc.Response.Response != nil { + sc = result.roc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: imageTemplateName, + Constraints: []validation.Constraint{{Target: "imageTemplateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-_.]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "ListRunOutputs", err.Error()) + } + + result.fn = client.listRunOutputsNextResults + req, err := client.ListRunOutputsPreparer(ctx, resourceGroupName, imageTemplateName) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "ListRunOutputs", nil, "Failure preparing request") + return + } + + resp, err := client.ListRunOutputsSender(req) + if err != nil { + result.roc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "ListRunOutputs", resp, "Failure sending request") + return + } + + result.roc, err = client.ListRunOutputsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "ListRunOutputs", resp, "Failure responding to request") + return + } + if result.roc.hasNextLink() && result.roc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListRunOutputsPreparer prepares the ListRunOutputs request. +func (client VirtualMachineImageTemplatesClient) ListRunOutputsPreparer(ctx context.Context, resourceGroupName string, imageTemplateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageTemplateName": autorest.Encode("path", imageTemplateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRunOutputsSender sends the ListRunOutputs request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImageTemplatesClient) ListRunOutputsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListRunOutputsResponder handles the response to the ListRunOutputs request. The method always +// closes the http.Response Body. +func (client VirtualMachineImageTemplatesClient) ListRunOutputsResponder(resp *http.Response) (result RunOutputCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listRunOutputsNextResults retrieves the next set of results, if any. +func (client VirtualMachineImageTemplatesClient) listRunOutputsNextResults(ctx context.Context, lastResults RunOutputCollection) (result RunOutputCollection, err error) { + req, err := lastResults.runOutputCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "listRunOutputsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListRunOutputsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "listRunOutputsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListRunOutputsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "listRunOutputsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListRunOutputsComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualMachineImageTemplatesClient) ListRunOutputsComplete(ctx context.Context, resourceGroupName string, imageTemplateName string) (result RunOutputCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.ListRunOutputs") + 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.ListRunOutputs(ctx, resourceGroupName, imageTemplateName) + return +} + +// Run create artifacts from a existing image template +// Parameters: +// resourceGroupName - the name of the resource group. +// imageTemplateName - the name of the image Template +func (client VirtualMachineImageTemplatesClient) Run(ctx context.Context, resourceGroupName string, imageTemplateName string) (result VirtualMachineImageTemplatesRunFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.Run") + 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: imageTemplateName, + Constraints: []validation.Constraint{{Target: "imageTemplateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-_.]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Run", err.Error()) + } + + req, err := client.RunPreparer(ctx, resourceGroupName, imageTemplateName) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Run", nil, "Failure preparing request") + return + } + + result, err = client.RunSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Run", result.Response(), "Failure sending request") + return + } + + return +} + +// RunPreparer prepares the Run request. +func (client VirtualMachineImageTemplatesClient) RunPreparer(ctx context.Context, resourceGroupName string, imageTemplateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageTemplateName": autorest.Encode("path", imageTemplateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RunSender sends the Run request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualMachineImageTemplatesClient) RunSender(req *http.Request) (future VirtualMachineImageTemplatesRunFuture, 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 +} + +// RunResponder handles the response to the Run request. The method always +// closes the http.Response Body. +func (client VirtualMachineImageTemplatesClient) RunResponder(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 +} + +// Update update the tags for this Virtual Machine Image Template +// Parameters: +// parameters - additional parameters for Image Template update. +// resourceGroupName - the name of the resource group. +// imageTemplateName - the name of the image Template +func (client VirtualMachineImageTemplatesClient) Update(ctx context.Context, parameters ImageTemplateUpdateParameters, resourceGroupName string, imageTemplateName string) (result VirtualMachineImageTemplatesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualMachineImageTemplatesClient.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: imageTemplateName, + Constraints: []validation.Constraint{{Target: "imageTemplateName", Name: validation.Pattern, Rule: `^[A-Za-z0-9-_.]{1,64}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, parameters, resourceGroupName, imageTemplateName) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "virtualmachineimagebuilder.VirtualMachineImageTemplatesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client VirtualMachineImageTemplatesClient) UpdatePreparer(ctx context.Context, parameters ImageTemplateUpdateParameters, resourceGroupName string, imageTemplateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "imageTemplateName": autorest.Encode("path", imageTemplateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}", 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 VirtualMachineImageTemplatesClient) UpdateSender(req *http.Request) (future VirtualMachineImageTemplatesUpdateFuture, 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 VirtualMachineImageTemplatesClient) UpdateResponder(resp *http.Response) (result ImageTemplate, 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/version/version.go b/version/version.go index 8d1f319db4fa..7eae80948d21 100644 --- a/version/version.go +++ b/version/version.go @@ -4,4 +4,4 @@ package version // Licensed under the MIT License. See License.txt in the project root for license information. // Number contains the semantic version of this SDK. -const Number = "v60.0.0" +const Number = "v60.1.0"