diff --git a/services/appplatform/mgmt/2020-07-01/appplatform/CHANGELOG.md b/services/appplatform/mgmt/2020-07-01/appplatform/CHANGELOG.md index 52911e4cc5e4..fa19dadc5298 100644 --- a/services/appplatform/mgmt/2020-07-01/appplatform/CHANGELOG.md +++ b/services/appplatform/mgmt/2020-07-01/appplatform/CHANGELOG.md @@ -1,2 +1,29 @@ -# Change History +# Unreleased +## Additive Changes + +### New Constants + +1. ActionType.Internal +1. TrafficDirection.Inbound +1. TrafficDirection.Outbound + +### New Funcs + +1. OperationDetail.MarshalJSON() ([]byte, error) +1. PossibleActionTypeValues() []ActionType +1. PossibleTrafficDirectionValues() []TrafficDirection +1. RequiredTraffic.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. RequiredTraffic + +#### New Struct Fields + +1. MetricDimension.ToBeExportedForShoebox +1. MetricSpecification.SourceMdmNamespace +1. NetworkProfile.RequiredTraffics +1. OperationDetail.ActionType diff --git a/services/appplatform/mgmt/2020-07-01/appplatform/_meta.json b/services/appplatform/mgmt/2020-07-01/appplatform/_meta.json index c9b975cc3818..a108b0afa4df 100644 --- a/services/appplatform/mgmt/2020-07-01/appplatform/_meta.json +++ b/services/appplatform/mgmt/2020-07-01/appplatform/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "1be34c2955526679d441bda4fa40744b5ee5e1b1", "readme": "/_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", "tag": "package-2020-07", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/appplatform/mgmt/2020-07-01/appplatform/enums.go b/services/appplatform/mgmt/2020-07-01/appplatform/enums.go index 1f1f4961bc8b..2338763dfe94 100644 --- a/services/appplatform/mgmt/2020-07-01/appplatform/enums.go +++ b/services/appplatform/mgmt/2020-07-01/appplatform/enums.go @@ -6,6 +6,19 @@ package appplatform // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // Internal ... + Internal ActionType = "Internal" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{Internal} +} + // AppResourceProvisioningState enumerates the values for app resource provisioning state. type AppResourceProvisioningState string @@ -268,6 +281,21 @@ func PossibleTestKeyTypeValues() []TestKeyType { return []TestKeyType{Primary, Secondary} } +// TrafficDirection enumerates the values for traffic direction. +type TrafficDirection string + +const ( + // Inbound ... + Inbound TrafficDirection = "Inbound" + // Outbound ... + Outbound TrafficDirection = "Outbound" +) + +// PossibleTrafficDirectionValues returns an array of possible values for the TrafficDirection const type. +func PossibleTrafficDirectionValues() []TrafficDirection { + return []TrafficDirection{Inbound, Outbound} +} + // UserSourceType enumerates the values for user source type. type UserSourceType string diff --git a/services/appplatform/mgmt/2020-07-01/appplatform/models.go b/services/appplatform/mgmt/2020-07-01/appplatform/models.go index 05599810346a..2da08fd8d7fe 100644 --- a/services/appplatform/mgmt/2020-07-01/appplatform/models.go +++ b/services/appplatform/mgmt/2020-07-01/appplatform/models.go @@ -2380,6 +2380,8 @@ type MetricDimension struct { Name *string `json:"name,omitempty"` // DisplayName - Localized friendly display name of the dimension DisplayName *string `json:"displayName,omitempty"` + // ToBeExportedForShoebox - Whether this dimension should be included for the Shoebox export scenario + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` } // MetricSpecification specifications of the Metrics for Azure Monitoring @@ -2404,6 +2406,8 @@ type MetricSpecification struct { FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` // Dimensions - Dimensions of the metric Dimensions *[]MetricDimension `json:"dimensions,omitempty"` + // SourceMdmNamespace - Name of the MDM namespace. Optional. + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` } // MonitoringSettingProperties monitoring Setting properties payload @@ -2574,6 +2578,8 @@ type NetworkProfile struct { AppNetworkResourceGroup *string `json:"appNetworkResourceGroup,omitempty"` // OutboundIPs - READ-ONLY; Desired outbound IP resources for Azure Spring Cloud instance. OutboundIPs *NetworkProfileOutboundIPs `json:"outboundIPs,omitempty"` + // RequiredTraffics - READ-ONLY; Required inbound or outbound traffics for Azure Spring Cloud instance. + RequiredTraffics *[]RequiredTraffic `json:"requiredTraffics,omitempty"` } // MarshalJSON is the custom marshaler for NetworkProfile. @@ -2617,12 +2623,35 @@ type OperationDetail struct { IsDataAction *bool `json:"isDataAction,omitempty"` // Display - Display of the operation Display *OperationDisplay `json:"display,omitempty"` + // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'Internal' + ActionType ActionType `json:"actionType,omitempty"` // Origin - Origin of the operation Origin *string `json:"origin,omitempty"` // Properties - Properties of the operation Properties *OperationProperties `json:"properties,omitempty"` } +// MarshalJSON is the custom marshaler for OperationDetail. +func (od OperationDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.Name != nil { + objectMap["name"] = od.Name + } + if od.IsDataAction != nil { + objectMap["isDataAction"] = od.IsDataAction + } + if od.Display != nil { + objectMap["display"] = od.Display + } + if od.Origin != nil { + objectMap["origin"] = od.Origin + } + if od.Properties != nil { + objectMap["properties"] = od.Properties + } + return json.Marshal(objectMap) +} + // OperationDisplay operation display payload type OperationDisplay struct { // Provider - Resource provider of the operation @@ -2686,6 +2715,26 @@ type RegenerateTestKeyRequestPayload struct { KeyType TestKeyType `json:"keyType,omitempty"` } +// RequiredTraffic required inbound or outbound traffic for Azure Spring Cloud instance. +type RequiredTraffic struct { + // Protocol - READ-ONLY; The protocol of required traffic + Protocol *string `json:"protocol,omitempty"` + // Port - READ-ONLY; The port of required traffic + Port *int32 `json:"port,omitempty"` + // Ips - READ-ONLY; The ip list of required traffic + Ips *[]string `json:"ips,omitempty"` + // Fqdns - READ-ONLY; The FQDN list of required traffic + Fqdns *[]string `json:"fqdns,omitempty"` + // Direction - READ-ONLY; The direction of required traffic. Possible values include: 'Inbound', 'Outbound' + Direction TrafficDirection `json:"direction,omitempty"` +} + +// MarshalJSON is the custom marshaler for RequiredTraffic. +func (rt RequiredTraffic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // Resource the core properties of ARM resources. type Resource struct { // ID - READ-ONLY; Fully qualified resource Id for the resource. diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/CHANGELOG.md b/services/appplatform/mgmt/2022-04-01/appplatform/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/_meta.json b/services/appplatform/mgmt/2022-04-01/appplatform/_meta.json new file mode 100644 index 000000000000..3933b728eaa4 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "1be34c2955526679d441bda4fa40744b5ee5e1b1", + "readme": "/_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", + "tag": "package-2022-04", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-04 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/appplatformapi/interfaces.go b/services/appplatform/mgmt/2022-04-01/appplatform/appplatformapi/interfaces.go new file mode 100644 index 000000000000..77fb007388f7 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/appplatformapi/interfaces.go @@ -0,0 +1,222 @@ +package appplatformapi + +// 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/appplatform/mgmt/2022-04-01/appplatform" + "github.com/Azure/go-autorest/autorest" +) + +// ServicesClientAPI contains the set of methods on the ServicesClient type. +type ServicesClientAPI interface { + CheckNameAvailability(ctx context.Context, location string, availabilityParameters appplatform.NameAvailabilityParameters) (result appplatform.NameAvailability, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, resource appplatform.ServiceResource) (result appplatform.ServicesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ServicesDeleteFuture, err error) + DisableTestEndpoint(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) + EnableTestEndpoint(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.TestKeys, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ServiceResource, err error) + List(ctx context.Context, resourceGroupName string) (result appplatform.ServiceResourceListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result appplatform.ServiceResourceListIterator, err error) + ListBySubscription(ctx context.Context) (result appplatform.ServiceResourceListPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result appplatform.ServiceResourceListIterator, err error) + ListTestKeys(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.TestKeys, err error) + RegenerateTestKey(ctx context.Context, resourceGroupName string, serviceName string, regenerateTestKeyRequest appplatform.RegenerateTestKeyRequestPayload) (result appplatform.TestKeys, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, resource appplatform.ServiceResource) (result appplatform.ServicesUpdateFuture, err error) +} + +var _ ServicesClientAPI = (*appplatform.ServicesClient)(nil) + +// ConfigServersClientAPI contains the set of methods on the ConfigServersClient type. +type ConfigServersClientAPI interface { + Get(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ConfigServerResource, err error) + UpdatePatch(ctx context.Context, resourceGroupName string, serviceName string, configServerResource appplatform.ConfigServerResource) (result appplatform.ConfigServersUpdatePatchFuture, err error) + UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, configServerResource appplatform.ConfigServerResource) (result appplatform.ConfigServersUpdatePutFuture, err error) + Validate(ctx context.Context, resourceGroupName string, serviceName string, configServerSettings appplatform.ConfigServerSettings) (result appplatform.ConfigServersValidateFuture, err error) +} + +var _ ConfigServersClientAPI = (*appplatform.ConfigServersClient)(nil) + +// ConfigurationServicesClientAPI contains the set of methods on the ConfigurationServicesClient type. +type ConfigurationServicesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string, configurationServiceResource appplatform.ConfigurationServiceResource) (result appplatform.ConfigurationServicesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string) (result appplatform.ConfigurationServicesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string) (result appplatform.ConfigurationServiceResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ConfigurationServiceResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ConfigurationServiceResourceCollectionIterator, err error) + Validate(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string, settings appplatform.ConfigurationServiceSettings) (result appplatform.ConfigurationServicesValidateFuture, err error) +} + +var _ ConfigurationServicesClientAPI = (*appplatform.ConfigurationServicesClient)(nil) + +// ServiceRegistriesClientAPI contains the set of methods on the ServiceRegistriesClient type. +type ServiceRegistriesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (result appplatform.ServiceRegistriesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (result appplatform.ServiceRegistriesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (result appplatform.ServiceRegistryResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ServiceRegistryResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ServiceRegistryResourceCollectionIterator, err error) +} + +var _ ServiceRegistriesClientAPI = (*appplatform.ServiceRegistriesClient)(nil) + +// BuildServiceClientAPI contains the set of methods on the BuildServiceClient type. +type BuildServiceClientAPI interface { + CreateOrUpdateBuild(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildParameter appplatform.Build) (result appplatform.Build, err error) + GetBuild(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (result appplatform.Build, err error) + GetBuildResult(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildResultName string) (result appplatform.BuildResult, err error) + GetBuildResultLog(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildResultName string) (result appplatform.BuildResultLog, err error) + GetBuildService(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuildService, err error) + GetResourceUploadURL(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.ResourceUploadDefinition, err error) + GetSupportedBuildpack(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildpackName string) (result appplatform.SupportedBuildpackResource, err error) + GetSupportedStack(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, stackName string) (result appplatform.SupportedStackResource, err error) + ListBuildResults(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (result appplatform.BuildResultCollectionPage, err error) + ListBuildResultsComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (result appplatform.BuildResultCollectionIterator, err error) + ListBuilds(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuildCollectionPage, err error) + ListBuildsComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuildCollectionIterator, err error) + ListBuildServices(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.BuildServiceCollectionPage, err error) + ListBuildServicesComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.BuildServiceCollectionIterator, err error) + ListSupportedBuildpacks(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.SupportedBuildpacksCollection, err error) + ListSupportedStacks(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.SupportedStacksCollection, err error) +} + +var _ BuildServiceClientAPI = (*appplatform.BuildServiceClient)(nil) + +// BuildpackBindingClientAPI contains the set of methods on the BuildpackBindingClient type. +type BuildpackBindingClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string, buildpackBinding appplatform.BuildpackBindingResource) (result appplatform.BuildpackBindingCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string) (result appplatform.BuildpackBindingDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string) (result appplatform.BuildpackBindingResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result appplatform.BuildpackBindingResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result appplatform.BuildpackBindingResourceCollectionIterator, err error) +} + +var _ BuildpackBindingClientAPI = (*appplatform.BuildpackBindingClient)(nil) + +// BuildServiceBuilderClientAPI contains the set of methods on the BuildServiceBuilderClient type. +type BuildServiceBuilderClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, builderResource appplatform.BuilderResource) (result appplatform.BuildServiceBuilderCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result appplatform.BuildServiceBuilderDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result appplatform.BuilderResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuilderResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuilderResourceCollectionIterator, err error) +} + +var _ BuildServiceBuilderClientAPI = (*appplatform.BuildServiceBuilderClient)(nil) + +// BuildServiceAgentPoolClientAPI contains the set of methods on the BuildServiceAgentPoolClient type. +type BuildServiceAgentPoolClientAPI interface { + Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string) (result appplatform.BuildServiceAgentPoolResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuildServiceAgentPoolResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuildServiceAgentPoolResourceCollectionIterator, err error) + UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string, agentPoolResource appplatform.BuildServiceAgentPoolResource) (result appplatform.BuildServiceAgentPoolUpdatePutFuture, err error) +} + +var _ BuildServiceAgentPoolClientAPI = (*appplatform.BuildServiceAgentPoolClient)(nil) + +// MonitoringSettingsClientAPI contains the set of methods on the MonitoringSettingsClient type. +type MonitoringSettingsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.MonitoringSettingResource, err error) + UpdatePatch(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource appplatform.MonitoringSettingResource) (result appplatform.MonitoringSettingsUpdatePatchFuture, err error) + UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource appplatform.MonitoringSettingResource) (result appplatform.MonitoringSettingsUpdatePutFuture, err error) +} + +var _ MonitoringSettingsClientAPI = (*appplatform.MonitoringSettingsClient)(nil) + +// AppsClientAPI contains the set of methods on the AppsClient type. +type AppsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource appplatform.AppResource) (result appplatform.AppsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.AppsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (result appplatform.AppResource, err error) + GetResourceUploadURL(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.ResourceUploadDefinition, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.AppResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.AppResourceCollectionIterator, err error) + SetActiveDeployments(ctx context.Context, resourceGroupName string, serviceName string, appName string, activeDeploymentCollection appplatform.ActiveDeploymentCollection) (result appplatform.AppsSetActiveDeploymentsFuture, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource appplatform.AppResource) (result appplatform.AppsUpdateFuture, err error) + ValidateDomain(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload appplatform.CustomDomainValidatePayload) (result appplatform.CustomDomainValidateResult, err error) +} + +var _ AppsClientAPI = (*appplatform.AppsClient)(nil) + +// BindingsClientAPI contains the set of methods on the BindingsClient type. +type BindingsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource appplatform.BindingResource) (result appplatform.BindingsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (result appplatform.BindingsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (result appplatform.BindingResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.BindingResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.BindingResourceCollectionIterator, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource appplatform.BindingResource) (result appplatform.BindingsUpdateFuture, err error) +} + +var _ BindingsClientAPI = (*appplatform.BindingsClient)(nil) + +// CertificatesClientAPI contains the set of methods on the CertificatesClient type. +type CertificatesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, certificateName string, certificateResource appplatform.CertificateResource) (result appplatform.CertificatesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (result appplatform.CertificatesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (result appplatform.CertificateResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.CertificateResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.CertificateResourceCollectionIterator, err error) +} + +var _ CertificatesClientAPI = (*appplatform.CertificatesClient)(nil) + +// CustomDomainsClientAPI contains the set of methods on the CustomDomainsClient type. +type CustomDomainsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource appplatform.CustomDomainResource) (result appplatform.CustomDomainsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (result appplatform.CustomDomainsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (result appplatform.CustomDomainResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.CustomDomainResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.CustomDomainResourceCollectionIterator, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource appplatform.CustomDomainResource) (result appplatform.CustomDomainsUpdateFuture, err error) +} + +var _ CustomDomainsClientAPI = (*appplatform.CustomDomainsClient)(nil) + +// DeploymentsClientAPI contains the set of methods on the DeploymentsClient type. +type DeploymentsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource appplatform.DeploymentResource) (result appplatform.DeploymentsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentsDeleteFuture, err error) + GenerateHeapDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters appplatform.DiagnosticParameters) (result appplatform.DeploymentsGenerateHeapDumpFuture, err error) + GenerateThreadDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters appplatform.DiagnosticParameters) (result appplatform.DeploymentsGenerateThreadDumpFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentResource, err error) + GetLogFileURL(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.LogFileURLResponse, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result appplatform.DeploymentResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result appplatform.DeploymentResourceCollectionIterator, err error) + ListForCluster(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result appplatform.DeploymentResourceCollectionPage, err error) + ListForClusterComplete(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result appplatform.DeploymentResourceCollectionIterator, err error) + Restart(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentsRestartFuture, err error) + Start(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentsStartFuture, err error) + StartJFR(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters appplatform.DiagnosticParameters) (result appplatform.DeploymentsStartJFRFuture, err error) + Stop(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentsStopFuture, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource appplatform.DeploymentResource) (result appplatform.DeploymentsUpdateFuture, err error) +} + +var _ DeploymentsClientAPI = (*appplatform.DeploymentsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result appplatform.AvailableOperationsPage, err error) + ListComplete(ctx context.Context) (result appplatform.AvailableOperationsIterator, err error) +} + +var _ OperationsClientAPI = (*appplatform.OperationsClient)(nil) + +// RuntimeVersionsClientAPI contains the set of methods on the RuntimeVersionsClient type. +type RuntimeVersionsClientAPI interface { + ListRuntimeVersions(ctx context.Context) (result appplatform.AvailableRuntimeVersions, err error) +} + +var _ RuntimeVersionsClientAPI = (*appplatform.RuntimeVersionsClient)(nil) + +// SkusClientAPI contains the set of methods on the SkusClient type. +type SkusClientAPI interface { + List(ctx context.Context) (result appplatform.ResourceSkuCollectionPage, err error) + ListComplete(ctx context.Context) (result appplatform.ResourceSkuCollectionIterator, err error) +} + +var _ SkusClientAPI = (*appplatform.SkusClient)(nil) diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/apps.go b/services/appplatform/mgmt/2022-04-01/appplatform/apps.go new file mode 100644 index 000000000000..7cc238f57135 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/apps.go @@ -0,0 +1,760 @@ +package appplatform + +// 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" +) + +// AppsClient is the REST API for Azure Spring Apps +type AppsClient struct { + BaseClient +} + +// NewAppsClient creates an instance of the AppsClient client. +func NewAppsClient(subscriptionID string) AppsClient { + return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppsClientWithBaseURI creates an instance of the AppsClient 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 NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { + return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new App or update an exiting App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// appResource - parameters for the create or update operation +func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (result AppsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.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: appResource, + Constraints: []validation.Constraint{{Target: "appResource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.InclusiveMaximum, Rule: int64(5), Chain: nil}, + {Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + {Target: "appResource.Properties.PersistentDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, + {Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, + {Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.AppsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, appResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), + autorest.WithJSON(appResource), + 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 AppsClient) CreateOrUpdateSender(req *http.Request) (future AppsCreateOrUpdateFuture, 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 AppsClient) CreateOrUpdateResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete an App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result AppsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.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, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", 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 AppsClient) DeleteSender(req *http.Request) (future AppsDeleteFuture, 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 AppsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get an App and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// syncStatus - indicates whether sync status +func (client AppsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (result AppResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.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, serviceName, appName, syncStatus) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(syncStatus) > 0 { + queryParameters["syncStatus"] = autorest.Encode("query", syncStatus) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", 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 AppsClient) 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 AppsClient) GetResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetResourceUploadURL get an resource upload URL for an App, which may be artifacts or source archive. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client AppsClient) GetResourceUploadURL(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result ResourceUploadDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetResourceUploadURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetResourceUploadURLPreparer(ctx, resourceGroupName, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetResourceUploadURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", resp, "Failure sending request") + return + } + + result, err = client.GetResourceUploadURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", resp, "Failure responding to request") + return + } + + return +} + +// GetResourceUploadURLPreparer prepares the GetResourceUploadURL request. +func (client AppsClient) GetResourceUploadURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetResourceUploadURLSender sends the GetResourceUploadURL request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetResourceUploadURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResourceUploadURLResponder handles the response to the GetResourceUploadURL request. The method always +// closes the http.Response Body. +func (client AppsClient) GetResourceUploadURLResponder(resp *http.Response) (result ResourceUploadDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client AppsClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result AppResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.List") + defer func() { + sc := -1 + if result.arc.Response.Response != nil { + sc = result.arc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", resp, "Failure sending request") + return + } + + result.arc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", resp, "Failure responding to request") + return + } + if result.arc.hasNextLink() && result.arc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AppsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", 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 AppsClient) 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 AppsClient) ListResponder(resp *http.Response) (result AppResourceCollection, 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 AppsClient) listNextResults(ctx context.Context, lastResults AppResourceCollection) (result AppResourceCollection, err error) { + req, err := lastResults.appResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.AppsClient", "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, "appplatform.AppsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result AppResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.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, serviceName) + return +} + +// SetActiveDeployments set existing Deployment under the app as active +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// activeDeploymentCollection - a list of Deployment name to be active. +func (client AppsClient) SetActiveDeployments(ctx context.Context, resourceGroupName string, serviceName string, appName string, activeDeploymentCollection ActiveDeploymentCollection) (result AppsSetActiveDeploymentsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.SetActiveDeployments") + 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.SetActiveDeploymentsPreparer(ctx, resourceGroupName, serviceName, appName, activeDeploymentCollection) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "SetActiveDeployments", nil, "Failure preparing request") + return + } + + result, err = client.SetActiveDeploymentsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "SetActiveDeployments", result.Response(), "Failure sending request") + return + } + + return +} + +// SetActiveDeploymentsPreparer prepares the SetActiveDeployments request. +func (client AppsClient) SetActiveDeploymentsPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, activeDeploymentCollection ActiveDeploymentCollection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", pathParameters), + autorest.WithJSON(activeDeploymentCollection), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetActiveDeploymentsSender sends the SetActiveDeployments request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SetActiveDeploymentsSender(req *http.Request) (future AppsSetActiveDeploymentsFuture, 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 +} + +// SetActiveDeploymentsResponder handles the response to the SetActiveDeployments request. The method always +// closes the http.Response Body. +func (client AppsClient) SetActiveDeploymentsResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update operation to update an exiting App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// appResource - parameters for the update operation +func (client AppsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (result AppsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, appResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), + autorest.WithJSON(appResource), + 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 AppsClient) UpdateSender(req *http.Request) (future AppsUpdateFuture, 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 AppsClient) UpdateResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateDomain check the resource name is valid as well as not in use. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// validatePayload - custom domain payload to be validated +func (client AppsClient) ValidateDomain(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload CustomDomainValidatePayload) (result CustomDomainValidateResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ValidateDomain") + 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: validatePayload, + Constraints: []validation.Constraint{{Target: "validatePayload.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("appplatform.AppsClient", "ValidateDomain", err.Error()) + } + + req, err := client.ValidateDomainPreparer(ctx, resourceGroupName, serviceName, appName, validatePayload) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "ValidateDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "ValidateDomain", resp, "Failure sending request") + return + } + + result, err = client.ValidateDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "ValidateDomain", resp, "Failure responding to request") + return + } + + return +} + +// ValidateDomainPreparer prepares the ValidateDomain request. +func (client AppsClient) ValidateDomainPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload CustomDomainValidatePayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", pathParameters), + autorest.WithJSON(validatePayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateDomainSender sends the ValidateDomain request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ValidateDomainSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateDomainResponder handles the response to the ValidateDomain request. The method always +// closes the http.Response Body. +func (client AppsClient) ValidateDomainResponder(resp *http.Response) (result CustomDomainValidateResult, 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/appplatform/mgmt/2022-04-01/appplatform/bindings.go b/services/appplatform/mgmt/2022-04-01/appplatform/bindings.go new file mode 100644 index 000000000000..948d9dd83d06 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/bindings.go @@ -0,0 +1,490 @@ +package appplatform + +// 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" +) + +// BindingsClient is the REST API for Azure Spring Apps +type BindingsClient struct { + BaseClient +} + +// NewBindingsClient creates an instance of the BindingsClient client. +func NewBindingsClient(subscriptionID string) BindingsClient { + return NewBindingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBindingsClientWithBaseURI creates an instance of the BindingsClient 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 NewBindingsClientWithBaseURI(baseURI string, subscriptionID string) BindingsClient { + return BindingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Binding or update an exiting Binding. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// bindingName - the name of the Binding resource. +// bindingResource - parameters for the create or update operation +func (client BindingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource BindingResource) (result BindingsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, bindingName, bindingResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BindingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource BindingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "bindingName": autorest.Encode("path", bindingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", pathParameters), + autorest.WithJSON(bindingResource), + 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 BindingsClient) CreateOrUpdateSender(req *http.Request) (future BindingsCreateOrUpdateFuture, 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 BindingsClient) CreateOrUpdateResponder(resp *http.Response) (result BindingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete a Binding. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// bindingName - the name of the Binding resource. +func (client BindingsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (result BindingsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.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, serviceName, appName, bindingName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BindingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "bindingName": autorest.Encode("path", bindingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", 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 BindingsClient) DeleteSender(req *http.Request) (future BindingsDeleteFuture, 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 BindingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a Binding and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// bindingName - the name of the Binding resource. +func (client BindingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (result BindingResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.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, serviceName, appName, bindingName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BindingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "bindingName": autorest.Encode("path", bindingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", 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 BindingsClient) 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 BindingsClient) GetResponder(resp *http.Response) (result BindingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in an App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client BindingsClient) List(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result BindingResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.List") + defer func() { + sc := -1 + if result.brc.Response.Response != nil { + sc = result.brc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.brc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "List", resp, "Failure sending request") + return + } + + result.brc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "List", resp, "Failure responding to request") + return + } + if result.brc.hasNextLink() && result.brc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BindingsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", 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 BindingsClient) 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 BindingsClient) ListResponder(resp *http.Response) (result BindingResourceCollection, 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 BindingsClient) listNextResults(ctx context.Context, lastResults BindingResourceCollection) (result BindingResourceCollection, err error) { + req, err := lastResults.bindingResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BindingsClient", "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, "appplatform.BindingsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BindingsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result BindingResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.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, serviceName, appName) + return +} + +// Update operation to update an exiting Binding. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// bindingName - the name of the Binding resource. +// bindingResource - parameters for the update operation +func (client BindingsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource BindingResource) (result BindingsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, bindingName, bindingResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BindingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource BindingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "bindingName": autorest.Encode("path", bindingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", pathParameters), + autorest.WithJSON(bindingResource), + 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 BindingsClient) UpdateSender(req *http.Request) (future BindingsUpdateFuture, 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 BindingsClient) UpdateResponder(resp *http.Response) (result BindingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/buildpackbinding.go b/services/appplatform/mgmt/2022-04-01/appplatform/buildpackbinding.go new file mode 100644 index 000000000000..64e6cdfae97f --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/buildpackbinding.go @@ -0,0 +1,412 @@ +package appplatform + +// 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" +) + +// BuildpackBindingClient is the REST API for Azure Spring Apps +type BuildpackBindingClient struct { + BaseClient +} + +// NewBuildpackBindingClient creates an instance of the BuildpackBindingClient client. +func NewBuildpackBindingClient(subscriptionID string) BuildpackBindingClient { + return NewBuildpackBindingClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBuildpackBindingClientWithBaseURI creates an instance of the BuildpackBindingClient 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 NewBuildpackBindingClientWithBaseURI(baseURI string, subscriptionID string) BuildpackBindingClient { + return BuildpackBindingClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a buildpack binding. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +// buildpackBindingName - the name of the Buildpack Binding Name +// buildpackBinding - the target buildpack binding for the create or update operation +func (client BuildpackBindingClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string, buildpackBinding BuildpackBindingResource) (result BuildpackBindingCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName, buildpackBinding) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BuildpackBindingClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string, buildpackBinding BuildpackBindingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildpackBindingName": autorest.Encode("path", buildpackBindingName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}", pathParameters), + autorest.WithJSON(buildpackBinding), + 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 BuildpackBindingClient) CreateOrUpdateSender(req *http.Request) (future BuildpackBindingCreateOrUpdateFuture, 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 BuildpackBindingClient) CreateOrUpdateResponder(resp *http.Response) (result BuildpackBindingResource, 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 operation to delete a Buildpack Binding +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +// buildpackBindingName - the name of the Buildpack Binding Name +func (client BuildpackBindingClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string) (result BuildpackBindingDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingClient.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, serviceName, buildServiceName, builderName, buildpackBindingName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BuildpackBindingClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildpackBindingName": autorest.Encode("path", buildpackBindingName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}", 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 BuildpackBindingClient) DeleteSender(req *http.Request) (future BuildpackBindingDeleteFuture, 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 BuildpackBindingClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a buildpack binding by name. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +// buildpackBindingName - the name of the Buildpack Binding Name +func (client BuildpackBindingClient) Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string) (result BuildpackBindingResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingClient.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, serviceName, buildServiceName, builderName, buildpackBindingName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BuildpackBindingClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildpackBindingName": autorest.Encode("path", buildpackBindingName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}", 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 BuildpackBindingClient) 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 BuildpackBindingClient) GetResponder(resp *http.Response) (result BuildpackBindingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all buildpack bindings in a builder. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +func (client BuildpackBindingClient) List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result BuildpackBindingResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingClient.List") + defer func() { + sc := -1 + if result.bbrc.Response.Response != nil { + sc = result.bbrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, buildServiceName, builderName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.bbrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "List", resp, "Failure sending request") + return + } + + result.bbrc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "List", resp, "Failure responding to request") + return + } + if result.bbrc.hasNextLink() && result.bbrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BuildpackBindingClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", 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 BuildpackBindingClient) 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 BuildpackBindingClient) ListResponder(resp *http.Response) (result BuildpackBindingResourceCollection, 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 BuildpackBindingClient) listNextResults(ctx context.Context, lastResults BuildpackBindingResourceCollection) (result BuildpackBindingResourceCollection, err error) { + req, err := lastResults.buildpackBindingResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "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, "appplatform.BuildpackBindingClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BuildpackBindingClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result BuildpackBindingResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingClient.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, serviceName, buildServiceName, builderName) + return +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/buildservice.go b/services/appplatform/mgmt/2022-04-01/appplatform/buildservice.go new file mode 100644 index 000000000000..28463857d532 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/buildservice.go @@ -0,0 +1,1203 @@ +package appplatform + +// 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" +) + +// BuildServiceClient is the REST API for Azure Spring Apps +type BuildServiceClient struct { + BaseClient +} + +// NewBuildServiceClient creates an instance of the BuildServiceClient client. +func NewBuildServiceClient(subscriptionID string) BuildServiceClient { + return NewBuildServiceClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBuildServiceClientWithBaseURI creates an instance of the BuildServiceClient 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 NewBuildServiceClientWithBaseURI(baseURI string, subscriptionID string) BuildServiceClient { + return BuildServiceClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdateBuild create or update a KPack build. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// buildName - the name of the build resource. +// buildParameter - parameters for the create or update operation +func (client BuildServiceClient) CreateOrUpdateBuild(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildParameter Build) (result Build, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.CreateOrUpdateBuild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdateBuildPreparer(ctx, resourceGroupName, serviceName, buildServiceName, buildName, buildParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "CreateOrUpdateBuild", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateBuildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "CreateOrUpdateBuild", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateBuildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "CreateOrUpdateBuild", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateBuildPreparer prepares the CreateOrUpdateBuild request. +func (client BuildServiceClient) CreateOrUpdateBuildPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildParameter Build) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildName": autorest.Encode("path", buildName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", pathParameters), + autorest.WithJSON(buildParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateBuildSender sends the CreateOrUpdateBuild request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) CreateOrUpdateBuildSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateBuildResponder handles the response to the CreateOrUpdateBuild request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) CreateOrUpdateBuildResponder(resp *http.Response) (result Build, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBuild get a KPack build. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// buildName - the name of the build resource. +func (client BuildServiceClient) GetBuild(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (result Build, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetBuild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetBuildPreparer(ctx, resourceGroupName, serviceName, buildServiceName, buildName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuild", nil, "Failure preparing request") + return + } + + resp, err := client.GetBuildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuild", resp, "Failure sending request") + return + } + + result, err = client.GetBuildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuild", resp, "Failure responding to request") + return + } + + return +} + +// GetBuildPreparer prepares the GetBuild request. +func (client BuildServiceClient) GetBuildPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildName": autorest.Encode("path", buildName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBuildSender sends the GetBuild request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetBuildSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBuildResponder handles the response to the GetBuild request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetBuildResponder(resp *http.Response) (result Build, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBuildResult get a KPack build result. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// buildName - the name of the build resource. +// buildResultName - the name of the build result resource. +func (client BuildServiceClient) GetBuildResult(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildResultName string) (result BuildResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetBuildResult") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetBuildResultPreparer(ctx, resourceGroupName, serviceName, buildServiceName, buildName, buildResultName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildResult", nil, "Failure preparing request") + return + } + + resp, err := client.GetBuildResultSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildResult", resp, "Failure sending request") + return + } + + result, err = client.GetBuildResultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildResult", resp, "Failure responding to request") + return + } + + return +} + +// GetBuildResultPreparer prepares the GetBuildResult request. +func (client BuildServiceClient) GetBuildResultPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildResultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildName": autorest.Encode("path", buildName), + "buildResultName": autorest.Encode("path", buildResultName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBuildResultSender sends the GetBuildResult request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetBuildResultSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBuildResultResponder handles the response to the GetBuildResult request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetBuildResultResponder(resp *http.Response) (result BuildResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBuildResultLog get a KPack build result log download URL. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// buildName - the name of the build resource. +// buildResultName - the name of the build result resource. +func (client BuildServiceClient) GetBuildResultLog(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildResultName string) (result BuildResultLog, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetBuildResultLog") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetBuildResultLogPreparer(ctx, resourceGroupName, serviceName, buildServiceName, buildName, buildResultName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildResultLog", nil, "Failure preparing request") + return + } + + resp, err := client.GetBuildResultLogSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildResultLog", resp, "Failure sending request") + return + } + + result, err = client.GetBuildResultLogResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildResultLog", resp, "Failure responding to request") + return + } + + return +} + +// GetBuildResultLogPreparer prepares the GetBuildResultLog request. +func (client BuildServiceClient) GetBuildResultLogPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildResultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildName": autorest.Encode("path", buildName), + "buildResultName": autorest.Encode("path", buildResultName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBuildResultLogSender sends the GetBuildResultLog request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetBuildResultLogSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBuildResultLogResponder handles the response to the GetBuildResultLog request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetBuildResultLogResponder(resp *http.Response) (result BuildResultLog, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBuildService get a build service resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceClient) GetBuildService(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuildService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetBuildService") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetBuildServicePreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildService", nil, "Failure preparing request") + return + } + + resp, err := client.GetBuildServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildService", resp, "Failure sending request") + return + } + + result, err = client.GetBuildServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildService", resp, "Failure responding to request") + return + } + + return +} + +// GetBuildServicePreparer prepares the GetBuildService request. +func (client BuildServiceClient) GetBuildServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBuildServiceSender sends the GetBuildService request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetBuildServiceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBuildServiceResponder handles the response to the GetBuildService request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetBuildServiceResponder(resp *http.Response) (result BuildService, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetResourceUploadURL get an resource upload URL for build service, which may be artifacts or source archive. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceClient) GetResourceUploadURL(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result ResourceUploadDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetResourceUploadURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetResourceUploadURLPreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetResourceUploadURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetResourceUploadURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetResourceUploadURL", resp, "Failure sending request") + return + } + + result, err = client.GetResourceUploadURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetResourceUploadURL", resp, "Failure responding to request") + return + } + + return +} + +// GetResourceUploadURLPreparer prepares the GetResourceUploadURL request. +func (client BuildServiceClient) GetResourceUploadURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetResourceUploadURLSender sends the GetResourceUploadURL request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetResourceUploadURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResourceUploadURLResponder handles the response to the GetResourceUploadURL request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetResourceUploadURLResponder(resp *http.Response) (result ResourceUploadDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSupportedBuildpack get the supported buildpack resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// buildpackName - the name of the buildpack resource. +func (client BuildServiceClient) GetSupportedBuildpack(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildpackName string) (result SupportedBuildpackResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetSupportedBuildpack") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetSupportedBuildpackPreparer(ctx, resourceGroupName, serviceName, buildServiceName, buildpackName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetSupportedBuildpack", nil, "Failure preparing request") + return + } + + resp, err := client.GetSupportedBuildpackSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetSupportedBuildpack", resp, "Failure sending request") + return + } + + result, err = client.GetSupportedBuildpackResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetSupportedBuildpack", resp, "Failure responding to request") + return + } + + return +} + +// GetSupportedBuildpackPreparer prepares the GetSupportedBuildpack request. +func (client BuildServiceClient) GetSupportedBuildpackPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildpackName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildpackName": autorest.Encode("path", buildpackName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSupportedBuildpackSender sends the GetSupportedBuildpack request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetSupportedBuildpackSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSupportedBuildpackResponder handles the response to the GetSupportedBuildpack request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetSupportedBuildpackResponder(resp *http.Response) (result SupportedBuildpackResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSupportedStack get the supported stack resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// stackName - the name of the stack resource. +func (client BuildServiceClient) GetSupportedStack(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, stackName string) (result SupportedStackResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetSupportedStack") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetSupportedStackPreparer(ctx, resourceGroupName, serviceName, buildServiceName, stackName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetSupportedStack", nil, "Failure preparing request") + return + } + + resp, err := client.GetSupportedStackSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetSupportedStack", resp, "Failure sending request") + return + } + + result, err = client.GetSupportedStackResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetSupportedStack", resp, "Failure responding to request") + return + } + + return +} + +// GetSupportedStackPreparer prepares the GetSupportedStack request. +func (client BuildServiceClient) GetSupportedStackPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, stackName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "stackName": autorest.Encode("path", stackName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSupportedStackSender sends the GetSupportedStack request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetSupportedStackSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSupportedStackResponder handles the response to the GetSupportedStack request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetSupportedStackResponder(resp *http.Response) (result SupportedStackResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBuildResults list KPack build results. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// buildName - the name of the build resource. +func (client BuildServiceClient) ListBuildResults(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (result BuildResultCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListBuildResults") + defer func() { + sc := -1 + if result.brc.Response.Response != nil { + sc = result.brc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBuildResultsNextResults + req, err := client.ListBuildResultsPreparer(ctx, resourceGroupName, serviceName, buildServiceName, buildName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuildResults", nil, "Failure preparing request") + return + } + + resp, err := client.ListBuildResultsSender(req) + if err != nil { + result.brc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuildResults", resp, "Failure sending request") + return + } + + result.brc, err = client.ListBuildResultsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuildResults", resp, "Failure responding to request") + return + } + if result.brc.hasNextLink() && result.brc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBuildResultsPreparer prepares the ListBuildResults request. +func (client BuildServiceClient) ListBuildResultsPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildName": autorest.Encode("path", buildName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBuildResultsSender sends the ListBuildResults request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) ListBuildResultsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBuildResultsResponder handles the response to the ListBuildResults request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) ListBuildResultsResponder(resp *http.Response) (result BuildResultCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBuildResultsNextResults retrieves the next set of results, if any. +func (client BuildServiceClient) listBuildResultsNextResults(ctx context.Context, lastResults BuildResultCollection) (result BuildResultCollection, err error) { + req, err := lastResults.buildResultCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildResultsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBuildResultsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildResultsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBuildResultsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildResultsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBuildResultsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BuildServiceClient) ListBuildResultsComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (result BuildResultCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListBuildResults") + 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.ListBuildResults(ctx, resourceGroupName, serviceName, buildServiceName, buildName) + return +} + +// ListBuilds list KPack builds. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceClient) ListBuilds(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuildCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListBuilds") + defer func() { + sc := -1 + if result.bc.Response.Response != nil { + sc = result.bc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBuildsNextResults + req, err := client.ListBuildsPreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuilds", nil, "Failure preparing request") + return + } + + resp, err := client.ListBuildsSender(req) + if err != nil { + result.bc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuilds", resp, "Failure sending request") + return + } + + result.bc, err = client.ListBuildsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuilds", resp, "Failure responding to request") + return + } + if result.bc.hasNextLink() && result.bc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBuildsPreparer prepares the ListBuilds request. +func (client BuildServiceClient) ListBuildsPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBuildsSender sends the ListBuilds request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) ListBuildsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBuildsResponder handles the response to the ListBuilds request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) ListBuildsResponder(resp *http.Response) (result BuildCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBuildsNextResults retrieves the next set of results, if any. +func (client BuildServiceClient) listBuildsNextResults(ctx context.Context, lastResults BuildCollection) (result BuildCollection, err error) { + req, err := lastResults.buildCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBuildsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBuildsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBuildsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BuildServiceClient) ListBuildsComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuildCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListBuilds") + 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.ListBuilds(ctx, resourceGroupName, serviceName, buildServiceName) + return +} + +// ListBuildServices list build services resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client BuildServiceClient) ListBuildServices(ctx context.Context, resourceGroupName string, serviceName string) (result BuildServiceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListBuildServices") + defer func() { + sc := -1 + if result.bsc.Response.Response != nil { + sc = result.bsc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBuildServicesNextResults + req, err := client.ListBuildServicesPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuildServices", nil, "Failure preparing request") + return + } + + resp, err := client.ListBuildServicesSender(req) + if err != nil { + result.bsc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuildServices", resp, "Failure sending request") + return + } + + result.bsc, err = client.ListBuildServicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuildServices", resp, "Failure responding to request") + return + } + if result.bsc.hasNextLink() && result.bsc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBuildServicesPreparer prepares the ListBuildServices request. +func (client BuildServiceClient) ListBuildServicesPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBuildServicesSender sends the ListBuildServices request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) ListBuildServicesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBuildServicesResponder handles the response to the ListBuildServices request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) ListBuildServicesResponder(resp *http.Response) (result BuildServiceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBuildServicesNextResults retrieves the next set of results, if any. +func (client BuildServiceClient) listBuildServicesNextResults(ctx context.Context, lastResults BuildServiceCollection) (result BuildServiceCollection, err error) { + req, err := lastResults.buildServiceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildServicesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBuildServicesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildServicesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBuildServicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildServicesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBuildServicesComplete enumerates all values, automatically crossing page boundaries as required. +func (client BuildServiceClient) ListBuildServicesComplete(ctx context.Context, resourceGroupName string, serviceName string) (result BuildServiceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListBuildServices") + 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.ListBuildServices(ctx, resourceGroupName, serviceName) + return +} + +// ListSupportedBuildpacks get all supported buildpacks. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceClient) ListSupportedBuildpacks(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result SupportedBuildpacksCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListSupportedBuildpacks") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSupportedBuildpacksPreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListSupportedBuildpacks", nil, "Failure preparing request") + return + } + + resp, err := client.ListSupportedBuildpacksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListSupportedBuildpacks", resp, "Failure sending request") + return + } + + result, err = client.ListSupportedBuildpacksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListSupportedBuildpacks", resp, "Failure responding to request") + return + } + + return +} + +// ListSupportedBuildpacksPreparer prepares the ListSupportedBuildpacks request. +func (client BuildServiceClient) ListSupportedBuildpacksPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSupportedBuildpacksSender sends the ListSupportedBuildpacks request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) ListSupportedBuildpacksSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSupportedBuildpacksResponder handles the response to the ListSupportedBuildpacks request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) ListSupportedBuildpacksResponder(resp *http.Response) (result SupportedBuildpacksCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSupportedStacks get all supported stacks. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceClient) ListSupportedStacks(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result SupportedStacksCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListSupportedStacks") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSupportedStacksPreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListSupportedStacks", nil, "Failure preparing request") + return + } + + resp, err := client.ListSupportedStacksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListSupportedStacks", resp, "Failure sending request") + return + } + + result, err = client.ListSupportedStacksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListSupportedStacks", resp, "Failure responding to request") + return + } + + return +} + +// ListSupportedStacksPreparer prepares the ListSupportedStacks request. +func (client BuildServiceClient) ListSupportedStacksPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSupportedStacksSender sends the ListSupportedStacks request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) ListSupportedStacksSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSupportedStacksResponder handles the response to the ListSupportedStacks request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) ListSupportedStacksResponder(resp *http.Response) (result SupportedStacksCollection, 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/appplatform/mgmt/2022-04-01/appplatform/buildserviceagentpool.go b/services/appplatform/mgmt/2022-04-01/appplatform/buildserviceagentpool.go new file mode 100644 index 000000000000..b823ddda7684 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/buildserviceagentpool.go @@ -0,0 +1,321 @@ +package appplatform + +// 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" +) + +// BuildServiceAgentPoolClient is the REST API for Azure Spring Apps +type BuildServiceAgentPoolClient struct { + BaseClient +} + +// NewBuildServiceAgentPoolClient creates an instance of the BuildServiceAgentPoolClient client. +func NewBuildServiceAgentPoolClient(subscriptionID string) BuildServiceAgentPoolClient { + return NewBuildServiceAgentPoolClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBuildServiceAgentPoolClientWithBaseURI creates an instance of the BuildServiceAgentPoolClient 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 NewBuildServiceAgentPoolClientWithBaseURI(baseURI string, subscriptionID string) BuildServiceAgentPoolClient { + return BuildServiceAgentPoolClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get build service agent pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// agentPoolName - the name of the build service agent pool resource. +func (client BuildServiceAgentPoolClient) Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string) (result BuildServiceAgentPoolResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolClient.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, serviceName, buildServiceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BuildServiceAgentPoolClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceAgentPoolClient) 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 BuildServiceAgentPoolClient) GetResponder(resp *http.Response) (result BuildServiceAgentPoolResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list build service agent pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceAgentPoolClient) List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuildServiceAgentPoolResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolClient.List") + defer func() { + sc := -1 + if result.bsaprc.Response.Response != nil { + sc = result.bsaprc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.bsaprc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "List", resp, "Failure sending request") + return + } + + result.bsaprc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "List", resp, "Failure responding to request") + return + } + if result.bsaprc.hasNextLink() && result.bsaprc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BuildServiceAgentPoolClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceAgentPoolClient) 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 BuildServiceAgentPoolClient) ListResponder(resp *http.Response) (result BuildServiceAgentPoolResourceCollection, 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 BuildServiceAgentPoolClient) listNextResults(ctx context.Context, lastResults BuildServiceAgentPoolResourceCollection) (result BuildServiceAgentPoolResourceCollection, err error) { + req, err := lastResults.buildServiceAgentPoolResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "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, "appplatform.BuildServiceAgentPoolClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BuildServiceAgentPoolClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuildServiceAgentPoolResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolClient.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, serviceName, buildServiceName) + return +} + +// UpdatePut create or update build service agent pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// agentPoolName - the name of the build service agent pool resource. +// agentPoolResource - parameters for the update operation +func (client BuildServiceAgentPoolClient) UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string, agentPoolResource BuildServiceAgentPoolResource) (result BuildServiceAgentPoolUpdatePutFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolClient.UpdatePut") + 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.UpdatePutPreparer(ctx, resourceGroupName, serviceName, buildServiceName, agentPoolName, agentPoolResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "UpdatePut", nil, "Failure preparing request") + return + } + + result, err = client.UpdatePutSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "UpdatePut", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePutPreparer prepares the UpdatePut request. +func (client BuildServiceAgentPoolClient) UpdatePutPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string, agentPoolResource BuildServiceAgentPoolResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", pathParameters), + autorest.WithJSON(agentPoolResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePutSender sends the UpdatePut request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceAgentPoolClient) UpdatePutSender(req *http.Request) (future BuildServiceAgentPoolUpdatePutFuture, 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 +} + +// UpdatePutResponder handles the response to the UpdatePut request. The method always +// closes the http.Response Body. +func (client BuildServiceAgentPoolClient) UpdatePutResponder(resp *http.Response) (result BuildServiceAgentPoolResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/buildservicebuilder.go b/services/appplatform/mgmt/2022-04-01/appplatform/buildservicebuilder.go new file mode 100644 index 000000000000..96dd01558e4d --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/buildservicebuilder.go @@ -0,0 +1,404 @@ +package appplatform + +// 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" +) + +// BuildServiceBuilderClient is the REST API for Azure Spring Apps +type BuildServiceBuilderClient struct { + BaseClient +} + +// NewBuildServiceBuilderClient creates an instance of the BuildServiceBuilderClient client. +func NewBuildServiceBuilderClient(subscriptionID string) BuildServiceBuilderClient { + return NewBuildServiceBuilderClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBuildServiceBuilderClientWithBaseURI creates an instance of the BuildServiceBuilderClient 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 NewBuildServiceBuilderClientWithBaseURI(baseURI string, subscriptionID string) BuildServiceBuilderClient { + return BuildServiceBuilderClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a KPack builder. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +// builderResource - the target builder for the create or update operation +func (client BuildServiceBuilderClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, builderResource BuilderResource) (result BuildServiceBuilderCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceBuilderClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, buildServiceName, builderName, builderResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BuildServiceBuilderClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, builderResource BuilderResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", pathParameters), + autorest.WithJSON(builderResource), + 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 BuildServiceBuilderClient) CreateOrUpdateSender(req *http.Request) (future BuildServiceBuilderCreateOrUpdateFuture, 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 BuildServiceBuilderClient) CreateOrUpdateResponder(resp *http.Response) (result BuilderResource, 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 KPack builder. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +func (client BuildServiceBuilderClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result BuildServiceBuilderDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceBuilderClient.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, serviceName, buildServiceName, builderName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BuildServiceBuilderClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", 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 BuildServiceBuilderClient) DeleteSender(req *http.Request) (future BuildServiceBuilderDeleteFuture, 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 BuildServiceBuilderClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a KPack builder. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +func (client BuildServiceBuilderClient) Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result BuilderResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceBuilderClient.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, serviceName, buildServiceName, builderName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BuildServiceBuilderClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", 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 BuildServiceBuilderClient) 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 BuildServiceBuilderClient) GetResponder(resp *http.Response) (result BuilderResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list KPack builders result. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceBuilderClient) List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuilderResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceBuilderClient.List") + defer func() { + sc := -1 + if result.brc.Response.Response != nil { + sc = result.brc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.brc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "List", resp, "Failure sending request") + return + } + + result.brc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "List", resp, "Failure responding to request") + return + } + if result.brc.hasNextLink() && result.brc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BuildServiceBuilderClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", 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 BuildServiceBuilderClient) 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 BuildServiceBuilderClient) ListResponder(resp *http.Response) (result BuilderResourceCollection, 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 BuildServiceBuilderClient) listNextResults(ctx context.Context, lastResults BuilderResourceCollection) (result BuilderResourceCollection, err error) { + req, err := lastResults.builderResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "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, "appplatform.BuildServiceBuilderClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BuildServiceBuilderClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuilderResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceBuilderClient.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, serviceName, buildServiceName) + return +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/certificates.go b/services/appplatform/mgmt/2022-04-01/appplatform/certificates.go new file mode 100644 index 000000000000..956d9b585615 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/certificates.go @@ -0,0 +1,395 @@ +package appplatform + +// 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" +) + +// CertificatesClient is the REST API for Azure Spring Apps +type CertificatesClient struct { + BaseClient +} + +// NewCertificatesClient creates an instance of the CertificatesClient client. +func NewCertificatesClient(subscriptionID string) CertificatesClient { + return NewCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificatesClientWithBaseURI creates an instance of the CertificatesClient 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 NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) CertificatesClient { + return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update certificate resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// certificateName - the name of the certificate resource. +// certificateResource - parameters for the create or update operation +func (client CertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, certificateName string, certificateResource CertificateResource) (result CertificatesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, certificateName, certificateResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CertificatesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateName string, certificateResource CertificateResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", pathParameters), + autorest.WithJSON(certificateResource), + 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 CertificatesClient) CreateOrUpdateSender(req *http.Request) (future CertificatesCreateOrUpdateFuture, 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 CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result CertificateResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the certificate resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// certificateName - the name of the certificate resource. +func (client CertificatesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (result CertificatesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.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, serviceName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificatesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", 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 CertificatesClient) DeleteSender(req *http.Request) (future CertificatesDeleteFuture, 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 CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the certificate resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// certificateName - the name of the certificate resource. +func (client CertificatesClient) Get(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (result CertificateResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.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, serviceName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificatesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", 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 CertificatesClient) 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 CertificatesClient) GetResponder(resp *http.Response) (result CertificateResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all the certificates of one user. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client CertificatesClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result CertificateResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.List") + defer func() { + sc := -1 + if result.crc.Response.Response != nil { + sc = result.crc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.crc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "List", resp, "Failure sending request") + return + } + + result.crc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "List", resp, "Failure responding to request") + return + } + if result.crc.hasNextLink() && result.crc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client CertificatesClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", 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 CertificatesClient) 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 CertificatesClient) ListResponder(resp *http.Response) (result CertificateResourceCollection, 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 CertificatesClient) listNextResults(ctx context.Context, lastResults CertificateResourceCollection) (result CertificateResourceCollection, err error) { + req, err := lastResults.certificateResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "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, "appplatform.CertificatesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CertificatesClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result CertificateResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.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, serviceName) + return +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/client.go b/services/appplatform/mgmt/2022-04-01/appplatform/client.go new file mode 100644 index 000000000000..60db5283debd --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/client.go @@ -0,0 +1,41 @@ +// Package appplatform implements the Azure ARM Appplatform service API version 2022-04-01. +// +// REST API for Azure Spring Apps +package appplatform + +// 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 Appplatform + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Appplatform. +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/appplatform/mgmt/2022-04-01/appplatform/configservers.go b/services/appplatform/mgmt/2022-04-01/appplatform/configservers.go new file mode 100644 index 000000000000..9ffe815db817 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/configservers.go @@ -0,0 +1,376 @@ +package appplatform + +// 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" +) + +// ConfigServersClient is the REST API for Azure Spring Apps +type ConfigServersClient struct { + BaseClient +} + +// NewConfigServersClient creates an instance of the ConfigServersClient client. +func NewConfigServersClient(subscriptionID string) ConfigServersClient { + return NewConfigServersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConfigServersClientWithBaseURI creates an instance of the ConfigServersClient 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 NewConfigServersClientWithBaseURI(baseURI string, subscriptionID string) ConfigServersClient { + return ConfigServersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the config server and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ConfigServersClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result ConfigServerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigServersClient.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, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConfigServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigServersClient) 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 ConfigServersClient) GetResponder(resp *http.Response) (result ConfigServerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePatch update the config server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configServerResource - parameters for the update operation +func (client ConfigServersClient) UpdatePatch(ctx context.Context, resourceGroupName string, serviceName string, configServerResource ConfigServerResource) (result ConfigServersUpdatePatchFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigServersClient.UpdatePatch") + 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.UpdatePatchPreparer(ctx, resourceGroupName, serviceName, configServerResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "UpdatePatch", nil, "Failure preparing request") + return + } + + result, err = client.UpdatePatchSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "UpdatePatch", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePatchPreparer prepares the UpdatePatch request. +func (client ConfigServersClient) UpdatePatchPreparer(ctx context.Context, resourceGroupName string, serviceName string, configServerResource ConfigServerResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", pathParameters), + autorest.WithJSON(configServerResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePatchSender sends the UpdatePatch request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigServersClient) UpdatePatchSender(req *http.Request) (future ConfigServersUpdatePatchFuture, 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 +} + +// UpdatePatchResponder handles the response to the UpdatePatch request. The method always +// closes the http.Response Body. +func (client ConfigServersClient) UpdatePatchResponder(resp *http.Response) (result ConfigServerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePut update the config server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configServerResource - parameters for the update operation +func (client ConfigServersClient) UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, configServerResource ConfigServerResource) (result ConfigServersUpdatePutFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigServersClient.UpdatePut") + 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: configServerResource, + Constraints: []validation.Constraint{{Target: "configServerResource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "configServerResource.Properties.ConfigServer", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "configServerResource.Properties.ConfigServer.GitProperty", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "configServerResource.Properties.ConfigServer.GitProperty.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.ConfigServersClient", "UpdatePut", err.Error()) + } + + req, err := client.UpdatePutPreparer(ctx, resourceGroupName, serviceName, configServerResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "UpdatePut", nil, "Failure preparing request") + return + } + + result, err = client.UpdatePutSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "UpdatePut", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePutPreparer prepares the UpdatePut request. +func (client ConfigServersClient) UpdatePutPreparer(ctx context.Context, resourceGroupName string, serviceName string, configServerResource ConfigServerResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", pathParameters), + autorest.WithJSON(configServerResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePutSender sends the UpdatePut request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigServersClient) UpdatePutSender(req *http.Request) (future ConfigServersUpdatePutFuture, 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 +} + +// UpdatePutResponder handles the response to the UpdatePut request. The method always +// closes the http.Response Body. +func (client ConfigServersClient) UpdatePutResponder(resp *http.Response) (result ConfigServerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Validate check if the config server settings are valid. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configServerSettings - config server settings to be validated +func (client ConfigServersClient) Validate(ctx context.Context, resourceGroupName string, serviceName string, configServerSettings ConfigServerSettings) (result ConfigServersValidateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigServersClient.Validate") + 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: configServerSettings, + Constraints: []validation.Constraint{{Target: "configServerSettings.GitProperty", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "configServerSettings.GitProperty.URI", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("appplatform.ConfigServersClient", "Validate", err.Error()) + } + + req, err := client.ValidatePreparer(ctx, resourceGroupName, serviceName, configServerSettings) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "Validate", nil, "Failure preparing request") + return + } + + result, err = client.ValidateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "Validate", result.Response(), "Failure sending request") + return + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client ConfigServersClient) ValidatePreparer(ctx context.Context, resourceGroupName string, serviceName string, configServerSettings ConfigServerSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/configServers/validate", pathParameters), + autorest.WithJSON(configServerSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigServersClient) ValidateSender(req *http.Request) (future ConfigServersValidateFuture, 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 +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client ConfigServersClient) ValidateResponder(resp *http.Response) (result ConfigServerSettingsValidateResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/configurationservices.go b/services/appplatform/mgmt/2022-04-01/appplatform/configurationservices.go new file mode 100644 index 000000000000..f786fd4b4605 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/configurationservices.go @@ -0,0 +1,482 @@ +package appplatform + +// 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" +) + +// ConfigurationServicesClient is the REST API for Azure Spring Apps +type ConfigurationServicesClient struct { + BaseClient +} + +// NewConfigurationServicesClient creates an instance of the ConfigurationServicesClient client. +func NewConfigurationServicesClient(subscriptionID string) ConfigurationServicesClient { + return NewConfigurationServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConfigurationServicesClientWithBaseURI creates an instance of the ConfigurationServicesClient 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 NewConfigurationServicesClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationServicesClient { + return ConfigurationServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the default Application Configuration Service or update the existing Application Configuration +// Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configurationServiceName - the name of Application Configuration Service. +// configurationServiceResource - parameters for the update operation +func (client ConfigurationServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string, configurationServiceResource ConfigurationServiceResource) (result ConfigurationServicesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServicesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, configurationServiceName, configurationServiceResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConfigurationServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string, configurationServiceResource ConfigurationServiceResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationServiceName": autorest.Encode("path", configurationServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", pathParameters), + autorest.WithJSON(configurationServiceResource), + 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 ConfigurationServicesClient) CreateOrUpdateSender(req *http.Request) (future ConfigurationServicesCreateOrUpdateFuture, 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 ConfigurationServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ConfigurationServiceResource, 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 disable the default Application Configuration Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configurationServiceName - the name of Application Configuration Service. +func (client ConfigurationServicesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string) (result ConfigurationServicesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServicesClient.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, serviceName, configurationServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConfigurationServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationServiceName": autorest.Encode("path", configurationServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", 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 ConfigurationServicesClient) DeleteSender(req *http.Request) (future ConfigurationServicesDeleteFuture, 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 ConfigurationServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the Application Configuration Service and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configurationServiceName - the name of Application Configuration Service. +func (client ConfigurationServicesClient) Get(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string) (result ConfigurationServiceResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServicesClient.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, serviceName, configurationServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConfigurationServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationServiceName": autorest.Encode("path", configurationServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", 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 ConfigurationServicesClient) 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 ConfigurationServicesClient) GetResponder(resp *http.Response) (result ConfigurationServiceResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ConfigurationServicesClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result ConfigurationServiceResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServicesClient.List") + defer func() { + sc := -1 + if result.csrc.Response.Response != nil { + sc = result.csrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.csrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "List", resp, "Failure sending request") + return + } + + result.csrc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "List", resp, "Failure responding to request") + return + } + if result.csrc.hasNextLink() && result.csrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ConfigurationServicesClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", 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 ConfigurationServicesClient) 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 ConfigurationServicesClient) ListResponder(resp *http.Response) (result ConfigurationServiceResourceCollection, 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 ConfigurationServicesClient) listNextResults(ctx context.Context, lastResults ConfigurationServiceResourceCollection) (result ConfigurationServiceResourceCollection, err error) { + req, err := lastResults.configurationServiceResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "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, "appplatform.ConfigurationServicesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ConfigurationServicesClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result ConfigurationServiceResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServicesClient.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, serviceName) + return +} + +// Validate check if the Application Configuration Service settings are valid. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configurationServiceName - the name of Application Configuration Service. +// settings - application Configuration Service settings to be validated +func (client ConfigurationServicesClient) Validate(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string, settings ConfigurationServiceSettings) (result ConfigurationServicesValidateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServicesClient.Validate") + 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.ValidatePreparer(ctx, resourceGroupName, serviceName, configurationServiceName, settings) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Validate", nil, "Failure preparing request") + return + } + + result, err = client.ValidateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Validate", result.Response(), "Failure sending request") + return + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client ConfigurationServicesClient) ValidatePreparer(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string, settings ConfigurationServiceSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationServiceName": autorest.Encode("path", configurationServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", pathParameters), + autorest.WithJSON(settings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationServicesClient) ValidateSender(req *http.Request) (future ConfigurationServicesValidateFuture, 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 +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client ConfigurationServicesClient) ValidateResponder(resp *http.Response) (result ConfigurationServiceSettingsValidateResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/customdomains.go b/services/appplatform/mgmt/2022-04-01/appplatform/customdomains.go new file mode 100644 index 000000000000..8403ca37aaf0 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/customdomains.go @@ -0,0 +1,490 @@ +package appplatform + +// 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" +) + +// CustomDomainsClient is the REST API for Azure Spring Apps +type CustomDomainsClient struct { + BaseClient +} + +// NewCustomDomainsClient creates an instance of the CustomDomainsClient client. +func NewCustomDomainsClient(subscriptionID string) CustomDomainsClient { + return NewCustomDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCustomDomainsClientWithBaseURI creates an instance of the CustomDomainsClient 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 NewCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) CustomDomainsClient { + return CustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update custom domain of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// domainName - the name of the custom domain resource. +// domainResource - parameters for the create or update operation +func (client CustomDomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource) (result CustomDomainsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, domainName, domainResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CustomDomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", pathParameters), + autorest.WithJSON(domainResource), + 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 CustomDomainsClient) CreateOrUpdateSender(req *http.Request) (future CustomDomainsCreateOrUpdateFuture, 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 CustomDomainsClient) CreateOrUpdateResponder(resp *http.Response) (result CustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the custom domain of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// domainName - the name of the custom domain resource. +func (client CustomDomainsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (result CustomDomainsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.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, serviceName, appName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CustomDomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) DeleteSender(req *http.Request) (future CustomDomainsDeleteFuture, 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 CustomDomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the custom domain of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// domainName - the name of the custom domain resource. +func (client CustomDomainsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (result CustomDomainResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.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, serviceName, appName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CustomDomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) 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 CustomDomainsClient) GetResponder(resp *http.Response) (result CustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list the custom domains of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client CustomDomainsClient) List(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result CustomDomainResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.List") + defer func() { + sc := -1 + if result.cdrc.Response.Response != nil { + sc = result.cdrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cdrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "List", resp, "Failure sending request") + return + } + + result.cdrc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "List", resp, "Failure responding to request") + return + } + if result.cdrc.hasNextLink() && result.cdrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client CustomDomainsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", 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 CustomDomainsClient) 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 CustomDomainsClient) ListResponder(resp *http.Response) (result CustomDomainResourceCollection, 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 CustomDomainsClient) listNextResults(ctx context.Context, lastResults CustomDomainResourceCollection) (result CustomDomainResourceCollection, err error) { + req, err := lastResults.customDomainResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "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, "appplatform.CustomDomainsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CustomDomainsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result CustomDomainResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.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, serviceName, appName) + return +} + +// Update update custom domain of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// domainName - the name of the custom domain resource. +// domainResource - parameters for the create or update operation +func (client CustomDomainsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource) (result CustomDomainsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, domainName, domainResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client CustomDomainsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", pathParameters), + autorest.WithJSON(domainResource), + 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 CustomDomainsClient) UpdateSender(req *http.Request) (future CustomDomainsUpdateFuture, 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 CustomDomainsClient) UpdateResponder(resp *http.Response) (result CustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/deployments.go b/services/appplatform/mgmt/2022-04-01/appplatform/deployments.go new file mode 100644 index 000000000000..bc2cf6285831 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/deployments.go @@ -0,0 +1,1205 @@ +package appplatform + +// 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" +) + +// DeploymentsClient is the REST API for Azure Spring Apps +type DeploymentsClient struct { + BaseClient +} + +// NewDeploymentsClient creates an instance of the DeploymentsClient client. +func NewDeploymentsClient(subscriptionID string) DeploymentsClient { + return NewDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeploymentsClientWithBaseURI creates an instance of the DeploymentsClient 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 NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient { + return DeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Deployment or update an exiting Deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +// deploymentResource - parameters for the create or update operation +func (client DeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (result DeploymentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, deploymentResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(deploymentResource), + 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 DeploymentsClient) CreateOrUpdateSender(req *http.Request) (future DeploymentsCreateOrUpdateFuture, 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 DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result DeploymentResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete a Deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.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, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DeploymentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", 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 DeploymentsClient) DeleteSender(req *http.Request) (future DeploymentsDeleteFuture, 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 DeploymentsClient) 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 +} + +// GenerateHeapDump generate Heap Dump +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +// diagnosticParameters - parameters for the diagnostic operation +func (client DeploymentsClient) GenerateHeapDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (result DeploymentsGenerateHeapDumpFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GenerateHeapDump") + 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.GenerateHeapDumpPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GenerateHeapDump", nil, "Failure preparing request") + return + } + + result, err = client.GenerateHeapDumpSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GenerateHeapDump", result.Response(), "Failure sending request") + return + } + + return +} + +// GenerateHeapDumpPreparer prepares the GenerateHeapDump request. +func (client DeploymentsClient) GenerateHeapDumpPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", pathParameters), + autorest.WithJSON(diagnosticParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateHeapDumpSender sends the GenerateHeapDump request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GenerateHeapDumpSender(req *http.Request) (future DeploymentsGenerateHeapDumpFuture, 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 +} + +// GenerateHeapDumpResponder handles the response to the GenerateHeapDump request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GenerateHeapDumpResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateThreadDump generate Thread Dump +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +// diagnosticParameters - parameters for the diagnostic operation +func (client DeploymentsClient) GenerateThreadDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (result DeploymentsGenerateThreadDumpFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GenerateThreadDump") + 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.GenerateThreadDumpPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GenerateThreadDump", nil, "Failure preparing request") + return + } + + result, err = client.GenerateThreadDumpSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GenerateThreadDump", result.Response(), "Failure sending request") + return + } + + return +} + +// GenerateThreadDumpPreparer prepares the GenerateThreadDump request. +func (client DeploymentsClient) GenerateThreadDumpPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", pathParameters), + autorest.WithJSON(diagnosticParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateThreadDumpSender sends the GenerateThreadDump request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GenerateThreadDumpSender(req *http.Request) (future DeploymentsGenerateThreadDumpFuture, 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 +} + +// GenerateThreadDumpResponder handles the response to the GenerateThreadDump request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GenerateThreadDumpResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a Deployment and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.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, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DeploymentsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", 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 DeploymentsClient) 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 DeploymentsClient) GetResponder(resp *http.Response) (result DeploymentResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLogFileURL get deployment log file URL +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) GetLogFileURL(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result LogFileURLResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetLogFileURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetLogFileURLPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GetLogFileURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogFileURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GetLogFileURL", resp, "Failure sending request") + return + } + + result, err = client.GetLogFileURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GetLogFileURL", resp, "Failure responding to request") + return + } + + return +} + +// GetLogFileURLPreparer prepares the GetLogFileURL request. +func (client DeploymentsClient) GetLogFileURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogFileURLSender sends the GetLogFileURL request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GetLogFileURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogFileURLResponder handles the response to the GetLogFileURL request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GetLogFileURLResponder(resp *http.Response) (result LogFileURLResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in an App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// version - version of the deployments to be listed +func (client DeploymentsClient) List(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result DeploymentResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.List") + defer func() { + sc := -1 + if result.drc.Response.Response != nil { + sc = result.drc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, appName, version) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.drc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", resp, "Failure sending request") + return + } + + result.drc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", resp, "Failure responding to request") + return + } + if result.drc.hasNextLink() && result.drc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DeploymentsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if version != nil && len(version) > 0 { + queryParameters["version"] = version + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", 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 DeploymentsClient) 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 DeploymentsClient) ListResponder(resp *http.Response) (result DeploymentResourceCollection, 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 DeploymentsClient) listNextResults(ctx context.Context, lastResults DeploymentResourceCollection) (result DeploymentResourceCollection, err error) { + req, err := lastResults.deploymentResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "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, "appplatform.DeploymentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result DeploymentResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.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, serviceName, appName, version) + return +} + +// ListForCluster list deployments for a certain service +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// version - version of the deployments to be listed +func (client DeploymentsClient) ListForCluster(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result DeploymentResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListForCluster") + defer func() { + sc := -1 + if result.drc.Response.Response != nil { + sc = result.drc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listForClusterNextResults + req, err := client.ListForClusterPreparer(ctx, resourceGroupName, serviceName, version) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListForCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListForClusterSender(req) + if err != nil { + result.drc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListForCluster", resp, "Failure sending request") + return + } + + result.drc, err = client.ListForClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListForCluster", resp, "Failure responding to request") + return + } + if result.drc.hasNextLink() && result.drc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForClusterPreparer prepares the ListForCluster request. +func (client DeploymentsClient) ListForClusterPreparer(ctx context.Context, resourceGroupName string, serviceName string, version []string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if version != nil && len(version) > 0 { + queryParameters["version"] = version + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForClusterSender sends the ListForCluster request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ListForClusterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListForClusterResponder handles the response to the ListForCluster request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ListForClusterResponder(resp *http.Response) (result DeploymentResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForClusterNextResults retrieves the next set of results, if any. +func (client DeploymentsClient) listForClusterNextResults(ctx context.Context, lastResults DeploymentResourceCollection) (result DeploymentResourceCollection, err error) { + req, err := lastResults.deploymentResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listForClusterNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listForClusterNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listForClusterNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForClusterComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentsClient) ListForClusterComplete(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result DeploymentResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListForCluster") + 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.ListForCluster(ctx, resourceGroupName, serviceName, version) + return +} + +// Restart restart the deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Restart(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Restart") + 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.RestartPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Restart", nil, "Failure preparing request") + return + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Restart", result.Response(), "Failure sending request") + return + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client DeploymentsClient) RestartPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) RestartSender(req *http.Request) (future DeploymentsRestartFuture, 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 +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start start the deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Start(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Start") + 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.StartPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client DeploymentsClient) StartPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) StartSender(req *http.Request) (future DeploymentsStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartJFR start JFR +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +// diagnosticParameters - parameters for the diagnostic operation +func (client DeploymentsClient) StartJFR(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (result DeploymentsStartJFRFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.StartJFR") + 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.StartJFRPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "StartJFR", nil, "Failure preparing request") + return + } + + result, err = client.StartJFRSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "StartJFR", result.Response(), "Failure sending request") + return + } + + return +} + +// StartJFRPreparer prepares the StartJFR request. +func (client DeploymentsClient) StartJFRPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", pathParameters), + autorest.WithJSON(diagnosticParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartJFRSender sends the StartJFR request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) StartJFRSender(req *http.Request) (future DeploymentsStartJFRFuture, 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 +} + +// StartJFRResponder handles the response to the StartJFR request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) StartJFRResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stop the deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Stop(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Stop") + 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.StopPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client DeploymentsClient) StopPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) StopSender(req *http.Request) (future DeploymentsStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update operation to update an exiting Deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +// deploymentResource - parameters for the update operation +func (client DeploymentsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (result DeploymentsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, deploymentResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DeploymentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(deploymentResource), + 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 DeploymentsClient) UpdateSender(req *http.Request) (future DeploymentsUpdateFuture, 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 DeploymentsClient) UpdateResponder(resp *http.Response) (result DeploymentResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/enums.go b/services/appplatform/mgmt/2022-04-01/appplatform/enums.go new file mode 100644 index 000000000000..b0f7c04d79b6 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/enums.go @@ -0,0 +1,545 @@ +package appplatform + +// 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. + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // Internal ... + Internal ActionType = "Internal" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{Internal} +} + +// AppResourceProvisioningState enumerates the values for app resource provisioning state. +type AppResourceProvisioningState string + +const ( + // Creating ... + Creating AppResourceProvisioningState = "Creating" + // Deleting ... + Deleting AppResourceProvisioningState = "Deleting" + // Failed ... + Failed AppResourceProvisioningState = "Failed" + // Succeeded ... + Succeeded AppResourceProvisioningState = "Succeeded" + // Updating ... + Updating AppResourceProvisioningState = "Updating" +) + +// PossibleAppResourceProvisioningStateValues returns an array of possible values for the AppResourceProvisioningState const type. +func PossibleAppResourceProvisioningStateValues() []AppResourceProvisioningState { + return []AppResourceProvisioningState{Creating, Deleting, Failed, Succeeded, Updating} +} + +// BindingType enumerates the values for binding type. +type BindingType string + +const ( + // ApacheSkyWalking ... + ApacheSkyWalking BindingType = "ApacheSkyWalking" + // AppDynamics ... + AppDynamics BindingType = "AppDynamics" + // ApplicationInsights ... + ApplicationInsights BindingType = "ApplicationInsights" + // Dynatrace ... + Dynatrace BindingType = "Dynatrace" + // ElasticAPM ... + ElasticAPM BindingType = "ElasticAPM" + // NewRelic ... + NewRelic BindingType = "NewRelic" +) + +// PossibleBindingTypeValues returns an array of possible values for the BindingType const type. +func PossibleBindingTypeValues() []BindingType { + return []BindingType{ApacheSkyWalking, AppDynamics, ApplicationInsights, Dynatrace, ElasticAPM, NewRelic} +} + +// BuilderProvisioningState enumerates the values for builder provisioning state. +type BuilderProvisioningState string + +const ( + // BuilderProvisioningStateCreating ... + BuilderProvisioningStateCreating BuilderProvisioningState = "Creating" + // BuilderProvisioningStateDeleting ... + BuilderProvisioningStateDeleting BuilderProvisioningState = "Deleting" + // BuilderProvisioningStateFailed ... + BuilderProvisioningStateFailed BuilderProvisioningState = "Failed" + // BuilderProvisioningStateSucceeded ... + BuilderProvisioningStateSucceeded BuilderProvisioningState = "Succeeded" + // BuilderProvisioningStateUpdating ... + BuilderProvisioningStateUpdating BuilderProvisioningState = "Updating" +) + +// PossibleBuilderProvisioningStateValues returns an array of possible values for the BuilderProvisioningState const type. +func PossibleBuilderProvisioningStateValues() []BuilderProvisioningState { + return []BuilderProvisioningState{BuilderProvisioningStateCreating, BuilderProvisioningStateDeleting, BuilderProvisioningStateFailed, BuilderProvisioningStateSucceeded, BuilderProvisioningStateUpdating} +} + +// BuildpackBindingProvisioningState enumerates the values for buildpack binding provisioning state. +type BuildpackBindingProvisioningState string + +const ( + // BuildpackBindingProvisioningStateCreating ... + BuildpackBindingProvisioningStateCreating BuildpackBindingProvisioningState = "Creating" + // BuildpackBindingProvisioningStateDeleting ... + BuildpackBindingProvisioningStateDeleting BuildpackBindingProvisioningState = "Deleting" + // BuildpackBindingProvisioningStateFailed ... + BuildpackBindingProvisioningStateFailed BuildpackBindingProvisioningState = "Failed" + // BuildpackBindingProvisioningStateSucceeded ... + BuildpackBindingProvisioningStateSucceeded BuildpackBindingProvisioningState = "Succeeded" + // BuildpackBindingProvisioningStateUpdating ... + BuildpackBindingProvisioningStateUpdating BuildpackBindingProvisioningState = "Updating" +) + +// PossibleBuildpackBindingProvisioningStateValues returns an array of possible values for the BuildpackBindingProvisioningState const type. +func PossibleBuildpackBindingProvisioningStateValues() []BuildpackBindingProvisioningState { + return []BuildpackBindingProvisioningState{BuildpackBindingProvisioningStateCreating, BuildpackBindingProvisioningStateDeleting, BuildpackBindingProvisioningStateFailed, BuildpackBindingProvisioningStateSucceeded, BuildpackBindingProvisioningStateUpdating} +} + +// BuildProvisioningState enumerates the values for build provisioning state. +type BuildProvisioningState string + +const ( + // BuildProvisioningStateCreating ... + BuildProvisioningStateCreating BuildProvisioningState = "Creating" + // BuildProvisioningStateDeleting ... + BuildProvisioningStateDeleting BuildProvisioningState = "Deleting" + // BuildProvisioningStateFailed ... + BuildProvisioningStateFailed BuildProvisioningState = "Failed" + // BuildProvisioningStateSucceeded ... + BuildProvisioningStateSucceeded BuildProvisioningState = "Succeeded" + // BuildProvisioningStateUpdating ... + BuildProvisioningStateUpdating BuildProvisioningState = "Updating" +) + +// PossibleBuildProvisioningStateValues returns an array of possible values for the BuildProvisioningState const type. +func PossibleBuildProvisioningStateValues() []BuildProvisioningState { + return []BuildProvisioningState{BuildProvisioningStateCreating, BuildProvisioningStateDeleting, BuildProvisioningStateFailed, BuildProvisioningStateSucceeded, BuildProvisioningStateUpdating} +} + +// BuildResultProvisioningState enumerates the values for build result provisioning state. +type BuildResultProvisioningState string + +const ( + // BuildResultProvisioningStateBuilding ... + BuildResultProvisioningStateBuilding BuildResultProvisioningState = "Building" + // BuildResultProvisioningStateDeleting ... + BuildResultProvisioningStateDeleting BuildResultProvisioningState = "Deleting" + // BuildResultProvisioningStateFailed ... + BuildResultProvisioningStateFailed BuildResultProvisioningState = "Failed" + // BuildResultProvisioningStateQueuing ... + BuildResultProvisioningStateQueuing BuildResultProvisioningState = "Queuing" + // BuildResultProvisioningStateSucceeded ... + BuildResultProvisioningStateSucceeded BuildResultProvisioningState = "Succeeded" +) + +// PossibleBuildResultProvisioningStateValues returns an array of possible values for the BuildResultProvisioningState const type. +func PossibleBuildResultProvisioningStateValues() []BuildResultProvisioningState { + return []BuildResultProvisioningState{BuildResultProvisioningStateBuilding, BuildResultProvisioningStateDeleting, BuildResultProvisioningStateFailed, BuildResultProvisioningStateQueuing, BuildResultProvisioningStateSucceeded} +} + +// BuildServiceProvisioningState enumerates the values for build service provisioning state. +type BuildServiceProvisioningState string + +const ( + // BuildServiceProvisioningStateCreating ... + BuildServiceProvisioningStateCreating BuildServiceProvisioningState = "Creating" + // BuildServiceProvisioningStateDeleting ... + BuildServiceProvisioningStateDeleting BuildServiceProvisioningState = "Deleting" + // BuildServiceProvisioningStateFailed ... + BuildServiceProvisioningStateFailed BuildServiceProvisioningState = "Failed" + // BuildServiceProvisioningStateSucceeded ... + BuildServiceProvisioningStateSucceeded BuildServiceProvisioningState = "Succeeded" + // BuildServiceProvisioningStateUpdating ... + BuildServiceProvisioningStateUpdating BuildServiceProvisioningState = "Updating" +) + +// PossibleBuildServiceProvisioningStateValues returns an array of possible values for the BuildServiceProvisioningState const type. +func PossibleBuildServiceProvisioningStateValues() []BuildServiceProvisioningState { + return []BuildServiceProvisioningState{BuildServiceProvisioningStateCreating, BuildServiceProvisioningStateDeleting, BuildServiceProvisioningStateFailed, BuildServiceProvisioningStateSucceeded, BuildServiceProvisioningStateUpdating} +} + +// ConfigServerState enumerates the values for config server state. +type ConfigServerState string + +const ( + // ConfigServerStateDeleted ... + ConfigServerStateDeleted ConfigServerState = "Deleted" + // ConfigServerStateFailed ... + ConfigServerStateFailed ConfigServerState = "Failed" + // ConfigServerStateNotAvailable ... + ConfigServerStateNotAvailable ConfigServerState = "NotAvailable" + // ConfigServerStateSucceeded ... + ConfigServerStateSucceeded ConfigServerState = "Succeeded" + // ConfigServerStateUpdating ... + ConfigServerStateUpdating ConfigServerState = "Updating" +) + +// PossibleConfigServerStateValues returns an array of possible values for the ConfigServerState const type. +func PossibleConfigServerStateValues() []ConfigServerState { + return []ConfigServerState{ConfigServerStateDeleted, ConfigServerStateFailed, ConfigServerStateNotAvailable, ConfigServerStateSucceeded, ConfigServerStateUpdating} +} + +// ConfigurationServiceProvisioningState enumerates the values for configuration service provisioning state. +type ConfigurationServiceProvisioningState string + +const ( + // ConfigurationServiceProvisioningStateCreating ... + ConfigurationServiceProvisioningStateCreating ConfigurationServiceProvisioningState = "Creating" + // ConfigurationServiceProvisioningStateDeleting ... + ConfigurationServiceProvisioningStateDeleting ConfigurationServiceProvisioningState = "Deleting" + // ConfigurationServiceProvisioningStateFailed ... + ConfigurationServiceProvisioningStateFailed ConfigurationServiceProvisioningState = "Failed" + // ConfigurationServiceProvisioningStateSucceeded ... + ConfigurationServiceProvisioningStateSucceeded ConfigurationServiceProvisioningState = "Succeeded" + // ConfigurationServiceProvisioningStateUpdating ... + ConfigurationServiceProvisioningStateUpdating ConfigurationServiceProvisioningState = "Updating" +) + +// PossibleConfigurationServiceProvisioningStateValues returns an array of possible values for the ConfigurationServiceProvisioningState const type. +func PossibleConfigurationServiceProvisioningStateValues() []ConfigurationServiceProvisioningState { + return []ConfigurationServiceProvisioningState{ConfigurationServiceProvisioningStateCreating, ConfigurationServiceProvisioningStateDeleting, ConfigurationServiceProvisioningStateFailed, ConfigurationServiceProvisioningStateSucceeded, ConfigurationServiceProvisioningStateUpdating} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// DeploymentResourceProvisioningState enumerates the values for deployment resource provisioning state. +type DeploymentResourceProvisioningState string + +const ( + // DeploymentResourceProvisioningStateCreating ... + DeploymentResourceProvisioningStateCreating DeploymentResourceProvisioningState = "Creating" + // DeploymentResourceProvisioningStateFailed ... + DeploymentResourceProvisioningStateFailed DeploymentResourceProvisioningState = "Failed" + // DeploymentResourceProvisioningStateSucceeded ... + DeploymentResourceProvisioningStateSucceeded DeploymentResourceProvisioningState = "Succeeded" + // DeploymentResourceProvisioningStateUpdating ... + DeploymentResourceProvisioningStateUpdating DeploymentResourceProvisioningState = "Updating" +) + +// PossibleDeploymentResourceProvisioningStateValues returns an array of possible values for the DeploymentResourceProvisioningState const type. +func PossibleDeploymentResourceProvisioningStateValues() []DeploymentResourceProvisioningState { + return []DeploymentResourceProvisioningState{DeploymentResourceProvisioningStateCreating, DeploymentResourceProvisioningStateFailed, DeploymentResourceProvisioningStateSucceeded, DeploymentResourceProvisioningStateUpdating} +} + +// DeploymentResourceStatus enumerates the values for deployment resource status. +type DeploymentResourceStatus string + +const ( + // Running ... + Running DeploymentResourceStatus = "Running" + // Stopped ... + Stopped DeploymentResourceStatus = "Stopped" +) + +// PossibleDeploymentResourceStatusValues returns an array of possible values for the DeploymentResourceStatus const type. +func PossibleDeploymentResourceStatusValues() []DeploymentResourceStatus { + return []DeploymentResourceStatus{Running, Stopped} +} + +// KPackBuildStageProvisioningState enumerates the values for k pack build stage provisioning state. +type KPackBuildStageProvisioningState string + +const ( + // KPackBuildStageProvisioningStateFailed ... + KPackBuildStageProvisioningStateFailed KPackBuildStageProvisioningState = "Failed" + // KPackBuildStageProvisioningStateNotStarted ... + KPackBuildStageProvisioningStateNotStarted KPackBuildStageProvisioningState = "NotStarted" + // KPackBuildStageProvisioningStateRunning ... + KPackBuildStageProvisioningStateRunning KPackBuildStageProvisioningState = "Running" + // KPackBuildStageProvisioningStateSucceeded ... + KPackBuildStageProvisioningStateSucceeded KPackBuildStageProvisioningState = "Succeeded" +) + +// PossibleKPackBuildStageProvisioningStateValues returns an array of possible values for the KPackBuildStageProvisioningState const type. +func PossibleKPackBuildStageProvisioningStateValues() []KPackBuildStageProvisioningState { + return []KPackBuildStageProvisioningState{KPackBuildStageProvisioningStateFailed, KPackBuildStageProvisioningStateNotStarted, KPackBuildStageProvisioningStateRunning, KPackBuildStageProvisioningStateSucceeded} +} + +// LastModifiedByType enumerates the values for last modified by type. +type LastModifiedByType string + +const ( + // LastModifiedByTypeApplication ... + LastModifiedByTypeApplication LastModifiedByType = "Application" + // LastModifiedByTypeKey ... + LastModifiedByTypeKey LastModifiedByType = "Key" + // LastModifiedByTypeManagedIdentity ... + LastModifiedByTypeManagedIdentity LastModifiedByType = "ManagedIdentity" + // LastModifiedByTypeUser ... + LastModifiedByTypeUser LastModifiedByType = "User" +) + +// PossibleLastModifiedByTypeValues returns an array of possible values for the LastModifiedByType const type. +func PossibleLastModifiedByTypeValues() []LastModifiedByType { + return []LastModifiedByType{LastModifiedByTypeApplication, LastModifiedByTypeKey, LastModifiedByTypeManagedIdentity, LastModifiedByTypeUser} +} + +// ManagedIdentityType enumerates the values for managed identity type. +type ManagedIdentityType string + +const ( + // None ... + None ManagedIdentityType = "None" + // SystemAssigned ... + SystemAssigned ManagedIdentityType = "SystemAssigned" + // SystemAssignedUserAssigned ... + SystemAssignedUserAssigned ManagedIdentityType = "SystemAssigned,UserAssigned" + // UserAssigned ... + UserAssigned ManagedIdentityType = "UserAssigned" +) + +// PossibleManagedIdentityTypeValues returns an array of possible values for the ManagedIdentityType const type. +func PossibleManagedIdentityTypeValues() []ManagedIdentityType { + return []ManagedIdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} +} + +// MonitoringSettingState enumerates the values for monitoring setting state. +type MonitoringSettingState string + +const ( + // MonitoringSettingStateFailed ... + MonitoringSettingStateFailed MonitoringSettingState = "Failed" + // MonitoringSettingStateNotAvailable ... + MonitoringSettingStateNotAvailable MonitoringSettingState = "NotAvailable" + // MonitoringSettingStateSucceeded ... + MonitoringSettingStateSucceeded MonitoringSettingState = "Succeeded" + // MonitoringSettingStateUpdating ... + MonitoringSettingStateUpdating MonitoringSettingState = "Updating" +) + +// PossibleMonitoringSettingStateValues returns an array of possible values for the MonitoringSettingState const type. +func PossibleMonitoringSettingStateValues() []MonitoringSettingState { + return []MonitoringSettingState{MonitoringSettingStateFailed, MonitoringSettingStateNotAvailable, MonitoringSettingStateSucceeded, MonitoringSettingStateUpdating} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted ... + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateMoved ... + ProvisioningStateMoved ProvisioningState = "Moved" + // ProvisioningStateMoveFailed ... + ProvisioningStateMoveFailed ProvisioningState = "MoveFailed" + // ProvisioningStateMoving ... + ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateStarting ... + ProvisioningStateStarting ProvisioningState = "Starting" + // ProvisioningStateStopping ... + ProvisioningStateStopping ProvisioningState = "Stopping" + // 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, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoved, ProvisioningStateMoveFailed, ProvisioningStateMoving, ProvisioningStateStarting, ProvisioningStateStopping, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code. +type ResourceSkuRestrictionsReasonCode string + +const ( + // NotAvailableForSubscription ... + NotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription" + // QuotaID ... + QuotaID ResourceSkuRestrictionsReasonCode = "QuotaId" +) + +// PossibleResourceSkuRestrictionsReasonCodeValues returns an array of possible values for the ResourceSkuRestrictionsReasonCode const type. +func PossibleResourceSkuRestrictionsReasonCodeValues() []ResourceSkuRestrictionsReasonCode { + return []ResourceSkuRestrictionsReasonCode{NotAvailableForSubscription, QuotaID} +} + +// ResourceSkuRestrictionsType enumerates the values for resource sku restrictions type. +type ResourceSkuRestrictionsType string + +const ( + // Location ... + Location ResourceSkuRestrictionsType = "Location" + // Zone ... + Zone ResourceSkuRestrictionsType = "Zone" +) + +// PossibleResourceSkuRestrictionsTypeValues returns an array of possible values for the ResourceSkuRestrictionsType const type. +func PossibleResourceSkuRestrictionsTypeValues() []ResourceSkuRestrictionsType { + return []ResourceSkuRestrictionsType{Location, Zone} +} + +// ServiceRegistryProvisioningState enumerates the values for service registry provisioning state. +type ServiceRegistryProvisioningState string + +const ( + // ServiceRegistryProvisioningStateCreating ... + ServiceRegistryProvisioningStateCreating ServiceRegistryProvisioningState = "Creating" + // ServiceRegistryProvisioningStateDeleting ... + ServiceRegistryProvisioningStateDeleting ServiceRegistryProvisioningState = "Deleting" + // ServiceRegistryProvisioningStateFailed ... + ServiceRegistryProvisioningStateFailed ServiceRegistryProvisioningState = "Failed" + // ServiceRegistryProvisioningStateSucceeded ... + ServiceRegistryProvisioningStateSucceeded ServiceRegistryProvisioningState = "Succeeded" + // ServiceRegistryProvisioningStateUpdating ... + ServiceRegistryProvisioningStateUpdating ServiceRegistryProvisioningState = "Updating" +) + +// PossibleServiceRegistryProvisioningStateValues returns an array of possible values for the ServiceRegistryProvisioningState const type. +func PossibleServiceRegistryProvisioningStateValues() []ServiceRegistryProvisioningState { + return []ServiceRegistryProvisioningState{ServiceRegistryProvisioningStateCreating, ServiceRegistryProvisioningStateDeleting, ServiceRegistryProvisioningStateFailed, ServiceRegistryProvisioningStateSucceeded, ServiceRegistryProvisioningStateUpdating} +} + +// SkuScaleType enumerates the values for sku scale type. +type SkuScaleType string + +const ( + // SkuScaleTypeAutomatic ... + SkuScaleTypeAutomatic SkuScaleType = "Automatic" + // SkuScaleTypeManual ... + SkuScaleTypeManual SkuScaleType = "Manual" + // SkuScaleTypeNone ... + SkuScaleTypeNone SkuScaleType = "None" +) + +// PossibleSkuScaleTypeValues returns an array of possible values for the SkuScaleType const type. +func PossibleSkuScaleTypeValues() []SkuScaleType { + return []SkuScaleType{SkuScaleTypeAutomatic, SkuScaleTypeManual, SkuScaleTypeNone} +} + +// SupportedRuntimePlatform enumerates the values for supported runtime platform. +type SupportedRuntimePlatform string + +const ( + // Java ... + Java SupportedRuntimePlatform = "Java" + // NETCore ... + NETCore SupportedRuntimePlatform = ".NET Core" +) + +// PossibleSupportedRuntimePlatformValues returns an array of possible values for the SupportedRuntimePlatform const type. +func PossibleSupportedRuntimePlatformValues() []SupportedRuntimePlatform { + return []SupportedRuntimePlatform{Java, NETCore} +} + +// SupportedRuntimeValue enumerates the values for supported runtime value. +type SupportedRuntimeValue string + +const ( + // Java11 ... + Java11 SupportedRuntimeValue = "Java_11" + // Java17 ... + Java17 SupportedRuntimeValue = "Java_17" + // Java8 ... + Java8 SupportedRuntimeValue = "Java_8" + // NetCore31 ... + NetCore31 SupportedRuntimeValue = "NetCore_31" +) + +// PossibleSupportedRuntimeValueValues returns an array of possible values for the SupportedRuntimeValue const type. +func PossibleSupportedRuntimeValueValues() []SupportedRuntimeValue { + return []SupportedRuntimeValue{Java11, Java17, Java8, NetCore31} +} + +// TestKeyType enumerates the values for test key type. +type TestKeyType string + +const ( + // Primary ... + Primary TestKeyType = "Primary" + // Secondary ... + Secondary TestKeyType = "Secondary" +) + +// PossibleTestKeyTypeValues returns an array of possible values for the TestKeyType const type. +func PossibleTestKeyTypeValues() []TestKeyType { + return []TestKeyType{Primary, Secondary} +} + +// TrafficDirection enumerates the values for traffic direction. +type TrafficDirection string + +const ( + // Inbound ... + Inbound TrafficDirection = "Inbound" + // Outbound ... + Outbound TrafficDirection = "Outbound" +) + +// PossibleTrafficDirectionValues returns an array of possible values for the TrafficDirection const type. +func PossibleTrafficDirectionValues() []TrafficDirection { + return []TrafficDirection{Inbound, Outbound} +} + +// Type enumerates the values for type. +type Type string + +const ( + // TypeCertificateProperties ... + TypeCertificateProperties Type = "CertificateProperties" + // TypeContentCertificate ... + TypeContentCertificate Type = "ContentCertificate" + // TypeKeyVaultCertificate ... + TypeKeyVaultCertificate Type = "KeyVaultCertificate" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{TypeCertificateProperties, TypeContentCertificate, TypeKeyVaultCertificate} +} + +// TypeBasicUserSourceInfo enumerates the values for type basic user source info. +type TypeBasicUserSourceInfo string + +const ( + // TypeBuildResult ... + TypeBuildResult TypeBasicUserSourceInfo = "BuildResult" + // TypeJar ... + TypeJar TypeBasicUserSourceInfo = "Jar" + // TypeNetCoreZip ... + TypeNetCoreZip TypeBasicUserSourceInfo = "NetCoreZip" + // TypeSource ... + TypeSource TypeBasicUserSourceInfo = "Source" + // TypeUploadedUserSourceInfo ... + TypeUploadedUserSourceInfo TypeBasicUserSourceInfo = "UploadedUserSourceInfo" + // TypeUserSourceInfo ... + TypeUserSourceInfo TypeBasicUserSourceInfo = "UserSourceInfo" +) + +// PossibleTypeBasicUserSourceInfoValues returns an array of possible values for the TypeBasicUserSourceInfo const type. +func PossibleTypeBasicUserSourceInfoValues() []TypeBasicUserSourceInfo { + return []TypeBasicUserSourceInfo{TypeBuildResult, TypeJar, TypeNetCoreZip, TypeSource, TypeUploadedUserSourceInfo, TypeUserSourceInfo} +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/models.go b/services/appplatform/mgmt/2022-04-01/appplatform/models.go new file mode 100644 index 000000000000..6b0c13697bc1 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/models.go @@ -0,0 +1,6909 @@ +package appplatform + +// 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/appplatform/mgmt/2022-04-01/appplatform" + +// ActiveDeploymentCollection object that includes an array of Deployment resource name and set them as +// active. +type ActiveDeploymentCollection struct { + // ActiveDeploymentNames - Collection of Deployment name. + ActiveDeploymentNames *[]string `json:"activeDeploymentNames,omitempty"` +} + +// ApplicationInsightsAgentVersions application Insights agent versions properties payload +type ApplicationInsightsAgentVersions struct { + // Java - READ-ONLY; Indicates the version of application insight java agent + Java *string `json:"java,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsAgentVersions. +func (aiav ApplicationInsightsAgentVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AppResource app resource payload +type AppResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the App resource + Properties *AppResourceProperties `json:"properties,omitempty"` + // Identity - The Managed Identity type of the app resource + Identity *ManagedIdentityProperties `json:"identity,omitempty"` + // Location - The GEO location of the application, always the same with its parent resource + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppResource. +func (ar AppResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.Properties != nil { + objectMap["properties"] = ar.Properties + } + if ar.Identity != nil { + objectMap["identity"] = ar.Identity + } + if ar.Location != nil { + objectMap["location"] = ar.Location + } + if ar.SystemData != nil { + objectMap["systemData"] = ar.SystemData + } + return json.Marshal(objectMap) +} + +// AppResourceCollection object that includes an array of App resources and a possible link for next set +type AppResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of App resources + Value *[]AppResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// AppResourceCollectionIterator provides access to a complete listing of AppResource values. +type AppResourceCollectionIterator struct { + i int + page AppResourceCollectionPage +} + +// 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 *AppResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppResourceCollectionIterator.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 *AppResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppResourceCollectionIterator) 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 AppResourceCollectionIterator) Response() AppResourceCollection { + 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 AppResourceCollectionIterator) Value() AppResource { + if !iter.page.NotDone() { + return AppResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppResourceCollectionIterator type. +func NewAppResourceCollectionIterator(page AppResourceCollectionPage) AppResourceCollectionIterator { + return AppResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arc AppResourceCollection) IsEmpty() bool { + return arc.Value == nil || len(*arc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arc AppResourceCollection) hasNextLink() bool { + return arc.NextLink != nil && len(*arc.NextLink) != 0 +} + +// appResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arc AppResourceCollection) appResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !arc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arc.NextLink))) +} + +// AppResourceCollectionPage contains a page of AppResource values. +type AppResourceCollectionPage struct { + fn func(context.Context, AppResourceCollection) (AppResourceCollection, error) + arc AppResourceCollection +} + +// 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 *AppResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppResourceCollectionPage.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.arc) + if err != nil { + return err + } + page.arc = 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 *AppResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppResourceCollectionPage) NotDone() bool { + return !page.arc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppResourceCollectionPage) Response() AppResourceCollection { + return page.arc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppResourceCollectionPage) Values() []AppResource { + if page.arc.IsEmpty() { + return nil + } + return *page.arc.Value +} + +// Creates a new instance of the AppResourceCollectionPage type. +func NewAppResourceCollectionPage(cur AppResourceCollection, getNextPage func(context.Context, AppResourceCollection) (AppResourceCollection, error)) AppResourceCollectionPage { + return AppResourceCollectionPage{ + fn: getNextPage, + arc: cur, + } +} + +// AppResourceProperties app resource properties payload +type AppResourceProperties struct { + // Public - Indicates whether the App exposes public endpoint + Public *bool `json:"public,omitempty"` + // URL - READ-ONLY; URL of the App + URL *string `json:"url,omitempty"` + // AddonConfigs - Collection of addons + AddonConfigs map[string]map[string]interface{} `json:"addonConfigs"` + // ProvisioningState - READ-ONLY; Provisioning state of the App. Possible values include: 'Succeeded', 'Failed', 'Creating', 'Updating', 'Deleting' + ProvisioningState AppResourceProvisioningState `json:"provisioningState,omitempty"` + // Fqdn - Fully qualified dns Name. + Fqdn *string `json:"fqdn,omitempty"` + // HTTPSOnly - Indicate if only https is allowed. + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + // TemporaryDisk - Temporary disk settings + TemporaryDisk *TemporaryDisk `json:"temporaryDisk,omitempty"` + // PersistentDisk - Persistent disk settings + PersistentDisk *PersistentDisk `json:"persistentDisk,omitempty"` + // EnableEndToEndTLS - Indicate if end to end TLS is enabled. + EnableEndToEndTLS *bool `json:"enableEndToEndTLS,omitempty"` + // LoadedCertificates - Collection of loaded certificates + LoadedCertificates *[]LoadedCertificate `json:"loadedCertificates,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppResourceProperties. +func (arp AppResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arp.Public != nil { + objectMap["public"] = arp.Public + } + if arp.AddonConfigs != nil { + objectMap["addonConfigs"] = arp.AddonConfigs + } + if arp.Fqdn != nil { + objectMap["fqdn"] = arp.Fqdn + } + if arp.HTTPSOnly != nil { + objectMap["httpsOnly"] = arp.HTTPSOnly + } + if arp.TemporaryDisk != nil { + objectMap["temporaryDisk"] = arp.TemporaryDisk + } + if arp.PersistentDisk != nil { + objectMap["persistentDisk"] = arp.PersistentDisk + } + if arp.EnableEndToEndTLS != nil { + objectMap["enableEndToEndTLS"] = arp.EnableEndToEndTLS + } + if arp.LoadedCertificates != nil { + objectMap["loadedCertificates"] = arp.LoadedCertificates + } + return json.Marshal(objectMap) +} + +// AppsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (AppResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateOrUpdateFuture) 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 AppsCreateOrUpdateFuture.Result. +func (future *AppsCreateOrUpdateFuture) result(client AppsClient) (ar AppResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.AppsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { + ar, err = client.CreateOrUpdateResponder(ar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsCreateOrUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type AppsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsDeleteFuture) 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 AppsDeleteFuture.Result. +func (future *AppsDeleteFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.AppsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AppsSetActiveDeploymentsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsSetActiveDeploymentsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (AppResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsSetActiveDeploymentsFuture) 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 AppsSetActiveDeploymentsFuture.Result. +func (future *AppsSetActiveDeploymentsFuture) result(client AppsClient) (ar AppResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsSetActiveDeploymentsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.AppsSetActiveDeploymentsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { + ar, err = client.SetActiveDeploymentsResponder(ar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsSetActiveDeploymentsFuture", "Result", ar.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type AppsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (AppResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsUpdateFuture) 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 AppsUpdateFuture.Result. +func (future *AppsUpdateFuture) result(client AppsClient) (ar AppResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.AppsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { + ar, err = client.UpdateResponder(ar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") + } + } + return +} + +// AvailableOperations available operations of the service +type AvailableOperations struct { + autorest.Response `json:"-"` + // Value - Collection of available operation details + Value *[]OperationDetail `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// AvailableOperationsIterator provides access to a complete listing of OperationDetail values. +type AvailableOperationsIterator struct { + i int + page AvailableOperationsPage +} + +// 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 *AvailableOperationsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsIterator.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 *AvailableOperationsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailableOperationsIterator) 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 AvailableOperationsIterator) Response() AvailableOperations { + 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 AvailableOperationsIterator) Value() OperationDetail { + if !iter.page.NotDone() { + return OperationDetail{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailableOperationsIterator type. +func NewAvailableOperationsIterator(page AvailableOperationsPage) AvailableOperationsIterator { + return AvailableOperationsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ao AvailableOperations) IsEmpty() bool { + return ao.Value == nil || len(*ao.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ao AvailableOperations) hasNextLink() bool { + return ao.NextLink != nil && len(*ao.NextLink) != 0 +} + +// availableOperationsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ao AvailableOperations) availableOperationsPreparer(ctx context.Context) (*http.Request, error) { + if !ao.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ao.NextLink))) +} + +// AvailableOperationsPage contains a page of OperationDetail values. +type AvailableOperationsPage struct { + fn func(context.Context, AvailableOperations) (AvailableOperations, error) + ao AvailableOperations +} + +// 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 *AvailableOperationsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsPage.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.ao) + if err != nil { + return err + } + page.ao = 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 *AvailableOperationsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailableOperationsPage) NotDone() bool { + return !page.ao.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailableOperationsPage) Response() AvailableOperations { + return page.ao +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailableOperationsPage) Values() []OperationDetail { + if page.ao.IsEmpty() { + return nil + } + return *page.ao.Value +} + +// Creates a new instance of the AvailableOperationsPage type. +func NewAvailableOperationsPage(cur AvailableOperations, getNextPage func(context.Context, AvailableOperations) (AvailableOperations, error)) AvailableOperationsPage { + return AvailableOperationsPage{ + fn: getNextPage, + ao: cur, + } +} + +// AvailableRuntimeVersions ... +type AvailableRuntimeVersions struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; A list of all supported runtime versions. + Value *[]SupportedRuntimeVersion `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailableRuntimeVersions. +func (arv AvailableRuntimeVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BindingResource binding resource payload +type BindingResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Binding resource + Properties *BindingResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BindingResource. +func (br BindingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if br.Properties != nil { + objectMap["properties"] = br.Properties + } + if br.SystemData != nil { + objectMap["systemData"] = br.SystemData + } + return json.Marshal(objectMap) +} + +// BindingResourceCollection object that includes an array of Binding resources and a possible link for +// next set +type BindingResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Binding resources + Value *[]BindingResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BindingResourceCollectionIterator provides access to a complete listing of BindingResource values. +type BindingResourceCollectionIterator struct { + i int + page BindingResourceCollectionPage +} + +// 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 *BindingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingResourceCollectionIterator.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 *BindingResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BindingResourceCollectionIterator) 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 BindingResourceCollectionIterator) Response() BindingResourceCollection { + 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 BindingResourceCollectionIterator) Value() BindingResource { + if !iter.page.NotDone() { + return BindingResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BindingResourceCollectionIterator type. +func NewBindingResourceCollectionIterator(page BindingResourceCollectionPage) BindingResourceCollectionIterator { + return BindingResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (brc BindingResourceCollection) IsEmpty() bool { + return brc.Value == nil || len(*brc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (brc BindingResourceCollection) hasNextLink() bool { + return brc.NextLink != nil && len(*brc.NextLink) != 0 +} + +// bindingResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (brc BindingResourceCollection) bindingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !brc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(brc.NextLink))) +} + +// BindingResourceCollectionPage contains a page of BindingResource values. +type BindingResourceCollectionPage struct { + fn func(context.Context, BindingResourceCollection) (BindingResourceCollection, error) + brc BindingResourceCollection +} + +// 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 *BindingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingResourceCollectionPage.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.brc) + if err != nil { + return err + } + page.brc = 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 *BindingResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BindingResourceCollectionPage) NotDone() bool { + return !page.brc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BindingResourceCollectionPage) Response() BindingResourceCollection { + return page.brc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BindingResourceCollectionPage) Values() []BindingResource { + if page.brc.IsEmpty() { + return nil + } + return *page.brc.Value +} + +// Creates a new instance of the BindingResourceCollectionPage type. +func NewBindingResourceCollectionPage(cur BindingResourceCollection, getNextPage func(context.Context, BindingResourceCollection) (BindingResourceCollection, error)) BindingResourceCollectionPage { + return BindingResourceCollectionPage{ + fn: getNextPage, + brc: cur, + } +} + +// BindingResourceProperties binding resource properties payload +type BindingResourceProperties struct { + // ResourceName - READ-ONLY; The name of the bound resource + ResourceName *string `json:"resourceName,omitempty"` + // ResourceType - READ-ONLY; The standard Azure resource type of the bound resource + ResourceType *string `json:"resourceType,omitempty"` + // ResourceID - The Azure resource id of the bound resource + ResourceID *string `json:"resourceId,omitempty"` + // Key - The key of the bound resource + Key *string `json:"key,omitempty"` + // BindingParameters - Binding parameters of the Binding resource + BindingParameters map[string]interface{} `json:"bindingParameters"` + // GeneratedProperties - READ-ONLY; The generated Spring Boot property file for this binding. The secret will be deducted. + GeneratedProperties *string `json:"generatedProperties,omitempty"` + // CreatedAt - READ-ONLY; Creation time of the Binding resource + CreatedAt *string `json:"createdAt,omitempty"` + // UpdatedAt - READ-ONLY; Update time of the Binding resource + UpdatedAt *string `json:"updatedAt,omitempty"` +} + +// MarshalJSON is the custom marshaler for BindingResourceProperties. +func (brp BindingResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if brp.ResourceID != nil { + objectMap["resourceId"] = brp.ResourceID + } + if brp.Key != nil { + objectMap["key"] = brp.Key + } + if brp.BindingParameters != nil { + objectMap["bindingParameters"] = brp.BindingParameters + } + return json.Marshal(objectMap) +} + +// BindingsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BindingsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BindingsClient) (BindingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BindingsCreateOrUpdateFuture) 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 BindingsCreateOrUpdateFuture.Result. +func (future *BindingsCreateOrUpdateFuture) result(client BindingsClient) (br BindingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + br.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BindingsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if br.Response.Response, err = future.GetResult(sender); err == nil && br.Response.Response.StatusCode != http.StatusNoContent { + br, err = client.CreateOrUpdateResponder(br.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsCreateOrUpdateFuture", "Result", br.Response.Response, "Failure responding to request") + } + } + return +} + +// BindingsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BindingsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BindingsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BindingsDeleteFuture) 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 BindingsDeleteFuture.Result. +func (future *BindingsDeleteFuture) result(client BindingsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BindingsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BindingsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BindingsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BindingsClient) (BindingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BindingsUpdateFuture) 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 BindingsUpdateFuture.Result. +func (future *BindingsUpdateFuture) result(client BindingsClient) (br BindingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + br.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BindingsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if br.Response.Response, err = future.GetResult(sender); err == nil && br.Response.Response.StatusCode != http.StatusNoContent { + br, err = client.UpdateResponder(br.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsUpdateFuture", "Result", br.Response.Response, "Failure responding to request") + } + } + return +} + +// Build build resource payload +type Build struct { + autorest.Response `json:"-"` + // Properties - Properties of the build resource + Properties *BuildProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Build. +func (b Build) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if b.Properties != nil { + objectMap["properties"] = b.Properties + } + if b.SystemData != nil { + objectMap["systemData"] = b.SystemData + } + return json.Marshal(objectMap) +} + +// BuildCollection object that includes an array of Build resources and a possible link for next set +type BuildCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Build resources + Value *[]Build `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildCollectionIterator provides access to a complete listing of Build values. +type BuildCollectionIterator struct { + i int + page BuildCollectionPage +} + +// 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 *BuildCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildCollectionIterator.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 *BuildCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildCollectionIterator) 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 BuildCollectionIterator) Response() BuildCollection { + 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 BuildCollectionIterator) Value() Build { + if !iter.page.NotDone() { + return Build{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildCollectionIterator type. +func NewBuildCollectionIterator(page BuildCollectionPage) BuildCollectionIterator { + return BuildCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bc BuildCollection) IsEmpty() bool { + return bc.Value == nil || len(*bc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bc BuildCollection) hasNextLink() bool { + return bc.NextLink != nil && len(*bc.NextLink) != 0 +} + +// buildCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bc BuildCollection) buildCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bc.NextLink))) +} + +// BuildCollectionPage contains a page of Build values. +type BuildCollectionPage struct { + fn func(context.Context, BuildCollection) (BuildCollection, error) + bc BuildCollection +} + +// 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 *BuildCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildCollectionPage.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.bc) + if err != nil { + return err + } + page.bc = 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 *BuildCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildCollectionPage) NotDone() bool { + return !page.bc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildCollectionPage) Response() BuildCollection { + return page.bc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildCollectionPage) Values() []Build { + if page.bc.IsEmpty() { + return nil + } + return *page.bc.Value +} + +// Creates a new instance of the BuildCollectionPage type. +func NewBuildCollectionPage(cur BuildCollection, getNextPage func(context.Context, BuildCollection) (BuildCollection, error)) BuildCollectionPage { + return BuildCollectionPage{ + fn: getNextPage, + bc: cur, + } +} + +// BuilderProperties kPack Builder properties payload +type BuilderProperties struct { + // ProvisioningState - READ-ONLY; Builder provision status. Possible values include: 'BuilderProvisioningStateCreating', 'BuilderProvisioningStateUpdating', 'BuilderProvisioningStateSucceeded', 'BuilderProvisioningStateFailed', 'BuilderProvisioningStateDeleting' + ProvisioningState BuilderProvisioningState `json:"provisioningState,omitempty"` + // Stack - Builder cluster stack property. + Stack *StackProperties `json:"stack,omitempty"` + // BuildpackGroups - Builder buildpack groups. + BuildpackGroups *[]BuildpacksGroupProperties `json:"buildpackGroups,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuilderProperties. +func (bp BuilderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.Stack != nil { + objectMap["stack"] = bp.Stack + } + if bp.BuildpackGroups != nil { + objectMap["buildpackGroups"] = bp.BuildpackGroups + } + return json.Marshal(objectMap) +} + +// BuilderResource kPack Builder resource +type BuilderResource struct { + autorest.Response `json:"-"` + // Properties - Property of the Builder resource. + Properties *BuilderProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuilderResource. +func (br BuilderResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if br.Properties != nil { + objectMap["properties"] = br.Properties + } + if br.SystemData != nil { + objectMap["systemData"] = br.SystemData + } + return json.Marshal(objectMap) +} + +// BuilderResourceCollection object that includes an array of Builder resources and a possible link for +// next set +type BuilderResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Builder resources + Value *[]BuilderResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuilderResourceCollectionIterator provides access to a complete listing of BuilderResource values. +type BuilderResourceCollectionIterator struct { + i int + page BuilderResourceCollectionPage +} + +// 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 *BuilderResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuilderResourceCollectionIterator.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 *BuilderResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuilderResourceCollectionIterator) 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 BuilderResourceCollectionIterator) Response() BuilderResourceCollection { + 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 BuilderResourceCollectionIterator) Value() BuilderResource { + if !iter.page.NotDone() { + return BuilderResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuilderResourceCollectionIterator type. +func NewBuilderResourceCollectionIterator(page BuilderResourceCollectionPage) BuilderResourceCollectionIterator { + return BuilderResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (brc BuilderResourceCollection) IsEmpty() bool { + return brc.Value == nil || len(*brc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (brc BuilderResourceCollection) hasNextLink() bool { + return brc.NextLink != nil && len(*brc.NextLink) != 0 +} + +// builderResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (brc BuilderResourceCollection) builderResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !brc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(brc.NextLink))) +} + +// BuilderResourceCollectionPage contains a page of BuilderResource values. +type BuilderResourceCollectionPage struct { + fn func(context.Context, BuilderResourceCollection) (BuilderResourceCollection, error) + brc BuilderResourceCollection +} + +// 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 *BuilderResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuilderResourceCollectionPage.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.brc) + if err != nil { + return err + } + page.brc = 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 *BuilderResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuilderResourceCollectionPage) NotDone() bool { + return !page.brc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuilderResourceCollectionPage) Response() BuilderResourceCollection { + return page.brc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuilderResourceCollectionPage) Values() []BuilderResource { + if page.brc.IsEmpty() { + return nil + } + return *page.brc.Value +} + +// Creates a new instance of the BuilderResourceCollectionPage type. +func NewBuilderResourceCollectionPage(cur BuilderResourceCollection, getNextPage func(context.Context, BuilderResourceCollection) (BuilderResourceCollection, error)) BuilderResourceCollectionPage { + return BuilderResourceCollectionPage{ + fn: getNextPage, + brc: cur, + } +} + +// BuildpackBindingCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BuildpackBindingCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildpackBindingClient) (BuildpackBindingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildpackBindingCreateOrUpdateFuture) 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 BuildpackBindingCreateOrUpdateFuture.Result. +func (future *BuildpackBindingCreateOrUpdateFuture) result(client BuildpackBindingClient) (bbr BuildpackBindingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bbr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildpackBindingCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bbr.Response.Response, err = future.GetResult(sender); err == nil && bbr.Response.Response.StatusCode != http.StatusNoContent { + bbr, err = client.CreateOrUpdateResponder(bbr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingCreateOrUpdateFuture", "Result", bbr.Response.Response, "Failure responding to request") + } + } + return +} + +// BuildpackBindingDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BuildpackBindingDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildpackBindingClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildpackBindingDeleteFuture) 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 BuildpackBindingDeleteFuture.Result. +func (future *BuildpackBindingDeleteFuture) result(client BuildpackBindingClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildpackBindingDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BuildpackBindingLaunchProperties buildpack Binding Launch Properties +type BuildpackBindingLaunchProperties struct { + // Properties - Non-sensitive properties for launchProperties + Properties map[string]*string `json:"properties"` + // Secrets - Sensitive properties for launchProperties + Secrets map[string]*string `json:"secrets"` +} + +// MarshalJSON is the custom marshaler for BuildpackBindingLaunchProperties. +func (bblp BuildpackBindingLaunchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bblp.Properties != nil { + objectMap["properties"] = bblp.Properties + } + if bblp.Secrets != nil { + objectMap["secrets"] = bblp.Secrets + } + return json.Marshal(objectMap) +} + +// BuildpackBindingProperties properties of a buildpack binding +type BuildpackBindingProperties struct { + // BindingType - Buildpack Binding Type. Possible values include: 'ApplicationInsights', 'ApacheSkyWalking', 'AppDynamics', 'Dynatrace', 'NewRelic', 'ElasticAPM' + BindingType BindingType `json:"bindingType,omitempty"` + // ProvisioningState - READ-ONLY; State of the Buildpack Binding. Possible values include: 'BuildpackBindingProvisioningStateCreating', 'BuildpackBindingProvisioningStateUpdating', 'BuildpackBindingProvisioningStateSucceeded', 'BuildpackBindingProvisioningStateFailed', 'BuildpackBindingProvisioningStateDeleting' + ProvisioningState BuildpackBindingProvisioningState `json:"provisioningState,omitempty"` + // LaunchProperties - The object describes the buildpack binding launch properties + LaunchProperties *BuildpackBindingLaunchProperties `json:"launchProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildpackBindingProperties. +func (bbp BuildpackBindingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bbp.BindingType != "" { + objectMap["bindingType"] = bbp.BindingType + } + if bbp.LaunchProperties != nil { + objectMap["launchProperties"] = bbp.LaunchProperties + } + return json.Marshal(objectMap) +} + +// BuildpackBindingResource buildpack Binding Resource object +type BuildpackBindingResource struct { + autorest.Response `json:"-"` + // Properties - Properties of a buildpack binding + Properties *BuildpackBindingProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildpackBindingResource. +func (bbr BuildpackBindingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bbr.Properties != nil { + objectMap["properties"] = bbr.Properties + } + if bbr.SystemData != nil { + objectMap["systemData"] = bbr.SystemData + } + return json.Marshal(objectMap) +} + +// BuildpackBindingResourceCollection object that includes an array of BuildpackBinding resources and a +// possible link for next set +type BuildpackBindingResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of BuildpackBinding resources + Value *[]BuildpackBindingResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildpackBindingResourceCollectionIterator provides access to a complete listing of +// BuildpackBindingResource values. +type BuildpackBindingResourceCollectionIterator struct { + i int + page BuildpackBindingResourceCollectionPage +} + +// 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 *BuildpackBindingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingResourceCollectionIterator.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 *BuildpackBindingResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildpackBindingResourceCollectionIterator) 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 BuildpackBindingResourceCollectionIterator) Response() BuildpackBindingResourceCollection { + 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 BuildpackBindingResourceCollectionIterator) Value() BuildpackBindingResource { + if !iter.page.NotDone() { + return BuildpackBindingResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildpackBindingResourceCollectionIterator type. +func NewBuildpackBindingResourceCollectionIterator(page BuildpackBindingResourceCollectionPage) BuildpackBindingResourceCollectionIterator { + return BuildpackBindingResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bbrc BuildpackBindingResourceCollection) IsEmpty() bool { + return bbrc.Value == nil || len(*bbrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bbrc BuildpackBindingResourceCollection) hasNextLink() bool { + return bbrc.NextLink != nil && len(*bbrc.NextLink) != 0 +} + +// buildpackBindingResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bbrc BuildpackBindingResourceCollection) buildpackBindingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bbrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bbrc.NextLink))) +} + +// BuildpackBindingResourceCollectionPage contains a page of BuildpackBindingResource values. +type BuildpackBindingResourceCollectionPage struct { + fn func(context.Context, BuildpackBindingResourceCollection) (BuildpackBindingResourceCollection, error) + bbrc BuildpackBindingResourceCollection +} + +// 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 *BuildpackBindingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingResourceCollectionPage.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.bbrc) + if err != nil { + return err + } + page.bbrc = 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 *BuildpackBindingResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildpackBindingResourceCollectionPage) NotDone() bool { + return !page.bbrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildpackBindingResourceCollectionPage) Response() BuildpackBindingResourceCollection { + return page.bbrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildpackBindingResourceCollectionPage) Values() []BuildpackBindingResource { + if page.bbrc.IsEmpty() { + return nil + } + return *page.bbrc.Value +} + +// Creates a new instance of the BuildpackBindingResourceCollectionPage type. +func NewBuildpackBindingResourceCollectionPage(cur BuildpackBindingResourceCollection, getNextPage func(context.Context, BuildpackBindingResourceCollection) (BuildpackBindingResourceCollection, error)) BuildpackBindingResourceCollectionPage { + return BuildpackBindingResourceCollectionPage{ + fn: getNextPage, + bbrc: cur, + } +} + +// BuildpackProperties buildpack properties payload +type BuildpackProperties struct { + // ID - Id of the buildpack + ID *string `json:"id,omitempty"` +} + +// BuildpacksGroupProperties buildpack group properties of the Builder +type BuildpacksGroupProperties struct { + // Name - Buildpack group name + Name *string `json:"name,omitempty"` + // Buildpacks - Buildpacks in the buildpack group + Buildpacks *[]BuildpackProperties `json:"buildpacks,omitempty"` +} + +// BuildProperties build resource properties payload +type BuildProperties struct { + // RelativePath - The relative path of source code + RelativePath *string `json:"relativePath,omitempty"` + // Builder - The resource id of builder to build the source code + Builder *string `json:"builder,omitempty"` + // AgentPool - The resource id of agent pool + AgentPool *string `json:"agentPool,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the KPack build result. Possible values include: 'BuildProvisioningStateCreating', 'BuildProvisioningStateUpdating', 'BuildProvisioningStateSucceeded', 'BuildProvisioningStateFailed', 'BuildProvisioningStateDeleting' + ProvisioningState BuildProvisioningState `json:"provisioningState,omitempty"` + // Env - The environment variables for this build + Env map[string]*string `json:"env"` + // TriggeredBuildResult - The build result triggered by this build + TriggeredBuildResult *TriggeredBuildResult `json:"triggeredBuildResult,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildProperties. +func (bp BuildProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.RelativePath != nil { + objectMap["relativePath"] = bp.RelativePath + } + if bp.Builder != nil { + objectMap["builder"] = bp.Builder + } + if bp.AgentPool != nil { + objectMap["agentPool"] = bp.AgentPool + } + if bp.Env != nil { + objectMap["env"] = bp.Env + } + if bp.TriggeredBuildResult != nil { + objectMap["triggeredBuildResult"] = bp.TriggeredBuildResult + } + return json.Marshal(objectMap) +} + +// BuildResult build result resource payload +type BuildResult struct { + autorest.Response `json:"-"` + // Properties - Properties of the build result resource + Properties *BuildResultProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildResult. +func (br BuildResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if br.Properties != nil { + objectMap["properties"] = br.Properties + } + if br.SystemData != nil { + objectMap["systemData"] = br.SystemData + } + return json.Marshal(objectMap) +} + +// BuildResultCollection object that includes an array of Build result resources and a possible link for +// next set +type BuildResultCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Build result resources + Value *[]BuildResult `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildResultCollectionIterator provides access to a complete listing of BuildResult values. +type BuildResultCollectionIterator struct { + i int + page BuildResultCollectionPage +} + +// 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 *BuildResultCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildResultCollectionIterator.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 *BuildResultCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildResultCollectionIterator) 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 BuildResultCollectionIterator) Response() BuildResultCollection { + 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 BuildResultCollectionIterator) Value() BuildResult { + if !iter.page.NotDone() { + return BuildResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildResultCollectionIterator type. +func NewBuildResultCollectionIterator(page BuildResultCollectionPage) BuildResultCollectionIterator { + return BuildResultCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (brc BuildResultCollection) IsEmpty() bool { + return brc.Value == nil || len(*brc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (brc BuildResultCollection) hasNextLink() bool { + return brc.NextLink != nil && len(*brc.NextLink) != 0 +} + +// buildResultCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (brc BuildResultCollection) buildResultCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !brc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(brc.NextLink))) +} + +// BuildResultCollectionPage contains a page of BuildResult values. +type BuildResultCollectionPage struct { + fn func(context.Context, BuildResultCollection) (BuildResultCollection, error) + brc BuildResultCollection +} + +// 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 *BuildResultCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildResultCollectionPage.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.brc) + if err != nil { + return err + } + page.brc = 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 *BuildResultCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildResultCollectionPage) NotDone() bool { + return !page.brc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildResultCollectionPage) Response() BuildResultCollection { + return page.brc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildResultCollectionPage) Values() []BuildResult { + if page.brc.IsEmpty() { + return nil + } + return *page.brc.Value +} + +// Creates a new instance of the BuildResultCollectionPage type. +func NewBuildResultCollectionPage(cur BuildResultCollection, getNextPage func(context.Context, BuildResultCollection) (BuildResultCollection, error)) BuildResultCollectionPage { + return BuildResultCollectionPage{ + fn: getNextPage, + brc: cur, + } +} + +// BuildResultLog build result log resource properties payload +type BuildResultLog struct { + autorest.Response `json:"-"` + // BlobURL - The public download URL of this build result log + BlobURL *string `json:"blobUrl,omitempty"` +} + +// BuildResultProperties build result resource properties payload +type BuildResultProperties struct { + // Name - The name of this build result + Name *string `json:"name,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the KPack build result. Possible values include: 'BuildResultProvisioningStateQueuing', 'BuildResultProvisioningStateBuilding', 'BuildResultProvisioningStateSucceeded', 'BuildResultProvisioningStateFailed', 'BuildResultProvisioningStateDeleting' + ProvisioningState BuildResultProvisioningState `json:"provisioningState,omitempty"` + // BuildPodName - The build pod name which can be used to get the build log streaming. + BuildPodName *string `json:"buildPodName,omitempty"` + // BuildStages - READ-ONLY; All of the build stage (init-container and container) resources in build pod. + BuildStages *[]BuildStageProperties `json:"buildStages,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildResultProperties. +func (brp BuildResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if brp.Name != nil { + objectMap["name"] = brp.Name + } + if brp.BuildPodName != nil { + objectMap["buildPodName"] = brp.BuildPodName + } + return json.Marshal(objectMap) +} + +// BuildResultUserSourceInfo reference to a build result +type BuildResultUserSourceInfo struct { + // BuildResultID - Resource id of an existing succeeded build result under the same Spring instance. + BuildResultID *string `json:"buildResultId,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) MarshalJSON() ([]byte, error) { + brusi.Type = TypeBuildResult + objectMap := make(map[string]interface{}) + if brusi.BuildResultID != nil { + objectMap["buildResultId"] = brusi.BuildResultID + } + if brusi.Version != nil { + objectMap["version"] = brusi.Version + } + if brusi.Type != "" { + objectMap["type"] = brusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return &brusi, true +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &brusi, true +} + +// BuildService build service resource payload +type BuildService struct { + autorest.Response `json:"-"` + // Properties - Properties of the build resource + Properties *BuildServiceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildService. +func (bs BuildService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bs.Properties != nil { + objectMap["properties"] = bs.Properties + } + if bs.SystemData != nil { + objectMap["systemData"] = bs.SystemData + } + return json.Marshal(objectMap) +} + +// BuildServiceAgentPoolProperties build service agent pool properties +type BuildServiceAgentPoolProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the build service agent pool + ProvisioningState *string `json:"provisioningState,omitempty"` + // PoolSize - build service agent pool size properties + PoolSize *BuildServiceAgentPoolSizeProperties `json:"poolSize,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServiceAgentPoolProperties. +func (bsapp BuildServiceAgentPoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsapp.PoolSize != nil { + objectMap["poolSize"] = bsapp.PoolSize + } + return json.Marshal(objectMap) +} + +// BuildServiceAgentPoolResource the build service agent pool resource +type BuildServiceAgentPoolResource struct { + autorest.Response `json:"-"` + // Properties - build service agent pool properties + Properties *BuildServiceAgentPoolProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServiceAgentPoolResource. +func (bsapr BuildServiceAgentPoolResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsapr.Properties != nil { + objectMap["properties"] = bsapr.Properties + } + if bsapr.SystemData != nil { + objectMap["systemData"] = bsapr.SystemData + } + return json.Marshal(objectMap) +} + +// BuildServiceAgentPoolResourceCollection object that includes an array of build service agent pool +// resources and a possible link for next set +type BuildServiceAgentPoolResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of build service agent pool resource + Value *[]BuildServiceAgentPoolResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildServiceAgentPoolResourceCollectionIterator provides access to a complete listing of +// BuildServiceAgentPoolResource values. +type BuildServiceAgentPoolResourceCollectionIterator struct { + i int + page BuildServiceAgentPoolResourceCollectionPage +} + +// 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 *BuildServiceAgentPoolResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolResourceCollectionIterator.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 *BuildServiceAgentPoolResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildServiceAgentPoolResourceCollectionIterator) 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 BuildServiceAgentPoolResourceCollectionIterator) Response() BuildServiceAgentPoolResourceCollection { + 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 BuildServiceAgentPoolResourceCollectionIterator) Value() BuildServiceAgentPoolResource { + if !iter.page.NotDone() { + return BuildServiceAgentPoolResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildServiceAgentPoolResourceCollectionIterator type. +func NewBuildServiceAgentPoolResourceCollectionIterator(page BuildServiceAgentPoolResourceCollectionPage) BuildServiceAgentPoolResourceCollectionIterator { + return BuildServiceAgentPoolResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsaprc BuildServiceAgentPoolResourceCollection) IsEmpty() bool { + return bsaprc.Value == nil || len(*bsaprc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsaprc BuildServiceAgentPoolResourceCollection) hasNextLink() bool { + return bsaprc.NextLink != nil && len(*bsaprc.NextLink) != 0 +} + +// buildServiceAgentPoolResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsaprc BuildServiceAgentPoolResourceCollection) buildServiceAgentPoolResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bsaprc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsaprc.NextLink))) +} + +// BuildServiceAgentPoolResourceCollectionPage contains a page of BuildServiceAgentPoolResource values. +type BuildServiceAgentPoolResourceCollectionPage struct { + fn func(context.Context, BuildServiceAgentPoolResourceCollection) (BuildServiceAgentPoolResourceCollection, error) + bsaprc BuildServiceAgentPoolResourceCollection +} + +// 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 *BuildServiceAgentPoolResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolResourceCollectionPage.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.bsaprc) + if err != nil { + return err + } + page.bsaprc = 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 *BuildServiceAgentPoolResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildServiceAgentPoolResourceCollectionPage) NotDone() bool { + return !page.bsaprc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildServiceAgentPoolResourceCollectionPage) Response() BuildServiceAgentPoolResourceCollection { + return page.bsaprc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildServiceAgentPoolResourceCollectionPage) Values() []BuildServiceAgentPoolResource { + if page.bsaprc.IsEmpty() { + return nil + } + return *page.bsaprc.Value +} + +// Creates a new instance of the BuildServiceAgentPoolResourceCollectionPage type. +func NewBuildServiceAgentPoolResourceCollectionPage(cur BuildServiceAgentPoolResourceCollection, getNextPage func(context.Context, BuildServiceAgentPoolResourceCollection) (BuildServiceAgentPoolResourceCollection, error)) BuildServiceAgentPoolResourceCollectionPage { + return BuildServiceAgentPoolResourceCollectionPage{ + fn: getNextPage, + bsaprc: cur, + } +} + +// BuildServiceAgentPoolSizeProperties build service agent pool size properties +type BuildServiceAgentPoolSizeProperties struct { + // Name - The name of build service agent pool size + Name *string `json:"name,omitempty"` + // CPU - READ-ONLY; The cpu property of build service agent pool size + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; The memory property of build service agent pool size + Memory *string `json:"memory,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServiceAgentPoolSizeProperties. +func (bsapsp BuildServiceAgentPoolSizeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsapsp.Name != nil { + objectMap["name"] = bsapsp.Name + } + return json.Marshal(objectMap) +} + +// BuildServiceAgentPoolUpdatePutFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BuildServiceAgentPoolUpdatePutFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildServiceAgentPoolClient) (BuildServiceAgentPoolResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildServiceAgentPoolUpdatePutFuture) 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 BuildServiceAgentPoolUpdatePutFuture.Result. +func (future *BuildServiceAgentPoolUpdatePutFuture) result(client BuildServiceAgentPoolClient) (bsapr BuildServiceAgentPoolResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolUpdatePutFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bsapr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildServiceAgentPoolUpdatePutFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bsapr.Response.Response, err = future.GetResult(sender); err == nil && bsapr.Response.Response.StatusCode != http.StatusNoContent { + bsapr, err = client.UpdatePutResponder(bsapr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolUpdatePutFuture", "Result", bsapr.Response.Response, "Failure responding to request") + } + } + return +} + +// BuildServiceBuilderCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BuildServiceBuilderCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildServiceBuilderClient) (BuilderResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildServiceBuilderCreateOrUpdateFuture) 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 BuildServiceBuilderCreateOrUpdateFuture.Result. +func (future *BuildServiceBuilderCreateOrUpdateFuture) result(client BuildServiceBuilderClient) (br BuilderResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + br.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildServiceBuilderCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if br.Response.Response, err = future.GetResult(sender); err == nil && br.Response.Response.StatusCode != http.StatusNoContent { + br, err = client.CreateOrUpdateResponder(br.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderCreateOrUpdateFuture", "Result", br.Response.Response, "Failure responding to request") + } + } + return +} + +// BuildServiceBuilderDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BuildServiceBuilderDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildServiceBuilderClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildServiceBuilderDeleteFuture) 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 BuildServiceBuilderDeleteFuture.Result. +func (future *BuildServiceBuilderDeleteFuture) result(client BuildServiceBuilderClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildServiceBuilderDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BuildServiceCollection object that includes an array of Build service resources and a possible link for +// next set +type BuildServiceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Build service resources + Value *[]BuildService `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildServiceCollectionIterator provides access to a complete listing of BuildService values. +type BuildServiceCollectionIterator struct { + i int + page BuildServiceCollectionPage +} + +// 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 *BuildServiceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceCollectionIterator.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 *BuildServiceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildServiceCollectionIterator) 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 BuildServiceCollectionIterator) Response() BuildServiceCollection { + 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 BuildServiceCollectionIterator) Value() BuildService { + if !iter.page.NotDone() { + return BuildService{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildServiceCollectionIterator type. +func NewBuildServiceCollectionIterator(page BuildServiceCollectionPage) BuildServiceCollectionIterator { + return BuildServiceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsc BuildServiceCollection) IsEmpty() bool { + return bsc.Value == nil || len(*bsc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsc BuildServiceCollection) hasNextLink() bool { + return bsc.NextLink != nil && len(*bsc.NextLink) != 0 +} + +// buildServiceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsc BuildServiceCollection) buildServiceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bsc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsc.NextLink))) +} + +// BuildServiceCollectionPage contains a page of BuildService values. +type BuildServiceCollectionPage struct { + fn func(context.Context, BuildServiceCollection) (BuildServiceCollection, error) + bsc BuildServiceCollection +} + +// 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 *BuildServiceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceCollectionPage.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.bsc) + if err != nil { + return err + } + page.bsc = 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 *BuildServiceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildServiceCollectionPage) NotDone() bool { + return !page.bsc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildServiceCollectionPage) Response() BuildServiceCollection { + return page.bsc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildServiceCollectionPage) Values() []BuildService { + if page.bsc.IsEmpty() { + return nil + } + return *page.bsc.Value +} + +// Creates a new instance of the BuildServiceCollectionPage type. +func NewBuildServiceCollectionPage(cur BuildServiceCollection, getNextPage func(context.Context, BuildServiceCollection) (BuildServiceCollection, error)) BuildServiceCollectionPage { + return BuildServiceCollectionPage{ + fn: getNextPage, + bsc: cur, + } +} + +// BuildServiceProperties build service resource properties payload +type BuildServiceProperties struct { + // KPackVersion - The installed KPack version in this build service. + KPackVersion *string `json:"kPackVersion,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the KPack build result. Possible values include: 'BuildServiceProvisioningStateCreating', 'BuildServiceProvisioningStateUpdating', 'BuildServiceProvisioningStateSucceeded', 'BuildServiceProvisioningStateFailed', 'BuildServiceProvisioningStateDeleting' + ProvisioningState BuildServiceProvisioningState `json:"provisioningState,omitempty"` + // ResourceRequests - The runtime resource configuration of this build service. + ResourceRequests *BuildServicePropertiesResourceRequests `json:"resourceRequests,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServiceProperties. +func (bsp BuildServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsp.KPackVersion != nil { + objectMap["kPackVersion"] = bsp.KPackVersion + } + if bsp.ResourceRequests != nil { + objectMap["resourceRequests"] = bsp.ResourceRequests + } + return json.Marshal(objectMap) +} + +// BuildServicePropertiesResourceRequests the runtime resource configuration of this build service. +type BuildServicePropertiesResourceRequests struct { + // CPU - READ-ONLY; vCPU allocated to the entire build service node pool. + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to the entire build service node pool. + Memory *string `json:"memory,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServicePropertiesResourceRequests. +func (bspR BuildServicePropertiesResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BuildStageProperties the build stage (init-container and container) resources in build pod. +type BuildStageProperties struct { + // Name - READ-ONLY; The name of this build stage resource. + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; The provisioning state of this build stage resource. Possible values include: 'KPackBuildStageProvisioningStateNotStarted', 'KPackBuildStageProvisioningStateRunning', 'KPackBuildStageProvisioningStateSucceeded', 'KPackBuildStageProvisioningStateFailed' + Status KPackBuildStageProvisioningState `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildStageProperties. +func (bsp BuildStageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BasicCertificateProperties certificate resource payload. +type BasicCertificateProperties interface { + AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) + AsContentCertificateProperties() (*ContentCertificateProperties, bool) + AsCertificateProperties() (*CertificateProperties, bool) +} + +// CertificateProperties certificate resource payload. +type CertificateProperties struct { + // Thumbprint - READ-ONLY; The thumbprint of certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // Issuer - READ-ONLY; The issuer of certificate. + Issuer *string `json:"issuer,omitempty"` + // IssuedDate - READ-ONLY; The issue date of certificate. + IssuedDate *string `json:"issuedDate,omitempty"` + // ExpirationDate - READ-ONLY; The expiration date of certificate. + ExpirationDate *string `json:"expirationDate,omitempty"` + // ActivateDate - READ-ONLY; The activate date of certificate. + ActivateDate *string `json:"activateDate,omitempty"` + // SubjectName - READ-ONLY; The subject name of certificate. + SubjectName *string `json:"subjectName,omitempty"` + // DNSNames - READ-ONLY; The domain list of certificate. + DNSNames *[]string `json:"dnsNames,omitempty"` + // Type - Possible values include: 'TypeCertificateProperties', 'TypeKeyVaultCertificate', 'TypeContentCertificate' + Type Type `json:"type,omitempty"` +} + +func unmarshalBasicCertificateProperties(body []byte) (BasicCertificateProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeKeyVaultCertificate): + var kvcp KeyVaultCertificateProperties + err := json.Unmarshal(body, &kvcp) + return kvcp, err + case string(TypeContentCertificate): + var ccp ContentCertificateProperties + err := json.Unmarshal(body, &ccp) + return ccp, err + default: + var cp CertificateProperties + err := json.Unmarshal(body, &cp) + return cp, err + } +} +func unmarshalBasicCertificatePropertiesArray(body []byte) ([]BasicCertificateProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + cpArray := make([]BasicCertificateProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + cp, err := unmarshalBasicCertificateProperties(*rawMessage) + if err != nil { + return nil, err + } + cpArray[index] = cp + } + return cpArray, nil +} + +// MarshalJSON is the custom marshaler for CertificateProperties. +func (cp CertificateProperties) MarshalJSON() ([]byte, error) { + cp.Type = TypeCertificateProperties + objectMap := make(map[string]interface{}) + if cp.Type != "" { + objectMap["type"] = cp.Type + } + return json.Marshal(objectMap) +} + +// AsKeyVaultCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. +func (cp CertificateProperties) AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) { + return nil, false +} + +// AsContentCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. +func (cp CertificateProperties) AsContentCertificateProperties() (*ContentCertificateProperties, bool) { + return nil, false +} + +// AsCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. +func (cp CertificateProperties) AsCertificateProperties() (*CertificateProperties, bool) { + return &cp, true +} + +// AsBasicCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. +func (cp CertificateProperties) AsBasicCertificateProperties() (BasicCertificateProperties, bool) { + return &cp, true +} + +// CertificateResource certificate resource payload. +type CertificateResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the certificate resource payload. + Properties BasicCertificateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateResource. +func (cr CertificateResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = cr.Properties + if cr.SystemData != nil { + objectMap["systemData"] = cr.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CertificateResource struct. +func (cr *CertificateResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + properties, err := unmarshalBasicCertificateProperties(*v) + if err != nil { + return err + } + cr.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cr.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cr.SystemData = &systemData + } + } + } + + return nil +} + +// CertificateResourceCollection collection compose of certificate resources list and a possible link for +// next page. +type CertificateResourceCollection struct { + autorest.Response `json:"-"` + // Value - The certificate resources list. + Value *[]CertificateResource `json:"value,omitempty"` + // NextLink - The link to next page of certificate list. + NextLink *string `json:"nextLink,omitempty"` +} + +// CertificateResourceCollectionIterator provides access to a complete listing of CertificateResource +// values. +type CertificateResourceCollectionIterator struct { + i int + page CertificateResourceCollectionPage +} + +// 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 *CertificateResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateResourceCollectionIterator.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 *CertificateResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CertificateResourceCollectionIterator) 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 CertificateResourceCollectionIterator) Response() CertificateResourceCollection { + 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 CertificateResourceCollectionIterator) Value() CertificateResource { + if !iter.page.NotDone() { + return CertificateResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CertificateResourceCollectionIterator type. +func NewCertificateResourceCollectionIterator(page CertificateResourceCollectionPage) CertificateResourceCollectionIterator { + return CertificateResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (crc CertificateResourceCollection) IsEmpty() bool { + return crc.Value == nil || len(*crc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (crc CertificateResourceCollection) hasNextLink() bool { + return crc.NextLink != nil && len(*crc.NextLink) != 0 +} + +// certificateResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (crc CertificateResourceCollection) certificateResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !crc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(crc.NextLink))) +} + +// CertificateResourceCollectionPage contains a page of CertificateResource values. +type CertificateResourceCollectionPage struct { + fn func(context.Context, CertificateResourceCollection) (CertificateResourceCollection, error) + crc CertificateResourceCollection +} + +// 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 *CertificateResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateResourceCollectionPage.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.crc) + if err != nil { + return err + } + page.crc = 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 *CertificateResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CertificateResourceCollectionPage) NotDone() bool { + return !page.crc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CertificateResourceCollectionPage) Response() CertificateResourceCollection { + return page.crc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CertificateResourceCollectionPage) Values() []CertificateResource { + if page.crc.IsEmpty() { + return nil + } + return *page.crc.Value +} + +// Creates a new instance of the CertificateResourceCollectionPage type. +func NewCertificateResourceCollectionPage(cur CertificateResourceCollection, getNextPage func(context.Context, CertificateResourceCollection) (CertificateResourceCollection, error)) CertificateResourceCollectionPage { + return CertificateResourceCollectionPage{ + fn: getNextPage, + crc: cur, + } +} + +// CertificatesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type CertificatesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CertificatesClient) (CertificateResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CertificatesCreateOrUpdateFuture) 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 CertificatesCreateOrUpdateFuture.Result. +func (future *CertificatesCreateOrUpdateFuture) result(client CertificatesClient) (cr CertificateResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CertificatesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { + cr, err = client.CreateOrUpdateResponder(cr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesCreateOrUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") + } + } + return +} + +// CertificatesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CertificatesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CertificatesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CertificatesDeleteFuture) 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 CertificatesDeleteFuture.Result. +func (future *CertificatesDeleteFuture) result(client CertificatesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CertificatesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// CloudError an error response from the service. +type CloudError struct { + // Error - An error response from the service. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the 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"` +} + +// ClusterResourceProperties service properties payload +type ClusterResourceProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the Service. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateStarting', 'ProvisioningStateStopping', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving', 'ProvisioningStateMoved', 'ProvisioningStateMoveFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // NetworkProfile - Network profile of the Service + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // Version - READ-ONLY; Version of the Service + Version *int32 `json:"version,omitempty"` + // ServiceID - READ-ONLY; ServiceInstanceEntity GUID which uniquely identifies a created resource + ServiceID *string `json:"serviceId,omitempty"` + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + // Fqdn - READ-ONLY; Fully qualified dns name of the service instance + Fqdn *string `json:"fqdn,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterResourceProperties. +func (crp ClusterResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if crp.NetworkProfile != nil { + objectMap["networkProfile"] = crp.NetworkProfile + } + if crp.ZoneRedundant != nil { + objectMap["zoneRedundant"] = crp.ZoneRedundant + } + return json.Marshal(objectMap) +} + +// ConfigServerGitProperty property of git. +type ConfigServerGitProperty struct { + // Repositories - Repositories of git. + Repositories *[]GitPatternRepository `json:"repositories,omitempty"` + // URI - URI of the repository + URI *string `json:"uri,omitempty"` + // Label - Label of the repository + Label *string `json:"label,omitempty"` + // SearchPaths - Searching path of the repository + SearchPaths *[]string `json:"searchPaths,omitempty"` + // Username - Username of git repository basic auth. + Username *string `json:"username,omitempty"` + // Password - Password of git repository basic auth. + Password *string `json:"password,omitempty"` + // HostKey - Public sshKey of git repository. + HostKey *string `json:"hostKey,omitempty"` + // HostKeyAlgorithm - SshKey algorithm of git repository. + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + // PrivateKey - Private sshKey algorithm of git repository. + PrivateKey *string `json:"privateKey,omitempty"` + // StrictHostKeyChecking - Strict host key checking or not. + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +} + +// ConfigServerProperties config server git properties payload +type ConfigServerProperties struct { + // ProvisioningState - READ-ONLY; State of the config server. Possible values include: 'ConfigServerStateNotAvailable', 'ConfigServerStateDeleted', 'ConfigServerStateFailed', 'ConfigServerStateSucceeded', 'ConfigServerStateUpdating' + ProvisioningState ConfigServerState `json:"provisioningState,omitempty"` + // Error - Error when apply config server settings. + Error *Error `json:"error,omitempty"` + // ConfigServer - Settings of config server. + ConfigServer *ConfigServerSettings `json:"configServer,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigServerProperties. +func (csp ConfigServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csp.Error != nil { + objectMap["error"] = csp.Error + } + if csp.ConfigServer != nil { + objectMap["configServer"] = csp.ConfigServer + } + return json.Marshal(objectMap) +} + +// ConfigServerResource config Server resource +type ConfigServerResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Config Server resource + Properties *ConfigServerProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigServerResource. +func (csr ConfigServerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csr.Properties != nil { + objectMap["properties"] = csr.Properties + } + if csr.SystemData != nil { + objectMap["systemData"] = csr.SystemData + } + return json.Marshal(objectMap) +} + +// ConfigServerSettings the settings of config server. +type ConfigServerSettings struct { + // GitProperty - Property of git environment. + GitProperty *ConfigServerGitProperty `json:"gitProperty,omitempty"` +} + +// ConfigServerSettingsErrorRecord error record of the config server settings +type ConfigServerSettingsErrorRecord struct { + // Name - The name of the config server settings error record + Name *string `json:"name,omitempty"` + // URI - The uri of the config server settings error record + URI *string `json:"uri,omitempty"` + // Messages - The detail error messages of the record + Messages *[]string `json:"messages,omitempty"` +} + +// ConfigServerSettingsValidateResult validation result for config server settings +type ConfigServerSettingsValidateResult struct { + autorest.Response `json:"-"` + // IsValid - Indicate if the config server settings are valid + IsValid *bool `json:"isValid,omitempty"` + // Details - The detail validation results + Details *[]ConfigServerSettingsErrorRecord `json:"details,omitempty"` +} + +// ConfigServersUpdatePatchFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigServersUpdatePatchFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigServersClient) (ConfigServerResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigServersUpdatePatchFuture) 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 ConfigServersUpdatePatchFuture.Result. +func (future *ConfigServersUpdatePatchFuture) result(client ConfigServersClient) (csr ConfigServerResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePatchFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + csr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigServersUpdatePatchFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if csr.Response.Response, err = future.GetResult(sender); err == nil && csr.Response.Response.StatusCode != http.StatusNoContent { + csr, err = client.UpdatePatchResponder(csr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePatchFuture", "Result", csr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigServersUpdatePutFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConfigServersUpdatePutFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigServersClient) (ConfigServerResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigServersUpdatePutFuture) 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 ConfigServersUpdatePutFuture.Result. +func (future *ConfigServersUpdatePutFuture) result(client ConfigServersClient) (csr ConfigServerResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePutFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + csr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigServersUpdatePutFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if csr.Response.Response, err = future.GetResult(sender); err == nil && csr.Response.Response.StatusCode != http.StatusNoContent { + csr, err = client.UpdatePutResponder(csr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePutFuture", "Result", csr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigServersValidateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConfigServersValidateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigServersClient) (ConfigServerSettingsValidateResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigServersValidateFuture) 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 ConfigServersValidateFuture.Result. +func (future *ConfigServersValidateFuture) result(client ConfigServersClient) (cssvr ConfigServerSettingsValidateResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersValidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cssvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigServersValidateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cssvr.Response.Response, err = future.GetResult(sender); err == nil && cssvr.Response.Response.StatusCode != http.StatusNoContent { + cssvr, err = client.ValidateResponder(cssvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersValidateFuture", "Result", cssvr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigurationServiceGitProperty property of git environment. +type ConfigurationServiceGitProperty struct { + Repositories *[]ConfigurationServiceGitRepository `json:"repositories,omitempty"` +} + +// ConfigurationServiceGitPropertyValidateResult validation result for configuration service settings +type ConfigurationServiceGitPropertyValidateResult struct { + // IsValid - Indicate if the configuration service settings are valid + IsValid *bool `json:"isValid,omitempty"` + // GitReposValidationResult - The detail validation results + GitReposValidationResult *[]ValidationMessages `json:"gitReposValidationResult,omitempty"` +} + +// ConfigurationServiceGitRepository git repository property payload for Application Configuration Service +type ConfigurationServiceGitRepository struct { + // Name - Name of the repository + Name *string `json:"name,omitempty"` + // Patterns - Collection of patterns of the repository + Patterns *[]string `json:"patterns,omitempty"` + // URI - URI of the repository + URI *string `json:"uri,omitempty"` + // Label - Label of the repository + Label *string `json:"label,omitempty"` + // SearchPaths - Searching path of the repository + SearchPaths *[]string `json:"searchPaths,omitempty"` + // Username - Username of git repository basic auth. + Username *string `json:"username,omitempty"` + // Password - Password of git repository basic auth. + Password *string `json:"password,omitempty"` + // HostKey - Public sshKey of git repository. + HostKey *string `json:"hostKey,omitempty"` + // HostKeyAlgorithm - SshKey algorithm of git repository. + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + // PrivateKey - Private sshKey algorithm of git repository. + PrivateKey *string `json:"privateKey,omitempty"` + // StrictHostKeyChecking - Strict host key checking or not. + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +} + +// ConfigurationServiceInstance collection of instances belong to the Application Configuration Service +type ConfigurationServiceInstance struct { + // Name - READ-ONLY; Name of the Application Configuration Service instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the Application Configuration Service instance + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationServiceInstance. +func (csi ConfigurationServiceInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConfigurationServiceProperties application Configuration Service properties payload +type ConfigurationServiceProperties struct { + // ProvisioningState - READ-ONLY; State of the Application Configuration Service. Possible values include: 'ConfigurationServiceProvisioningStateCreating', 'ConfigurationServiceProvisioningStateUpdating', 'ConfigurationServiceProvisioningStateSucceeded', 'ConfigurationServiceProvisioningStateFailed', 'ConfigurationServiceProvisioningStateDeleting' + ProvisioningState ConfigurationServiceProvisioningState `json:"provisioningState,omitempty"` + // ResourceRequests - The requested resource quantity for required CPU and Memory. + ResourceRequests *ConfigurationServiceResourceRequests `json:"resourceRequests,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to Application Configuration Service. + Instances *[]ConfigurationServiceInstance `json:"instances,omitempty"` + Settings *ConfigurationServiceSettings `json:"settings,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationServiceProperties. +func (csp ConfigurationServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csp.ResourceRequests != nil { + objectMap["resourceRequests"] = csp.ResourceRequests + } + if csp.Settings != nil { + objectMap["settings"] = csp.Settings + } + return json.Marshal(objectMap) +} + +// ConfigurationServiceResource application Configuration Service resource +type ConfigurationServiceResource struct { + autorest.Response `json:"-"` + Properties *ConfigurationServiceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationServiceResource. +func (csr ConfigurationServiceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csr.Properties != nil { + objectMap["properties"] = csr.Properties + } + if csr.SystemData != nil { + objectMap["systemData"] = csr.SystemData + } + return json.Marshal(objectMap) +} + +// ConfigurationServiceResourceCollection object that includes an array of configuration service resources +// and a possible link for next set +type ConfigurationServiceResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of configuration service resources + Value *[]ConfigurationServiceResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ConfigurationServiceResourceCollectionIterator provides access to a complete listing of +// ConfigurationServiceResource values. +type ConfigurationServiceResourceCollectionIterator struct { + i int + page ConfigurationServiceResourceCollectionPage +} + +// 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 *ConfigurationServiceResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServiceResourceCollectionIterator.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 *ConfigurationServiceResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ConfigurationServiceResourceCollectionIterator) 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 ConfigurationServiceResourceCollectionIterator) Response() ConfigurationServiceResourceCollection { + 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 ConfigurationServiceResourceCollectionIterator) Value() ConfigurationServiceResource { + if !iter.page.NotDone() { + return ConfigurationServiceResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ConfigurationServiceResourceCollectionIterator type. +func NewConfigurationServiceResourceCollectionIterator(page ConfigurationServiceResourceCollectionPage) ConfigurationServiceResourceCollectionIterator { + return ConfigurationServiceResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (csrc ConfigurationServiceResourceCollection) IsEmpty() bool { + return csrc.Value == nil || len(*csrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (csrc ConfigurationServiceResourceCollection) hasNextLink() bool { + return csrc.NextLink != nil && len(*csrc.NextLink) != 0 +} + +// configurationServiceResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (csrc ConfigurationServiceResourceCollection) configurationServiceResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !csrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(csrc.NextLink))) +} + +// ConfigurationServiceResourceCollectionPage contains a page of ConfigurationServiceResource values. +type ConfigurationServiceResourceCollectionPage struct { + fn func(context.Context, ConfigurationServiceResourceCollection) (ConfigurationServiceResourceCollection, error) + csrc ConfigurationServiceResourceCollection +} + +// 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 *ConfigurationServiceResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServiceResourceCollectionPage.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.csrc) + if err != nil { + return err + } + page.csrc = 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 *ConfigurationServiceResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ConfigurationServiceResourceCollectionPage) NotDone() bool { + return !page.csrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ConfigurationServiceResourceCollectionPage) Response() ConfigurationServiceResourceCollection { + return page.csrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ConfigurationServiceResourceCollectionPage) Values() []ConfigurationServiceResource { + if page.csrc.IsEmpty() { + return nil + } + return *page.csrc.Value +} + +// Creates a new instance of the ConfigurationServiceResourceCollectionPage type. +func NewConfigurationServiceResourceCollectionPage(cur ConfigurationServiceResourceCollection, getNextPage func(context.Context, ConfigurationServiceResourceCollection) (ConfigurationServiceResourceCollection, error)) ConfigurationServiceResourceCollectionPage { + return ConfigurationServiceResourceCollectionPage{ + fn: getNextPage, + csrc: cur, + } +} + +// ConfigurationServiceResourceRequests resource request payload of Application Configuration Service +type ConfigurationServiceResourceRequests struct { + // CPU - READ-ONLY; Cpu allocated to each Application Configuration Service instance + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to each Application Configuration Service instance + Memory *string `json:"memory,omitempty"` + // InstanceCount - READ-ONLY; Instance count of the Application Configuration Service + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationServiceResourceRequests. +func (csrr ConfigurationServiceResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConfigurationServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigurationServicesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationServicesClient) (ConfigurationServiceResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationServicesCreateOrUpdateFuture) 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 ConfigurationServicesCreateOrUpdateFuture.Result. +func (future *ConfigurationServicesCreateOrUpdateFuture) result(client ConfigurationServicesClient) (csr ConfigurationServiceResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + csr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigurationServicesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if csr.Response.Response, err = future.GetResult(sender); err == nil && csr.Response.Response.StatusCode != http.StatusNoContent { + csr, err = client.CreateOrUpdateResponder(csr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesCreateOrUpdateFuture", "Result", csr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigurationServicesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigurationServicesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationServicesDeleteFuture) 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 ConfigurationServicesDeleteFuture.Result. +func (future *ConfigurationServicesDeleteFuture) result(client ConfigurationServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigurationServicesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ConfigurationServiceSettings the settings of Application Configuration Service. +type ConfigurationServiceSettings struct { + GitProperty *ConfigurationServiceGitProperty `json:"gitProperty,omitempty"` +} + +// ConfigurationServiceSettingsValidateResult validation result for configuration service settings +type ConfigurationServiceSettingsValidateResult struct { + autorest.Response `json:"-"` + GitPropertyValidationResult *ConfigurationServiceGitPropertyValidateResult `json:"gitPropertyValidationResult,omitempty"` +} + +// ConfigurationServicesValidateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigurationServicesValidateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationServicesClient) (ConfigurationServiceSettingsValidateResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationServicesValidateFuture) 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 ConfigurationServicesValidateFuture.Result. +func (future *ConfigurationServicesValidateFuture) result(client ConfigurationServicesClient) (cssvr ConfigurationServiceSettingsValidateResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesValidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cssvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigurationServicesValidateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cssvr.Response.Response, err = future.GetResult(sender); err == nil && cssvr.Response.Response.StatusCode != http.StatusNoContent { + cssvr, err = client.ValidateResponder(cssvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesValidateFuture", "Result", cssvr.Response.Response, "Failure responding to request") + } + } + return +} + +// ContentCertificateProperties properties of certificate imported from key vault. +type ContentCertificateProperties struct { + // Content - The content of uploaded certificate. + Content *string `json:"content,omitempty"` + // Thumbprint - READ-ONLY; The thumbprint of certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // Issuer - READ-ONLY; The issuer of certificate. + Issuer *string `json:"issuer,omitempty"` + // IssuedDate - READ-ONLY; The issue date of certificate. + IssuedDate *string `json:"issuedDate,omitempty"` + // ExpirationDate - READ-ONLY; The expiration date of certificate. + ExpirationDate *string `json:"expirationDate,omitempty"` + // ActivateDate - READ-ONLY; The activate date of certificate. + ActivateDate *string `json:"activateDate,omitempty"` + // SubjectName - READ-ONLY; The subject name of certificate. + SubjectName *string `json:"subjectName,omitempty"` + // DNSNames - READ-ONLY; The domain list of certificate. + DNSNames *[]string `json:"dnsNames,omitempty"` + // Type - Possible values include: 'TypeCertificateProperties', 'TypeKeyVaultCertificate', 'TypeContentCertificate' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContentCertificateProperties. +func (ccp ContentCertificateProperties) MarshalJSON() ([]byte, error) { + ccp.Type = TypeContentCertificate + objectMap := make(map[string]interface{}) + if ccp.Content != nil { + objectMap["content"] = ccp.Content + } + if ccp.Type != "" { + objectMap["type"] = ccp.Type + } + return json.Marshal(objectMap) +} + +// AsKeyVaultCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. +func (ccp ContentCertificateProperties) AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) { + return nil, false +} + +// AsContentCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. +func (ccp ContentCertificateProperties) AsContentCertificateProperties() (*ContentCertificateProperties, bool) { + return &ccp, true +} + +// AsCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. +func (ccp ContentCertificateProperties) AsCertificateProperties() (*CertificateProperties, bool) { + return nil, false +} + +// AsBasicCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. +func (ccp ContentCertificateProperties) AsBasicCertificateProperties() (BasicCertificateProperties, bool) { + return &ccp, true +} + +// CustomDomainProperties custom domain of app resource payload. +type CustomDomainProperties struct { + // Thumbprint - The thumbprint of bound certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // AppName - READ-ONLY; The app name of domain. + AppName *string `json:"appName,omitempty"` + // CertName - The bound certificate name of domain. + CertName *string `json:"certName,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainProperties. +func (cdp CustomDomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdp.Thumbprint != nil { + objectMap["thumbprint"] = cdp.Thumbprint + } + if cdp.CertName != nil { + objectMap["certName"] = cdp.CertName + } + return json.Marshal(objectMap) +} + +// CustomDomainResource custom domain resource payload. +type CustomDomainResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the custom domain resource. + Properties *CustomDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainResource. +func (cdr CustomDomainResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdr.Properties != nil { + objectMap["properties"] = cdr.Properties + } + if cdr.SystemData != nil { + objectMap["systemData"] = cdr.SystemData + } + return json.Marshal(objectMap) +} + +// CustomDomainResourceCollection collection compose of a custom domain resources list and a possible link +// for next page. +type CustomDomainResourceCollection struct { + autorest.Response `json:"-"` + // Value - The custom domain resources list. + Value *[]CustomDomainResource `json:"value,omitempty"` + // NextLink - The link to next page of custom domain list. + NextLink *string `json:"nextLink,omitempty"` +} + +// CustomDomainResourceCollectionIterator provides access to a complete listing of CustomDomainResource +// values. +type CustomDomainResourceCollectionIterator struct { + i int + page CustomDomainResourceCollectionPage +} + +// 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 *CustomDomainResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainResourceCollectionIterator.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 *CustomDomainResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CustomDomainResourceCollectionIterator) 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 CustomDomainResourceCollectionIterator) Response() CustomDomainResourceCollection { + 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 CustomDomainResourceCollectionIterator) Value() CustomDomainResource { + if !iter.page.NotDone() { + return CustomDomainResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CustomDomainResourceCollectionIterator type. +func NewCustomDomainResourceCollectionIterator(page CustomDomainResourceCollectionPage) CustomDomainResourceCollectionIterator { + return CustomDomainResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cdrc CustomDomainResourceCollection) IsEmpty() bool { + return cdrc.Value == nil || len(*cdrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cdrc CustomDomainResourceCollection) hasNextLink() bool { + return cdrc.NextLink != nil && len(*cdrc.NextLink) != 0 +} + +// customDomainResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cdrc CustomDomainResourceCollection) customDomainResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !cdrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cdrc.NextLink))) +} + +// CustomDomainResourceCollectionPage contains a page of CustomDomainResource values. +type CustomDomainResourceCollectionPage struct { + fn func(context.Context, CustomDomainResourceCollection) (CustomDomainResourceCollection, error) + cdrc CustomDomainResourceCollection +} + +// 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 *CustomDomainResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainResourceCollectionPage.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.cdrc) + if err != nil { + return err + } + page.cdrc = 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 *CustomDomainResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CustomDomainResourceCollectionPage) NotDone() bool { + return !page.cdrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CustomDomainResourceCollectionPage) Response() CustomDomainResourceCollection { + return page.cdrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CustomDomainResourceCollectionPage) Values() []CustomDomainResource { + if page.cdrc.IsEmpty() { + return nil + } + return *page.cdrc.Value +} + +// Creates a new instance of the CustomDomainResourceCollectionPage type. +func NewCustomDomainResourceCollectionPage(cur CustomDomainResourceCollection, getNextPage func(context.Context, CustomDomainResourceCollection) (CustomDomainResourceCollection, error)) CustomDomainResourceCollectionPage { + return CustomDomainResourceCollectionPage{ + fn: getNextPage, + cdrc: cur, + } +} + +// CustomDomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type CustomDomainsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (CustomDomainResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsCreateOrUpdateFuture) 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 CustomDomainsCreateOrUpdateFuture.Result. +func (future *CustomDomainsCreateOrUpdateFuture) result(client CustomDomainsClient) (cdr CustomDomainResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cdr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CustomDomainsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cdr.Response.Response, err = future.GetResult(sender); err == nil && cdr.Response.Response.StatusCode != http.StatusNoContent { + cdr, err = client.CreateOrUpdateResponder(cdr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsCreateOrUpdateFuture", "Result", cdr.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomDomainsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsDeleteFuture) 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 CustomDomainsDeleteFuture.Result. +func (future *CustomDomainsDeleteFuture) result(client CustomDomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CustomDomainsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// CustomDomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomDomainsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (CustomDomainResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsUpdateFuture) 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 CustomDomainsUpdateFuture.Result. +func (future *CustomDomainsUpdateFuture) result(client CustomDomainsClient) (cdr CustomDomainResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cdr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CustomDomainsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cdr.Response.Response, err = future.GetResult(sender); err == nil && cdr.Response.Response.StatusCode != http.StatusNoContent { + cdr, err = client.UpdateResponder(cdr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsUpdateFuture", "Result", cdr.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomDomainValidatePayload custom domain validate payload. +type CustomDomainValidatePayload struct { + // Name - Name to be validated + Name *string `json:"name,omitempty"` +} + +// CustomDomainValidateResult validation result for custom domain. +type CustomDomainValidateResult struct { + autorest.Response `json:"-"` + // IsValid - Indicates if domain name is valid. + IsValid *bool `json:"isValid,omitempty"` + // Message - Message of why domain name is invalid. + Message *string `json:"message,omitempty"` +} + +// DeploymentInstance deployment instance payload +type DeploymentInstance struct { + // Name - READ-ONLY; Name of the deployment instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the deployment instance + Status *string `json:"status,omitempty"` + // Reason - READ-ONLY; Failed reason of the deployment instance + Reason *string `json:"reason,omitempty"` + // DiscoveryStatus - READ-ONLY; Discovery status of the deployment instance + DiscoveryStatus *string `json:"discoveryStatus,omitempty"` + // StartTime - READ-ONLY; Start time of the deployment instance + StartTime *string `json:"startTime,omitempty"` + // Zone - READ-ONLY; Availability zone information of the deployment instance + Zone *string `json:"zone,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentInstance. +func (di DeploymentInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DeploymentResource deployment resource payload +type DeploymentResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Deployment resource + Properties *DeploymentResourceProperties `json:"properties,omitempty"` + // Sku - Sku of the Deployment resource + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentResource. +func (dr DeploymentResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dr.Properties != nil { + objectMap["properties"] = dr.Properties + } + if dr.Sku != nil { + objectMap["sku"] = dr.Sku + } + if dr.SystemData != nil { + objectMap["systemData"] = dr.SystemData + } + return json.Marshal(objectMap) +} + +// DeploymentResourceCollection object that includes an array of App resources and a possible link for next +// set +type DeploymentResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Deployment resources + Value *[]DeploymentResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeploymentResourceCollectionIterator provides access to a complete listing of DeploymentResource values. +type DeploymentResourceCollectionIterator struct { + i int + page DeploymentResourceCollectionPage +} + +// 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 *DeploymentResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentResourceCollectionIterator.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 *DeploymentResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeploymentResourceCollectionIterator) 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 DeploymentResourceCollectionIterator) Response() DeploymentResourceCollection { + 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 DeploymentResourceCollectionIterator) Value() DeploymentResource { + if !iter.page.NotDone() { + return DeploymentResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeploymentResourceCollectionIterator type. +func NewDeploymentResourceCollectionIterator(page DeploymentResourceCollectionPage) DeploymentResourceCollectionIterator { + return DeploymentResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (drc DeploymentResourceCollection) IsEmpty() bool { + return drc.Value == nil || len(*drc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (drc DeploymentResourceCollection) hasNextLink() bool { + return drc.NextLink != nil && len(*drc.NextLink) != 0 +} + +// deploymentResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (drc DeploymentResourceCollection) deploymentResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !drc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(drc.NextLink))) +} + +// DeploymentResourceCollectionPage contains a page of DeploymentResource values. +type DeploymentResourceCollectionPage struct { + fn func(context.Context, DeploymentResourceCollection) (DeploymentResourceCollection, error) + drc DeploymentResourceCollection +} + +// 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 *DeploymentResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentResourceCollectionPage.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.drc) + if err != nil { + return err + } + page.drc = 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 *DeploymentResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeploymentResourceCollectionPage) NotDone() bool { + return !page.drc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeploymentResourceCollectionPage) Response() DeploymentResourceCollection { + return page.drc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeploymentResourceCollectionPage) Values() []DeploymentResource { + if page.drc.IsEmpty() { + return nil + } + return *page.drc.Value +} + +// Creates a new instance of the DeploymentResourceCollectionPage type. +func NewDeploymentResourceCollectionPage(cur DeploymentResourceCollection, getNextPage func(context.Context, DeploymentResourceCollection) (DeploymentResourceCollection, error)) DeploymentResourceCollectionPage { + return DeploymentResourceCollectionPage{ + fn: getNextPage, + drc: cur, + } +} + +// DeploymentResourceProperties deployment resource properties payload +type DeploymentResourceProperties struct { + // Source - Uploaded source information of the deployment. + Source BasicUserSourceInfo `json:"source,omitempty"` + // DeploymentSettings - Deployment settings of the Deployment + DeploymentSettings *DeploymentSettings `json:"deploymentSettings,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Deployment. Possible values include: 'DeploymentResourceProvisioningStateCreating', 'DeploymentResourceProvisioningStateUpdating', 'DeploymentResourceProvisioningStateSucceeded', 'DeploymentResourceProvisioningStateFailed' + ProvisioningState DeploymentResourceProvisioningState `json:"provisioningState,omitempty"` + // Status - READ-ONLY; Status of the Deployment. Possible values include: 'Stopped', 'Running' + Status DeploymentResourceStatus `json:"status,omitempty"` + // Active - Indicates whether the Deployment is active + Active *bool `json:"active,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to the Deployment + Instances *[]DeploymentInstance `json:"instances,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentResourceProperties. +func (drp DeploymentResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["source"] = drp.Source + if drp.DeploymentSettings != nil { + objectMap["deploymentSettings"] = drp.DeploymentSettings + } + if drp.Active != nil { + objectMap["active"] = drp.Active + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DeploymentResourceProperties struct. +func (drp *DeploymentResourceProperties) 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 := unmarshalBasicUserSourceInfo(*v) + if err != nil { + return err + } + drp.Source = source + } + case "deploymentSettings": + if v != nil { + var deploymentSettings DeploymentSettings + err = json.Unmarshal(*v, &deploymentSettings) + if err != nil { + return err + } + drp.DeploymentSettings = &deploymentSettings + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentResourceProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + drp.ProvisioningState = provisioningState + } + case "status": + if v != nil { + var status DeploymentResourceStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + drp.Status = status + } + case "active": + if v != nil { + var active bool + err = json.Unmarshal(*v, &active) + if err != nil { + return err + } + drp.Active = &active + } + case "instances": + if v != nil { + var instances []DeploymentInstance + err = json.Unmarshal(*v, &instances) + if err != nil { + return err + } + drp.Instances = &instances + } + } + } + + return nil +} + +// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsCreateOrUpdateFuture) 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 DeploymentsCreateOrUpdateFuture.Result. +func (future *DeploymentsCreateOrUpdateFuture) result(client DeploymentsClient) (dr DeploymentResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dr.Response.Response, err = future.GetResult(sender); err == nil && dr.Response.Response.StatusCode != http.StatusNoContent { + dr, err = client.CreateOrUpdateResponder(dr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsCreateOrUpdateFuture", "Result", dr.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsDeleteFuture) 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 DeploymentsDeleteFuture.Result. +func (future *DeploymentsDeleteFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentSettings deployment settings payload +type DeploymentSettings struct { + // ResourceRequests - The requested resource quantity for required CPU and Memory. It is recommended that using this field to represent the required CPU and Memory, the old field cpu and memoryInGB will be deprecated later. + ResourceRequests *ResourceRequests `json:"resourceRequests,omitempty"` + // EnvironmentVariables - Collection of environment variables + EnvironmentVariables map[string]*string `json:"environmentVariables"` + // AddonConfigs - Collection of addons + AddonConfigs map[string]map[string]interface{} `json:"addonConfigs"` +} + +// MarshalJSON is the custom marshaler for DeploymentSettings. +func (ds DeploymentSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ds.ResourceRequests != nil { + objectMap["resourceRequests"] = ds.ResourceRequests + } + if ds.EnvironmentVariables != nil { + objectMap["environmentVariables"] = ds.EnvironmentVariables + } + if ds.AddonConfigs != nil { + objectMap["addonConfigs"] = ds.AddonConfigs + } + return json.Marshal(objectMap) +} + +// DeploymentsGenerateHeapDumpFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsGenerateHeapDumpFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsGenerateHeapDumpFuture) 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 DeploymentsGenerateHeapDumpFuture.Result. +func (future *DeploymentsGenerateHeapDumpFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsGenerateHeapDumpFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsGenerateHeapDumpFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsGenerateThreadDumpFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsGenerateThreadDumpFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsGenerateThreadDumpFuture) 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 DeploymentsGenerateThreadDumpFuture.Result. +func (future *DeploymentsGenerateThreadDumpFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsGenerateThreadDumpFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsGenerateThreadDumpFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsRestartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsRestartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsRestartFuture) 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 DeploymentsRestartFuture.Result. +func (future *DeploymentsRestartFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsRestartFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsStartFuture) 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 DeploymentsStartFuture.Result. +func (future *DeploymentsStartFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStartFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsStartJFRFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsStartJFRFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsStartJFRFuture) 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 DeploymentsStartJFRFuture.Result. +func (future *DeploymentsStartJFRFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStartJFRFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStartJFRFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsStopFuture) 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 DeploymentsStopFuture.Result. +func (future *DeploymentsStopFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStopFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsUpdateFuture) 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 DeploymentsUpdateFuture.Result. +func (future *DeploymentsUpdateFuture) result(client DeploymentsClient) (dr DeploymentResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dr.Response.Response, err = future.GetResult(sender); err == nil && dr.Response.Response.StatusCode != http.StatusNoContent { + dr, err = client.UpdateResponder(dr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsUpdateFuture", "Result", dr.Response.Response, "Failure responding to request") + } + } + return +} + +// DiagnosticParameters diagnostic parameters of diagnostic operations +type DiagnosticParameters struct { + // AppInstance - App instance name + AppInstance *string `json:"appInstance,omitempty"` + // FilePath - Your target file path in your own BYOS + FilePath *string `json:"filePath,omitempty"` + // Duration - Duration of your JFR. 1 min can be represented by 1m or 60s. + Duration *string `json:"duration,omitempty"` +} + +// Error the error code compose of code and message. +type Error struct { + // Code - The code of error. + Code *string `json:"code,omitempty"` + // Message - The message of error. + Message *string `json:"message,omitempty"` +} + +// GitPatternRepository git repository property payload for config server +type GitPatternRepository struct { + // Name - Name of the repository + Name *string `json:"name,omitempty"` + // Pattern - Collection of pattern of the repository + Pattern *[]string `json:"pattern,omitempty"` + // URI - URI of the repository + URI *string `json:"uri,omitempty"` + // Label - Label of the repository + Label *string `json:"label,omitempty"` + // SearchPaths - Searching path of the repository + SearchPaths *[]string `json:"searchPaths,omitempty"` + // Username - Username of git repository basic auth. + Username *string `json:"username,omitempty"` + // Password - Password of git repository basic auth. + Password *string `json:"password,omitempty"` + // HostKey - Public sshKey of git repository. + HostKey *string `json:"hostKey,omitempty"` + // HostKeyAlgorithm - SshKey algorithm of git repository. + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + // PrivateKey - Private sshKey algorithm of git repository. + PrivateKey *string `json:"privateKey,omitempty"` + // StrictHostKeyChecking - Strict host key checking or not. + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +} + +// JarUploadedUserSourceInfo uploaded Jar binary for a deployment +type JarUploadedUserSourceInfo struct { + // RuntimeVersion - Runtime version of the Jar file + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // JvmOptions - JVM parameter + JvmOptions *string `json:"jvmOptions,omitempty"` + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + juusi.Type = TypeJar + objectMap := make(map[string]interface{}) + if juusi.RuntimeVersion != nil { + objectMap["runtimeVersion"] = juusi.RuntimeVersion + } + if juusi.JvmOptions != nil { + objectMap["jvmOptions"] = juusi.JvmOptions + } + if juusi.RelativePath != nil { + objectMap["relativePath"] = juusi.RelativePath + } + if juusi.Version != nil { + objectMap["version"] = juusi.Version + } + if juusi.Type != "" { + objectMap["type"] = juusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return &juusi, true +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return &juusi, true +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &juusi, true +} + +// KeyVaultCertificateProperties properties of certificate imported from key vault. +type KeyVaultCertificateProperties struct { + // VaultURI - The vault uri of user key vault. + VaultURI *string `json:"vaultUri,omitempty"` + // KeyVaultCertName - The certificate name of key vault. + KeyVaultCertName *string `json:"keyVaultCertName,omitempty"` + // CertVersion - The certificate version of key vault. + CertVersion *string `json:"certVersion,omitempty"` + // ExcludePrivateKey - Optional. If set to true, it will not import private key from key vault. + ExcludePrivateKey *bool `json:"excludePrivateKey,omitempty"` + // Thumbprint - READ-ONLY; The thumbprint of certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // Issuer - READ-ONLY; The issuer of certificate. + Issuer *string `json:"issuer,omitempty"` + // IssuedDate - READ-ONLY; The issue date of certificate. + IssuedDate *string `json:"issuedDate,omitempty"` + // ExpirationDate - READ-ONLY; The expiration date of certificate. + ExpirationDate *string `json:"expirationDate,omitempty"` + // ActivateDate - READ-ONLY; The activate date of certificate. + ActivateDate *string `json:"activateDate,omitempty"` + // SubjectName - READ-ONLY; The subject name of certificate. + SubjectName *string `json:"subjectName,omitempty"` + // DNSNames - READ-ONLY; The domain list of certificate. + DNSNames *[]string `json:"dnsNames,omitempty"` + // Type - Possible values include: 'TypeCertificateProperties', 'TypeKeyVaultCertificate', 'TypeContentCertificate' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) MarshalJSON() ([]byte, error) { + kvcp.Type = TypeKeyVaultCertificate + objectMap := make(map[string]interface{}) + if kvcp.VaultURI != nil { + objectMap["vaultUri"] = kvcp.VaultURI + } + if kvcp.KeyVaultCertName != nil { + objectMap["keyVaultCertName"] = kvcp.KeyVaultCertName + } + if kvcp.CertVersion != nil { + objectMap["certVersion"] = kvcp.CertVersion + } + if kvcp.ExcludePrivateKey != nil { + objectMap["excludePrivateKey"] = kvcp.ExcludePrivateKey + } + if kvcp.Type != "" { + objectMap["type"] = kvcp.Type + } + return json.Marshal(objectMap) +} + +// AsKeyVaultCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) { + return &kvcp, true +} + +// AsContentCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) AsContentCertificateProperties() (*ContentCertificateProperties, bool) { + return nil, false +} + +// AsCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) AsCertificateProperties() (*CertificateProperties, bool) { + return nil, false +} + +// AsBasicCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) AsBasicCertificateProperties() (BasicCertificateProperties, bool) { + return &kvcp, true +} + +// LoadedCertificate loaded certificate payload +type LoadedCertificate struct { + // ResourceID - Resource Id of loaded certificate + ResourceID *string `json:"resourceId,omitempty"` + // LoadTrustStore - Indicate whether the certificate will be loaded into default trust store, only work for Java runtime. + LoadTrustStore *bool `json:"loadTrustStore,omitempty"` +} + +// LogFileURLResponse log file URL payload +type LogFileURLResponse struct { + autorest.Response `json:"-"` + // URL - URL of the log file + URL *string `json:"url,omitempty"` +} + +// LogSpecification specifications of the Log for Azure Monitoring +type LogSpecification struct { + // Name - Name of the log + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the log + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Blob duration of the log + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// ManagedIdentityProperties managed identity properties retrieved from ARM request headers. +type ManagedIdentityProperties struct { + // Type - Type of the managed identity. Possible values include: 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned' + Type ManagedIdentityType `json:"type,omitempty"` + // PrincipalID - Principal Id of system-assigned managed identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - Tenant Id of system-assigned managed identity. + TenantID *string `json:"tenantId,omitempty"` +} + +// MetricDimension specifications of the Dimension of metrics +type MetricDimension struct { + // Name - Name of the dimension + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the dimension + DisplayName *string `json:"displayName,omitempty"` + // ToBeExportedForShoebox - Whether this dimension should be included for the Shoebox export scenario + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` +} + +// MetricSpecification specifications of the Metrics for Azure Monitoring +type MetricSpecification struct { + // Name - Name of the metric + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the metric + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Localized friendly description of the metric + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - Unit that makes sense for the metric + Unit *string `json:"unit,omitempty"` + // Category - Name of the metric category that the metric belongs to. A metric can only belong to a single category. + Category *string `json:"category,omitempty"` + // AggregationType - Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. + AggregationType *string `json:"aggregationType,omitempty"` + // SupportedAggregationTypes - Supported aggregation types + SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` + // SupportedTimeGrainTypes - Supported time grain types + SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` + // FillGapWithZero - Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // Dimensions - Dimensions of the metric + Dimensions *[]MetricDimension `json:"dimensions,omitempty"` + // SourceMdmNamespace - Name of the MDM namespace. Optional. + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` +} + +// MonitoringSettingProperties monitoring Setting properties payload +type MonitoringSettingProperties struct { + // ProvisioningState - READ-ONLY; State of the Monitoring Setting. Possible values include: 'MonitoringSettingStateNotAvailable', 'MonitoringSettingStateFailed', 'MonitoringSettingStateSucceeded', 'MonitoringSettingStateUpdating' + ProvisioningState MonitoringSettingState `json:"provisioningState,omitempty"` + // Error - Error when apply Monitoring Setting changes. + Error *Error `json:"error,omitempty"` + // TraceEnabled - Indicates whether enable the trace functionality, which will be deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate if monitoringSettings enabled or not + TraceEnabled *bool `json:"traceEnabled,omitempty"` + // AppInsightsInstrumentationKey - Target application insight instrumentation key, null or whitespace include empty will disable monitoringSettings + AppInsightsInstrumentationKey *string `json:"appInsightsInstrumentationKey,omitempty"` + // AppInsightsSamplingRate - Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0] + AppInsightsSamplingRate *float64 `json:"appInsightsSamplingRate,omitempty"` + // AppInsightsAgentVersions - Indicates the versions of application insight agent + AppInsightsAgentVersions *ApplicationInsightsAgentVersions `json:"appInsightsAgentVersions,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitoringSettingProperties. +func (msp MonitoringSettingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msp.Error != nil { + objectMap["error"] = msp.Error + } + if msp.TraceEnabled != nil { + objectMap["traceEnabled"] = msp.TraceEnabled + } + if msp.AppInsightsInstrumentationKey != nil { + objectMap["appInsightsInstrumentationKey"] = msp.AppInsightsInstrumentationKey + } + if msp.AppInsightsSamplingRate != nil { + objectMap["appInsightsSamplingRate"] = msp.AppInsightsSamplingRate + } + if msp.AppInsightsAgentVersions != nil { + objectMap["appInsightsAgentVersions"] = msp.AppInsightsAgentVersions + } + return json.Marshal(objectMap) +} + +// MonitoringSettingResource monitoring Setting resource +type MonitoringSettingResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Monitoring Setting resource + Properties *MonitoringSettingProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitoringSettingResource. +func (msr MonitoringSettingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msr.Properties != nil { + objectMap["properties"] = msr.Properties + } + if msr.SystemData != nil { + objectMap["systemData"] = msr.SystemData + } + return json.Marshal(objectMap) +} + +// MonitoringSettingsUpdatePatchFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type MonitoringSettingsUpdatePatchFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitoringSettingsClient) (MonitoringSettingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitoringSettingsUpdatePatchFuture) 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 MonitoringSettingsUpdatePatchFuture.Result. +func (future *MonitoringSettingsUpdatePatchFuture) result(client MonitoringSettingsClient) (msr MonitoringSettingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePatchFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + msr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.MonitoringSettingsUpdatePatchFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if msr.Response.Response, err = future.GetResult(sender); err == nil && msr.Response.Response.StatusCode != http.StatusNoContent { + msr, err = client.UpdatePatchResponder(msr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePatchFuture", "Result", msr.Response.Response, "Failure responding to request") + } + } + return +} + +// MonitoringSettingsUpdatePutFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type MonitoringSettingsUpdatePutFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitoringSettingsClient) (MonitoringSettingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitoringSettingsUpdatePutFuture) 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 MonitoringSettingsUpdatePutFuture.Result. +func (future *MonitoringSettingsUpdatePutFuture) result(client MonitoringSettingsClient) (msr MonitoringSettingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePutFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + msr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.MonitoringSettingsUpdatePutFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if msr.Response.Response, err = future.GetResult(sender); err == nil && msr.Response.Response.StatusCode != http.StatusNoContent { + msr, err = client.UpdatePutResponder(msr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePutFuture", "Result", msr.Response.Response, "Failure responding to request") + } + } + return +} + +// NameAvailability name availability result payload +type NameAvailability struct { + autorest.Response `json:"-"` + // NameAvailable - Indicates whether the name is available + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - Reason why the name is not available + Reason *string `json:"reason,omitempty"` + // Message - Message why the name is not available + Message *string `json:"message,omitempty"` +} + +// NameAvailabilityParameters name availability parameters payload +type NameAvailabilityParameters struct { + // Type - Type of the resource to check name availability + Type *string `json:"type,omitempty"` + // Name - Name to be checked + Name *string `json:"name,omitempty"` +} + +// NetCoreZipUploadedUserSourceInfo uploaded Jar binary for a deployment +type NetCoreZipUploadedUserSourceInfo struct { + // NetCoreMainEntryPath - The path to the .NET executable relative to zip root + NetCoreMainEntryPath *string `json:"netCoreMainEntryPath,omitempty"` + // RuntimeVersion - Runtime version of the .Net file + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + nczuusi.Type = TypeNetCoreZip + objectMap := make(map[string]interface{}) + if nczuusi.NetCoreMainEntryPath != nil { + objectMap["netCoreMainEntryPath"] = nczuusi.NetCoreMainEntryPath + } + if nczuusi.RuntimeVersion != nil { + objectMap["runtimeVersion"] = nczuusi.RuntimeVersion + } + if nczuusi.RelativePath != nil { + objectMap["relativePath"] = nczuusi.RelativePath + } + if nczuusi.Version != nil { + objectMap["version"] = nczuusi.Version + } + if nczuusi.Type != "" { + objectMap["type"] = nczuusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return &nczuusi, true +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return &nczuusi, true +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &nczuusi, true +} + +// NetworkProfile service network profile payload +type NetworkProfile struct { + // ServiceRuntimeSubnetID - Fully qualified resource Id of the subnet to host Azure Spring Apps Service Runtime + ServiceRuntimeSubnetID *string `json:"serviceRuntimeSubnetId,omitempty"` + // AppSubnetID - Fully qualified resource Id of the subnet to host customer apps in Azure Spring Apps + AppSubnetID *string `json:"appSubnetId,omitempty"` + // ServiceCidr - Azure Spring Apps service reserved CIDR + ServiceCidr *string `json:"serviceCidr,omitempty"` + // ServiceRuntimeNetworkResourceGroup - Name of the resource group containing network resources of Azure Spring Apps Service Runtime + ServiceRuntimeNetworkResourceGroup *string `json:"serviceRuntimeNetworkResourceGroup,omitempty"` + // AppNetworkResourceGroup - Name of the resource group containing network resources for customer apps in Azure Spring Apps + AppNetworkResourceGroup *string `json:"appNetworkResourceGroup,omitempty"` + // OutboundIPs - READ-ONLY; Desired outbound IP resources for Azure Spring Apps resource. + OutboundIPs *NetworkProfileOutboundIPs `json:"outboundIPs,omitempty"` + // RequiredTraffics - READ-ONLY; Required inbound or outbound traffics for Azure Spring Apps resource. + RequiredTraffics *[]RequiredTraffic `json:"requiredTraffics,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkProfile. +func (np NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if np.ServiceRuntimeSubnetID != nil { + objectMap["serviceRuntimeSubnetId"] = np.ServiceRuntimeSubnetID + } + if np.AppSubnetID != nil { + objectMap["appSubnetId"] = np.AppSubnetID + } + if np.ServiceCidr != nil { + objectMap["serviceCidr"] = np.ServiceCidr + } + if np.ServiceRuntimeNetworkResourceGroup != nil { + objectMap["serviceRuntimeNetworkResourceGroup"] = np.ServiceRuntimeNetworkResourceGroup + } + if np.AppNetworkResourceGroup != nil { + objectMap["appNetworkResourceGroup"] = np.AppNetworkResourceGroup + } + return json.Marshal(objectMap) +} + +// NetworkProfileOutboundIPs desired outbound IP resources for Azure Spring Apps resource. +type NetworkProfileOutboundIPs struct { + // PublicIPs - READ-ONLY; A list of public IP addresses. + PublicIPs *[]string `json:"publicIPs,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkProfileOutboundIPs. +func (npP NetworkProfileOutboundIPs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationDetail operation detail payload +type OperationDetail struct { + // Name - Name of the operation + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - Display of the operation + Display *OperationDisplay `json:"display,omitempty"` + // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'Internal' + ActionType ActionType `json:"actionType,omitempty"` + // Origin - Origin of the operation + Origin *string `json:"origin,omitempty"` + // Properties - Properties of the operation + Properties *OperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDetail. +func (od OperationDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.Name != nil { + objectMap["name"] = od.Name + } + if od.IsDataAction != nil { + objectMap["isDataAction"] = od.IsDataAction + } + if od.Display != nil { + objectMap["display"] = od.Display + } + if od.Origin != nil { + objectMap["origin"] = od.Origin + } + if od.Properties != nil { + objectMap["properties"] = od.Properties + } + return json.Marshal(objectMap) +} + +// OperationDisplay operation display payload +type OperationDisplay struct { + // Provider - Resource provider of the operation + Provider *string `json:"provider,omitempty"` + // Resource - Resource of the operation + Resource *string `json:"resource,omitempty"` + // Operation - Localized friendly name for the operation + Operation *string `json:"operation,omitempty"` + // Description - Localized friendly description for the operation + Description *string `json:"description,omitempty"` +} + +// OperationProperties extra Operation properties +type OperationProperties struct { + // ServiceSpecification - Service specifications of the operation + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// PersistentDisk persistent disk payload +type PersistentDisk struct { + // SizeInGB - Size of the persistent disk in GB + SizeInGB *int32 `json:"sizeInGB,omitempty"` + // UsedInGB - READ-ONLY; Size of the used persistent disk in GB + UsedInGB *int32 `json:"usedInGB,omitempty"` + // MountPath - Mount path of the persistent disk + MountPath *string `json:"mountPath,omitempty"` +} + +// MarshalJSON is the custom marshaler for PersistentDisk. +func (pd PersistentDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pd.SizeInGB != nil { + objectMap["sizeInGB"] = pd.SizeInGB + } + if pd.MountPath != nil { + objectMap["mountPath"] = pd.MountPath + } + return json.Marshal(objectMap) +} + +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags. +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pr.SystemData != nil { + objectMap["systemData"] = pr.SystemData + } + return json.Marshal(objectMap) +} + +// RegenerateTestKeyRequestPayload regenerate test key request payload +type RegenerateTestKeyRequestPayload struct { + // KeyType - Type of the test key. Possible values include: 'Primary', 'Secondary' + KeyType TestKeyType `json:"keyType,omitempty"` +} + +// RequiredTraffic required inbound or outbound traffic for Azure Spring Apps resource. +type RequiredTraffic struct { + // Protocol - READ-ONLY; The protocol of required traffic + Protocol *string `json:"protocol,omitempty"` + // Port - READ-ONLY; The port of required traffic + Port *int32 `json:"port,omitempty"` + // Ips - READ-ONLY; The ip list of required traffic + Ips *[]string `json:"ips,omitempty"` + // Fqdns - READ-ONLY; The FQDN list of required traffic + Fqdns *[]string `json:"fqdns,omitempty"` + // Direction - READ-ONLY; The direction of required traffic. Possible values include: 'Inbound', 'Outbound' + Direction TrafficDirection `json:"direction,omitempty"` +} + +// MarshalJSON is the custom marshaler for RequiredTraffic. +func (rt RequiredTraffic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource the core properties of ARM resources. +type Resource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.SystemData != nil { + objectMap["systemData"] = r.SystemData + } + return json.Marshal(objectMap) +} + +// ResourceRequests deployment resource request payload +type ResourceRequests struct { + // CPU - Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. + CPU *string `json:"cpu,omitempty"` + // Memory - Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + Memory *string `json:"memory,omitempty"` +} + +// ResourceSku describes an available Azure Spring Apps SKU. +type ResourceSku struct { + // ResourceType - Gets the type of resource the SKU applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Name - Gets the name of SKU. + Name *string `json:"name,omitempty"` + // Tier - Gets the tier of SKU. + Tier *string `json:"tier,omitempty"` + // Capacity - Gets the capacity of SKU. + Capacity *SkuCapacity `json:"capacity,omitempty"` + // Locations - Gets the set of locations that the SKU is available. + Locations *[]string `json:"locations,omitempty"` + // LocationInfo - Gets a list of locations and availability zones in those locations where the SKU is available. + LocationInfo *[]ResourceSkuLocationInfo `json:"locationInfo,omitempty"` + // Restrictions - Gets the restrictions because of which SKU cannot be used. This is + // empty if there are no restrictions. + Restrictions *[]ResourceSkuRestrictions `json:"restrictions,omitempty"` +} + +// ResourceSkuCapabilities ... +type ResourceSkuCapabilities struct { + // Name - Gets an invariant to describe the feature. + Name *string `json:"name,omitempty"` + // Value - Gets an invariant if the feature is measured by quantity. + Value *string `json:"value,omitempty"` +} + +// ResourceSkuCollection object that includes an array of Azure Spring Apps SKU and a possible link for +// next set +type ResourceSkuCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resource SKU + Value *[]ResourceSku `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceSkuCollectionIterator provides access to a complete listing of ResourceSku values. +type ResourceSkuCollectionIterator struct { + i int + page ResourceSkuCollectionPage +} + +// 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 *ResourceSkuCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuCollectionIterator.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 *ResourceSkuCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceSkuCollectionIterator) 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 ResourceSkuCollectionIterator) Response() ResourceSkuCollection { + 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 ResourceSkuCollectionIterator) Value() ResourceSku { + if !iter.page.NotDone() { + return ResourceSku{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceSkuCollectionIterator type. +func NewResourceSkuCollectionIterator(page ResourceSkuCollectionPage) ResourceSkuCollectionIterator { + return ResourceSkuCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rsc ResourceSkuCollection) IsEmpty() bool { + return rsc.Value == nil || len(*rsc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rsc ResourceSkuCollection) hasNextLink() bool { + return rsc.NextLink != nil && len(*rsc.NextLink) != 0 +} + +// resourceSkuCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rsc ResourceSkuCollection) resourceSkuCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !rsc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rsc.NextLink))) +} + +// ResourceSkuCollectionPage contains a page of ResourceSku values. +type ResourceSkuCollectionPage struct { + fn func(context.Context, ResourceSkuCollection) (ResourceSkuCollection, error) + rsc ResourceSkuCollection +} + +// 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 *ResourceSkuCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuCollectionPage.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.rsc) + if err != nil { + return err + } + page.rsc = 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 *ResourceSkuCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceSkuCollectionPage) NotDone() bool { + return !page.rsc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceSkuCollectionPage) Response() ResourceSkuCollection { + return page.rsc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceSkuCollectionPage) Values() []ResourceSku { + if page.rsc.IsEmpty() { + return nil + } + return *page.rsc.Value +} + +// Creates a new instance of the ResourceSkuCollectionPage type. +func NewResourceSkuCollectionPage(cur ResourceSkuCollection, getNextPage func(context.Context, ResourceSkuCollection) (ResourceSkuCollection, error)) ResourceSkuCollectionPage { + return ResourceSkuCollectionPage{ + fn: getNextPage, + rsc: cur, + } +} + +// ResourceSkuLocationInfo locations and availability zones where the SKU is available +type ResourceSkuLocationInfo struct { + // Location - Gets location of the SKU + Location *string `json:"location,omitempty"` + // Zones - Gets list of availability zones where the SKU is supported. + Zones *[]string `json:"zones,omitempty"` + // ZoneDetails - Gets details of capabilities available to a SKU in specific zones. + ZoneDetails *[]ResourceSkuZoneDetails `json:"zoneDetails,omitempty"` +} + +// ResourceSkuRestrictionInfo information about the restriction where the SKU cannot be used +type ResourceSkuRestrictionInfo struct { + // Locations - Gets locations where the SKU is restricted + Locations *[]string `json:"locations,omitempty"` + // Zones - Gets list of availability zones where the SKU is restricted. + Zones *[]string `json:"zones,omitempty"` +} + +// ResourceSkuRestrictions restrictions where the SKU cannot be used +type ResourceSkuRestrictions struct { + // Type - Gets the type of restrictions. Possible values include: 'Location', 'Zone' + Type ResourceSkuRestrictionsType `json:"type,omitempty"` + // Values - Gets the value of restrictions. If the restriction type is set to + // location. This would be different locations where the SKU is restricted. + Values *[]string `json:"values,omitempty"` + // RestrictionInfo - Gets the information about the restriction where the SKU cannot be used. + RestrictionInfo *ResourceSkuRestrictionInfo `json:"restrictionInfo,omitempty"` + // ReasonCode - Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: 'QuotaID', 'NotAvailableForSubscription' + ReasonCode ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"` +} + +// ResourceSkuZoneDetails details of capabilities available to a SKU in specific zones +type ResourceSkuZoneDetails struct { + // Name - Gets the set of zones that the SKU is available in with the + // specified capabilities. + Name *[]string `json:"name,omitempty"` + // Capabilities - Gets a list of capabilities that are available for the SKU in the + // specified list of zones. + Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"` +} + +// ResourceUploadDefinition resource upload definition payload +type ResourceUploadDefinition struct { + autorest.Response `json:"-"` + // RelativePath - Source relative path + RelativePath *string `json:"relativePath,omitempty"` + // UploadURL - Upload URL + UploadURL *string `json:"uploadUrl,omitempty"` +} + +// ServiceRegistriesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ServiceRegistriesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceRegistriesClient) (ServiceRegistryResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceRegistriesCreateOrUpdateFuture) 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 ServiceRegistriesCreateOrUpdateFuture.Result. +func (future *ServiceRegistriesCreateOrUpdateFuture) result(client ServiceRegistriesClient) (srr ServiceRegistryResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + srr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServiceRegistriesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if srr.Response.Response, err = future.GetResult(sender); err == nil && srr.Response.Response.StatusCode != http.StatusNoContent { + srr, err = client.CreateOrUpdateResponder(srr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesCreateOrUpdateFuture", "Result", srr.Response.Response, "Failure responding to request") + } + } + return +} + +// ServiceRegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServiceRegistriesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceRegistriesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceRegistriesDeleteFuture) 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 ServiceRegistriesDeleteFuture.Result. +func (future *ServiceRegistriesDeleteFuture) result(client ServiceRegistriesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServiceRegistriesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServiceRegistryInstance collection of instances belong to the Service Registry +type ServiceRegistryInstance struct { + // Name - READ-ONLY; Name of the Service Registry instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the Service Registry instance + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceRegistryInstance. +func (sri ServiceRegistryInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServiceRegistryProperties service Registry properties payload +type ServiceRegistryProperties struct { + // ProvisioningState - READ-ONLY; State of the Service Registry. Possible values include: 'ServiceRegistryProvisioningStateCreating', 'ServiceRegistryProvisioningStateUpdating', 'ServiceRegistryProvisioningStateSucceeded', 'ServiceRegistryProvisioningStateFailed', 'ServiceRegistryProvisioningStateDeleting' + ProvisioningState ServiceRegistryProvisioningState `json:"provisioningState,omitempty"` + // ResourceRequests - The requested resource quantity for required CPU and Memory. + ResourceRequests *ServiceRegistryResourceRequests `json:"resourceRequests,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to Service Registry. + Instances *[]ServiceRegistryInstance `json:"instances,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceRegistryProperties. +func (srp ServiceRegistryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srp.ResourceRequests != nil { + objectMap["resourceRequests"] = srp.ResourceRequests + } + return json.Marshal(objectMap) +} + +// ServiceRegistryResource service Registry resource +type ServiceRegistryResource struct { + autorest.Response `json:"-"` + Properties *ServiceRegistryProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceRegistryResource. +func (srr ServiceRegistryResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srr.Properties != nil { + objectMap["properties"] = srr.Properties + } + if srr.SystemData != nil { + objectMap["systemData"] = srr.SystemData + } + return json.Marshal(objectMap) +} + +// ServiceRegistryResourceCollection object that includes an array of Service Registry resources and a +// possible link for next set +type ServiceRegistryResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Service Registry resources + Value *[]ServiceRegistryResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceRegistryResourceCollectionIterator provides access to a complete listing of +// ServiceRegistryResource values. +type ServiceRegistryResourceCollectionIterator struct { + i int + page ServiceRegistryResourceCollectionPage +} + +// 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 *ServiceRegistryResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistryResourceCollectionIterator.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 *ServiceRegistryResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceRegistryResourceCollectionIterator) 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 ServiceRegistryResourceCollectionIterator) Response() ServiceRegistryResourceCollection { + 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 ServiceRegistryResourceCollectionIterator) Value() ServiceRegistryResource { + if !iter.page.NotDone() { + return ServiceRegistryResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceRegistryResourceCollectionIterator type. +func NewServiceRegistryResourceCollectionIterator(page ServiceRegistryResourceCollectionPage) ServiceRegistryResourceCollectionIterator { + return ServiceRegistryResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srrc ServiceRegistryResourceCollection) IsEmpty() bool { + return srrc.Value == nil || len(*srrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (srrc ServiceRegistryResourceCollection) hasNextLink() bool { + return srrc.NextLink != nil && len(*srrc.NextLink) != 0 +} + +// serviceRegistryResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srrc ServiceRegistryResourceCollection) serviceRegistryResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !srrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srrc.NextLink))) +} + +// ServiceRegistryResourceCollectionPage contains a page of ServiceRegistryResource values. +type ServiceRegistryResourceCollectionPage struct { + fn func(context.Context, ServiceRegistryResourceCollection) (ServiceRegistryResourceCollection, error) + srrc ServiceRegistryResourceCollection +} + +// 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 *ServiceRegistryResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistryResourceCollectionPage.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.srrc) + if err != nil { + return err + } + page.srrc = 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 *ServiceRegistryResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceRegistryResourceCollectionPage) NotDone() bool { + return !page.srrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceRegistryResourceCollectionPage) Response() ServiceRegistryResourceCollection { + return page.srrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceRegistryResourceCollectionPage) Values() []ServiceRegistryResource { + if page.srrc.IsEmpty() { + return nil + } + return *page.srrc.Value +} + +// Creates a new instance of the ServiceRegistryResourceCollectionPage type. +func NewServiceRegistryResourceCollectionPage(cur ServiceRegistryResourceCollection, getNextPage func(context.Context, ServiceRegistryResourceCollection) (ServiceRegistryResourceCollection, error)) ServiceRegistryResourceCollectionPage { + return ServiceRegistryResourceCollectionPage{ + fn: getNextPage, + srrc: cur, + } +} + +// ServiceRegistryResourceRequests resource request payload of Service Registry +type ServiceRegistryResourceRequests struct { + // CPU - READ-ONLY; Cpu allocated to each Service Registry instance + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to each Service Registry instance + Memory *string `json:"memory,omitempty"` + // InstanceCount - READ-ONLY; Instance count of the Service Registry + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceRegistryResourceRequests. +func (srrr ServiceRegistryResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServiceResource service resource +type ServiceResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Service resource + Properties *ClusterResourceProperties `json:"properties,omitempty"` + // Sku - Sku of the Service resource + Sku *Sku `json:"sku,omitempty"` + // Location - The GEO location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the service which is a list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceResource. +func (sr ServiceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Properties != nil { + objectMap["properties"] = sr.Properties + } + if sr.Sku != nil { + objectMap["sku"] = sr.Sku + } + if sr.Location != nil { + objectMap["location"] = sr.Location + } + if sr.Tags != nil { + objectMap["tags"] = sr.Tags + } + if sr.SystemData != nil { + objectMap["systemData"] = sr.SystemData + } + return json.Marshal(objectMap) +} + +// ServiceResourceList object that includes an array of Service resources and a possible link for next set +type ServiceResourceList struct { + autorest.Response `json:"-"` + // Value - Collection of Service resources + Value *[]ServiceResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceResourceListIterator provides access to a complete listing of ServiceResource values. +type ServiceResourceListIterator struct { + i int + page ServiceResourceListPage +} + +// 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 *ServiceResourceListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListIterator.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 *ServiceResourceListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceResourceListIterator) 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 ServiceResourceListIterator) Response() ServiceResourceList { + 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 ServiceResourceListIterator) Value() ServiceResource { + if !iter.page.NotDone() { + return ServiceResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceResourceListIterator type. +func NewServiceResourceListIterator(page ServiceResourceListPage) ServiceResourceListIterator { + return ServiceResourceListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srl ServiceResourceList) IsEmpty() bool { + return srl.Value == nil || len(*srl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (srl ServiceResourceList) hasNextLink() bool { + return srl.NextLink != nil && len(*srl.NextLink) != 0 +} + +// serviceResourceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srl ServiceResourceList) serviceResourceListPreparer(ctx context.Context) (*http.Request, error) { + if !srl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srl.NextLink))) +} + +// ServiceResourceListPage contains a page of ServiceResource values. +type ServiceResourceListPage struct { + fn func(context.Context, ServiceResourceList) (ServiceResourceList, error) + srl ServiceResourceList +} + +// 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 *ServiceResourceListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListPage.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.srl) + if err != nil { + return err + } + page.srl = 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 *ServiceResourceListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceResourceListPage) NotDone() bool { + return !page.srl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceResourceListPage) Response() ServiceResourceList { + return page.srl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceResourceListPage) Values() []ServiceResource { + if page.srl.IsEmpty() { + return nil + } + return *page.srl.Value +} + +// Creates a new instance of the ServiceResourceListPage type. +func NewServiceResourceListPage(cur ServiceResourceList, getNextPage func(context.Context, ServiceResourceList) (ServiceResourceList, error)) ServiceResourceListPage { + return ServiceResourceListPage{ + fn: getNextPage, + srl: cur, + } +} + +// ServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (ServiceResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesCreateOrUpdateFuture) 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 ServicesCreateOrUpdateFuture.Result. +func (future *ServicesCreateOrUpdateFuture) result(client ServicesClient) (sr ServiceResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.CreateOrUpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// ServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesDeleteFuture) 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 ServicesDeleteFuture.Result. +func (future *ServicesDeleteFuture) result(client ServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServiceSpecification service specification payload +type ServiceSpecification struct { + // LogSpecifications - Specifications of the Log for Azure Monitoring + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` + // MetricSpecifications - Specifications of the Metrics for Azure Monitoring + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// ServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (ServiceResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesUpdateFuture) 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 ServicesUpdateFuture.Result. +func (future *ServicesUpdateFuture) result(client ServicesClient) (sr ServiceResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.UpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// Sku sku of Azure Spring Apps +type Sku struct { + // Name - Name of the Sku + Name *string `json:"name,omitempty"` + // Tier - Tier of the Sku + Tier *string `json:"tier,omitempty"` + // Capacity - Current capacity of the target resource + Capacity *int32 `json:"capacity,omitempty"` +} + +// SkuCapacity the SKU capacity +type SkuCapacity struct { + // Minimum - Gets or sets the minimum. + Minimum *int32 `json:"minimum,omitempty"` + // Maximum - Gets or sets the maximum. + Maximum *int32 `json:"maximum,omitempty"` + // Default - Gets or sets the default. + Default *int32 `json:"default,omitempty"` + // ScaleType - Gets or sets the type of the scale. Possible values include: 'SkuScaleTypeNone', 'SkuScaleTypeManual', 'SkuScaleTypeAutomatic' + ScaleType SkuScaleType `json:"scaleType,omitempty"` +} + +// SourceUploadedUserSourceInfo uploaded Java source code binary for a deployment +type SourceUploadedUserSourceInfo struct { + // ArtifactSelector - Selector for the artifact to be used for the deployment for multi-module projects. This should be + // the relative path to the target module/project. + ArtifactSelector *string `json:"artifactSelector,omitempty"` + // RuntimeVersion - Runtime version of the source file + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + suusi.Type = TypeSource + objectMap := make(map[string]interface{}) + if suusi.ArtifactSelector != nil { + objectMap["artifactSelector"] = suusi.ArtifactSelector + } + if suusi.RuntimeVersion != nil { + objectMap["runtimeVersion"] = suusi.RuntimeVersion + } + if suusi.RelativePath != nil { + objectMap["relativePath"] = suusi.RelativePath + } + if suusi.Version != nil { + objectMap["version"] = suusi.Version + } + if suusi.Type != "" { + objectMap["type"] = suusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return &suusi, true +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return &suusi, true +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &suusi, true +} + +// StackProperties kPack ClusterStack properties payload +type StackProperties struct { + // ID - Id of the ClusterStack. + ID *string `json:"id,omitempty"` + // Version - Version of the ClusterStack + Version *string `json:"version,omitempty"` +} + +// SupportedBuildpackResource supported buildpack resource payload +type SupportedBuildpackResource struct { + autorest.Response `json:"-"` + Properties *SupportedBuildpackResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SupportedBuildpackResource. +func (sbr SupportedBuildpackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sbr.Properties != nil { + objectMap["properties"] = sbr.Properties + } + if sbr.SystemData != nil { + objectMap["systemData"] = sbr.SystemData + } + return json.Marshal(objectMap) +} + +// SupportedBuildpackResourceProperties supported buildpack resource properties +type SupportedBuildpackResourceProperties struct { + // BuildpackID - The id of supported buildpack + BuildpackID *string `json:"buildpackId,omitempty"` +} + +// SupportedBuildpacksCollection object that includes an array of supported buildpacks resources and a +// possible link for next set +type SupportedBuildpacksCollection struct { + autorest.Response `json:"-"` + // Value - Collection of supported buildpacks resources + Value *[]SupportedBuildpackResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// SupportedRuntimeVersion supported deployment runtime version descriptor. +type SupportedRuntimeVersion struct { + // Value - The raw value which could be passed to deployment CRUD operations. Possible values include: 'Java8', 'Java11', 'Java17', 'NetCore31' + Value SupportedRuntimeValue `json:"value,omitempty"` + // Platform - The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: 'Java', 'NETCore' + Platform SupportedRuntimePlatform `json:"platform,omitempty"` + // Version - The detailed version (major.minor) of the platform. + Version *string `json:"version,omitempty"` +} + +// SupportedStackResource supported stack resource payload +type SupportedStackResource struct { + autorest.Response `json:"-"` + Properties *SupportedStackResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SupportedStackResource. +func (ssr SupportedStackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssr.Properties != nil { + objectMap["properties"] = ssr.Properties + } + if ssr.SystemData != nil { + objectMap["systemData"] = ssr.SystemData + } + return json.Marshal(objectMap) +} + +// SupportedStackResourceProperties supported stack resource properties +type SupportedStackResourceProperties struct { + // StackID - The id of supported stack + StackID *string `json:"stackId,omitempty"` + // Version - The version of supported stack + Version *string `json:"version,omitempty"` +} + +// SupportedStacksCollection object that includes an array of supported stacks resources and a possible +// link for next set +type SupportedStacksCollection struct { + autorest.Response `json:"-"` + // Value - Collection of supported stacks resources + Value *[]SupportedStackResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'LastModifiedByTypeUser', 'LastModifiedByTypeApplication', 'LastModifiedByTypeManagedIdentity', 'LastModifiedByTypeKey' + LastModifiedByType LastModifiedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource modification (UTC). + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TemporaryDisk temporary disk payload +type TemporaryDisk struct { + // SizeInGB - Size of the temporary disk in GB + SizeInGB *int32 `json:"sizeInGB,omitempty"` + // MountPath - Mount path of the temporary disk + MountPath *string `json:"mountPath,omitempty"` +} + +// TestKeys test keys payload +type TestKeys struct { + autorest.Response `json:"-"` + // PrimaryKey - Primary key + PrimaryKey *string `json:"primaryKey,omitempty"` + // SecondaryKey - Secondary key + SecondaryKey *string `json:"secondaryKey,omitempty"` + // PrimaryTestEndpoint - Primary test endpoint + PrimaryTestEndpoint *string `json:"primaryTestEndpoint,omitempty"` + // SecondaryTestEndpoint - Secondary test endpoint + SecondaryTestEndpoint *string `json:"secondaryTestEndpoint,omitempty"` + // Enabled - Indicates whether the test endpoint feature enabled or not + Enabled *bool `json:"enabled,omitempty"` +} + +// TrackedResource the resource model definition for a ARM tracked top level resource. +type TrackedResource struct { + // Location - The GEO location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the service which is a list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Location != nil { + objectMap["location"] = tr.Location + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.SystemData != nil { + objectMap["systemData"] = tr.SystemData + } + return json.Marshal(objectMap) +} + +// TriggeredBuildResult the build result triggered by a build +type TriggeredBuildResult struct { + // ID - The unique build id of this build result + ID *string `json:"id,omitempty"` +} + +// BasicUploadedUserSourceInfo source with uploaded location +type BasicUploadedUserSourceInfo interface { + AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) + AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) + AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) + AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) +} + +// UploadedUserSourceInfo source with uploaded location +type UploadedUserSourceInfo struct { + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +func unmarshalBasicUploadedUserSourceInfo(body []byte) (BasicUploadedUserSourceInfo, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeJar): + var juusi JarUploadedUserSourceInfo + err := json.Unmarshal(body, &juusi) + return juusi, err + case string(TypeSource): + var suusi SourceUploadedUserSourceInfo + err := json.Unmarshal(body, &suusi) + return suusi, err + case string(TypeNetCoreZip): + var nczuusi NetCoreZipUploadedUserSourceInfo + err := json.Unmarshal(body, &nczuusi) + return nczuusi, err + default: + var uusi UploadedUserSourceInfo + err := json.Unmarshal(body, &uusi) + return uusi, err + } +} +func unmarshalBasicUploadedUserSourceInfoArray(body []byte) ([]BasicUploadedUserSourceInfo, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + uusiArray := make([]BasicUploadedUserSourceInfo, len(rawMessages)) + + for index, rawMessage := range rawMessages { + uusi, err := unmarshalBasicUploadedUserSourceInfo(*rawMessage) + if err != nil { + return nil, err + } + uusiArray[index] = uusi + } + return uusiArray, nil +} + +// MarshalJSON is the custom marshaler for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + uusi.Type = TypeUploadedUserSourceInfo + objectMap := make(map[string]interface{}) + if uusi.RelativePath != nil { + objectMap["relativePath"] = uusi.RelativePath + } + if uusi.Version != nil { + objectMap["version"] = uusi.Version + } + if uusi.Type != "" { + objectMap["type"] = uusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return &uusi, true +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return &uusi, true +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &uusi, true +} + +// BasicUserSourceInfo source information for a deployment +type BasicUserSourceInfo interface { + AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) + AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) + AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) + AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) + AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) + AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) + AsUserSourceInfo() (*UserSourceInfo, bool) +} + +// UserSourceInfo source information for a deployment +type UserSourceInfo struct { + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +func unmarshalBasicUserSourceInfo(body []byte) (BasicUserSourceInfo, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeUploadedUserSourceInfo): + var uusi UploadedUserSourceInfo + err := json.Unmarshal(body, &uusi) + return uusi, err + case string(TypeJar): + var juusi JarUploadedUserSourceInfo + err := json.Unmarshal(body, &juusi) + return juusi, err + case string(TypeSource): + var suusi SourceUploadedUserSourceInfo + err := json.Unmarshal(body, &suusi) + return suusi, err + case string(TypeNetCoreZip): + var nczuusi NetCoreZipUploadedUserSourceInfo + err := json.Unmarshal(body, &nczuusi) + return nczuusi, err + case string(TypeBuildResult): + var brusi BuildResultUserSourceInfo + err := json.Unmarshal(body, &brusi) + return brusi, err + default: + var usi UserSourceInfo + err := json.Unmarshal(body, &usi) + return usi, err + } +} +func unmarshalBasicUserSourceInfoArray(body []byte) ([]BasicUserSourceInfo, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + usiArray := make([]BasicUserSourceInfo, len(rawMessages)) + + for index, rawMessage := range rawMessages { + usi, err := unmarshalBasicUserSourceInfo(*rawMessage) + if err != nil { + return nil, err + } + usiArray[index] = usi + } + return usiArray, nil +} + +// MarshalJSON is the custom marshaler for UserSourceInfo. +func (usi UserSourceInfo) MarshalJSON() ([]byte, error) { + usi.Type = TypeUserSourceInfo + objectMap := make(map[string]interface{}) + if usi.Version != nil { + objectMap["version"] = usi.Version + } + if usi.Type != "" { + objectMap["type"] = usi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return &usi, true +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &usi, true +} + +// ValidationMessages validate messages of the configuration service git repositories +type ValidationMessages struct { + // Name - The name of the configuration service git repository. + Name *string `json:"name,omitempty"` + // Messages - Detailed validation messages. + Messages *[]string `json:"messages,omitempty"` +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/monitoringsettings.go b/services/appplatform/mgmt/2022-04-01/appplatform/monitoringsettings.go new file mode 100644 index 000000000000..1bfb7ddef6e3 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/monitoringsettings.go @@ -0,0 +1,287 @@ +package appplatform + +// 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" +) + +// MonitoringSettingsClient is the REST API for Azure Spring Apps +type MonitoringSettingsClient struct { + BaseClient +} + +// NewMonitoringSettingsClient creates an instance of the MonitoringSettingsClient client. +func NewMonitoringSettingsClient(subscriptionID string) MonitoringSettingsClient { + return NewMonitoringSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMonitoringSettingsClientWithBaseURI creates an instance of the MonitoringSettingsClient 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 NewMonitoringSettingsClientWithBaseURI(baseURI string, subscriptionID string) MonitoringSettingsClient { + return MonitoringSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the Monitoring Setting and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client MonitoringSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result MonitoringSettingResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringSettingsClient.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, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MonitoringSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MonitoringSettingsClient) 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 MonitoringSettingsClient) GetResponder(resp *http.Response) (result MonitoringSettingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePatch update the Monitoring Setting. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// monitoringSettingResource - parameters for the update operation +func (client MonitoringSettingsClient) UpdatePatch(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource MonitoringSettingResource) (result MonitoringSettingsUpdatePatchFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringSettingsClient.UpdatePatch") + 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.UpdatePatchPreparer(ctx, resourceGroupName, serviceName, monitoringSettingResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "UpdatePatch", nil, "Failure preparing request") + return + } + + result, err = client.UpdatePatchSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "UpdatePatch", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePatchPreparer prepares the UpdatePatch request. +func (client MonitoringSettingsClient) UpdatePatchPreparer(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource MonitoringSettingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", pathParameters), + autorest.WithJSON(monitoringSettingResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePatchSender sends the UpdatePatch request. The method will close the +// http.Response Body if it receives an error. +func (client MonitoringSettingsClient) UpdatePatchSender(req *http.Request) (future MonitoringSettingsUpdatePatchFuture, 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 +} + +// UpdatePatchResponder handles the response to the UpdatePatch request. The method always +// closes the http.Response Body. +func (client MonitoringSettingsClient) UpdatePatchResponder(resp *http.Response) (result MonitoringSettingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePut update the Monitoring Setting. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// monitoringSettingResource - parameters for the update operation +func (client MonitoringSettingsClient) UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource MonitoringSettingResource) (result MonitoringSettingsUpdatePutFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringSettingsClient.UpdatePut") + 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: monitoringSettingResource, + Constraints: []validation.Constraint{{Target: "monitoringSettingResource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "monitoringSettingResource.Properties.AppInsightsSamplingRate", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "monitoringSettingResource.Properties.AppInsightsSamplingRate", Name: validation.InclusiveMaximum, Rule: float64(100), Chain: nil}, + {Target: "monitoringSettingResource.Properties.AppInsightsSamplingRate", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.MonitoringSettingsClient", "UpdatePut", err.Error()) + } + + req, err := client.UpdatePutPreparer(ctx, resourceGroupName, serviceName, monitoringSettingResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "UpdatePut", nil, "Failure preparing request") + return + } + + result, err = client.UpdatePutSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "UpdatePut", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePutPreparer prepares the UpdatePut request. +func (client MonitoringSettingsClient) UpdatePutPreparer(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource MonitoringSettingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", pathParameters), + autorest.WithJSON(monitoringSettingResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePutSender sends the UpdatePut request. The method will close the +// http.Response Body if it receives an error. +func (client MonitoringSettingsClient) UpdatePutSender(req *http.Request) (future MonitoringSettingsUpdatePutFuture, 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 +} + +// UpdatePutResponder handles the response to the UpdatePut request. The method always +// closes the http.Response Body. +func (client MonitoringSettingsClient) UpdatePutResponder(resp *http.Response) (result MonitoringSettingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/operations.go b/services/appplatform/mgmt/2022-04-01/appplatform/operations.go new file mode 100644 index 000000000000..c49fedc61430 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/operations.go @@ -0,0 +1,140 @@ +package appplatform + +// 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 REST API for Azure Spring Apps +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available REST API operations of the Microsoft.AppPlatform provider. +func (client OperationsClient) List(ctx context.Context) (result AvailableOperationsPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.ao.Response.Response != nil { + sc = result.ao.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ao.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.ao, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.ao.hasNextLink() && result.ao.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.AppPlatform/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 AvailableOperations, 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 AvailableOperations) (result AvailableOperations, err error) { + req, err := lastResults.availableOperationsPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.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, "appplatform.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.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 AvailableOperationsIterator, 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/appplatform/mgmt/2022-04-01/appplatform/runtimeversions.go b/services/appplatform/mgmt/2022-04-01/appplatform/runtimeversions.go new file mode 100644 index 000000000000..aa98357b8cfc --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/runtimeversions.go @@ -0,0 +1,98 @@ +package appplatform + +// 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" +) + +// RuntimeVersionsClient is the REST API for Azure Spring Apps +type RuntimeVersionsClient struct { + BaseClient +} + +// NewRuntimeVersionsClient creates an instance of the RuntimeVersionsClient client. +func NewRuntimeVersionsClient(subscriptionID string) RuntimeVersionsClient { + return NewRuntimeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRuntimeVersionsClientWithBaseURI creates an instance of the RuntimeVersionsClient 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 NewRuntimeVersionsClientWithBaseURI(baseURI string, subscriptionID string) RuntimeVersionsClient { + return RuntimeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListRuntimeVersions lists all of the available runtime versions supported by Microsoft.AppPlatform provider. +func (client RuntimeVersionsClient) ListRuntimeVersions(ctx context.Context) (result AvailableRuntimeVersions, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuntimeVersionsClient.ListRuntimeVersions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListRuntimeVersionsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.RuntimeVersionsClient", "ListRuntimeVersions", nil, "Failure preparing request") + return + } + + resp, err := client.ListRuntimeVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.RuntimeVersionsClient", "ListRuntimeVersions", resp, "Failure sending request") + return + } + + result, err = client.ListRuntimeVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.RuntimeVersionsClient", "ListRuntimeVersions", resp, "Failure responding to request") + return + } + + return +} + +// ListRuntimeVersionsPreparer prepares the ListRuntimeVersions request. +func (client RuntimeVersionsClient) ListRuntimeVersionsPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.AppPlatform/runtimeVersions"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRuntimeVersionsSender sends the ListRuntimeVersions request. The method will close the +// http.Response Body if it receives an error. +func (client RuntimeVersionsClient) ListRuntimeVersionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListRuntimeVersionsResponder handles the response to the ListRuntimeVersions request. The method always +// closes the http.Response Body. +func (client RuntimeVersionsClient) ListRuntimeVersionsResponder(resp *http.Response) (result AvailableRuntimeVersions, 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/appplatform/mgmt/2022-04-01/appplatform/serviceregistries.go b/services/appplatform/mgmt/2022-04-01/appplatform/serviceregistries.go new file mode 100644 index 000000000000..9dc59f3464ec --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/serviceregistries.go @@ -0,0 +1,393 @@ +package appplatform + +// 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" +) + +// ServiceRegistriesClient is the REST API for Azure Spring Apps +type ServiceRegistriesClient struct { + BaseClient +} + +// NewServiceRegistriesClient creates an instance of the ServiceRegistriesClient client. +func NewServiceRegistriesClient(subscriptionID string) ServiceRegistriesClient { + return NewServiceRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServiceRegistriesClientWithBaseURI creates an instance of the ServiceRegistriesClient 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 NewServiceRegistriesClientWithBaseURI(baseURI string, subscriptionID string) ServiceRegistriesClient { + return ServiceRegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the default Service Registry or update the existing Service Registry. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// serviceRegistryName - the name of Service Registry. +func (client ServiceRegistriesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (result ServiceRegistriesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistriesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, serviceRegistryName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServiceRegistriesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "serviceRegistryName": autorest.Encode("path", serviceRegistryName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceRegistriesClient) CreateOrUpdateSender(req *http.Request) (future ServiceRegistriesCreateOrUpdateFuture, 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 ServiceRegistriesClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceRegistryResource, 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 disable the default Service Registry. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// serviceRegistryName - the name of Service Registry. +func (client ServiceRegistriesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (result ServiceRegistriesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistriesClient.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, serviceName, serviceRegistryName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServiceRegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "serviceRegistryName": autorest.Encode("path", serviceRegistryName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", 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 ServiceRegistriesClient) DeleteSender(req *http.Request) (future ServiceRegistriesDeleteFuture, 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 ServiceRegistriesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the Service Registry and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// serviceRegistryName - the name of Service Registry. +func (client ServiceRegistriesClient) Get(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (result ServiceRegistryResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistriesClient.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, serviceName, serviceRegistryName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServiceRegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "serviceRegistryName": autorest.Encode("path", serviceRegistryName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", 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 ServiceRegistriesClient) 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 ServiceRegistriesClient) GetResponder(resp *http.Response) (result ServiceRegistryResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServiceRegistriesClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceRegistryResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistriesClient.List") + defer func() { + sc := -1 + if result.srrc.Response.Response != nil { + sc = result.srrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.srrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "List", resp, "Failure sending request") + return + } + + result.srrc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "List", resp, "Failure responding to request") + return + } + if result.srrc.hasNextLink() && result.srrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ServiceRegistriesClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", 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 ServiceRegistriesClient) 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 ServiceRegistriesClient) ListResponder(resp *http.Response) (result ServiceRegistryResourceCollection, 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 ServiceRegistriesClient) listNextResults(ctx context.Context, lastResults ServiceRegistryResourceCollection) (result ServiceRegistryResourceCollection, err error) { + req, err := lastResults.serviceRegistryResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "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, "appplatform.ServiceRegistriesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServiceRegistriesClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceRegistryResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistriesClient.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, serviceName) + return +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/services.go b/services/appplatform/mgmt/2022-04-01/appplatform/services.go new file mode 100644 index 000000000000..c22040eaa4b4 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/services.go @@ -0,0 +1,978 @@ +package appplatform + +// 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" +) + +// ServicesClient is the REST API for Azure Spring Apps +type ServicesClient struct { + BaseClient +} + +// NewServicesClient creates an instance of the ServicesClient client. +func NewServicesClient(subscriptionID string) ServicesClient { + return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServicesClientWithBaseURI creates an instance of the ServicesClient 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 NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient { + return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks that the resource name is valid and is not already in use. +// Parameters: +// location - the region +// availabilityParameters - parameters supplied to the operation. +func (client ServicesClient) CheckNameAvailability(ctx context.Context, location string, availabilityParameters NameAvailabilityParameters) (result NameAvailability, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: availabilityParameters, + Constraints: []validation.Constraint{{Target: "availabilityParameters.Type", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "availabilityParameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("appplatform.ServicesClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, location, availabilityParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ServicesClient) CheckNameAvailabilityPreparer(ctx context.Context, location string, availabilityParameters NameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", pathParameters), + autorest.WithJSON(availabilityParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result NameAvailability, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create a new Service or update an exiting Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// resource - parameters for the create or update operation +func (client ServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource) (result ServicesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, resource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", pathParameters), + autorest.WithJSON(resource), + 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 ServicesClient) CreateOrUpdateSender(req *http.Request) (future ServicesCreateOrUpdateFuture, 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 ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string) (result ServicesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.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, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", 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 ServicesClient) DeleteSender(req *http.Request) (future ServicesDeleteFuture, 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 ServicesClient) 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 +} + +// DisableTestEndpoint disable test endpoint functionality for a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) DisableTestEndpoint(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.DisableTestEndpoint") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DisableTestEndpointPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "DisableTestEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.DisableTestEndpointSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "DisableTestEndpoint", resp, "Failure sending request") + return + } + + result, err = client.DisableTestEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "DisableTestEndpoint", resp, "Failure responding to request") + return + } + + return +} + +// DisableTestEndpointPreparer prepares the DisableTestEndpoint request. +func (client ServicesClient) DisableTestEndpointPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/disableTestEndpoint", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableTestEndpointSender sends the DisableTestEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) DisableTestEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisableTestEndpointResponder handles the response to the DisableTestEndpoint request. The method always +// closes the http.Response Body. +func (client ServicesClient) DisableTestEndpointResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// EnableTestEndpoint enable test endpoint functionality for a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) EnableTestEndpoint(ctx context.Context, resourceGroupName string, serviceName string) (result TestKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.EnableTestEndpoint") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.EnableTestEndpointPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "EnableTestEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.EnableTestEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "EnableTestEndpoint", resp, "Failure sending request") + return + } + + result, err = client.EnableTestEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "EnableTestEndpoint", resp, "Failure responding to request") + return + } + + return +} + +// EnableTestEndpointPreparer prepares the EnableTestEndpoint request. +func (client ServicesClient) EnableTestEndpointPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/enableTestEndpoint", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableTestEndpointSender sends the EnableTestEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) EnableTestEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// EnableTestEndpointResponder handles the response to the EnableTestEndpoint request. The method always +// closes the http.Response Body. +func (client ServicesClient) EnableTestEndpointResponder(resp *http.Response) (result TestKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get a Service and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.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, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", 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 ServicesClient) 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 ServicesClient) GetResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +func (client ServicesClient) List(ctx context.Context, resourceGroupName string) (result ServiceResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List") + defer func() { + sc := -1 + if result.srl.Response.Response != nil { + sc = result.srl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.srl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "List", resp, "Failure sending request") + return + } + + result.srl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "List", resp, "Failure responding to request") + return + } + if result.srl.hasNextLink() && result.srl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ServicesClient) ListPreparer(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 = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", 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 ServicesClient) 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 ServicesClient) ListResponder(resp *http.Response) (result ServiceResourceList, 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 ServicesClient) listNextResults(ctx context.Context, lastResults ServiceResourceList) (result ServiceResourceList, err error) { + req, err := lastResults.serviceResourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.ServicesClient", "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, "appplatform.ServicesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServicesClient) ListComplete(ctx context.Context, resourceGroupName string) (result ServiceResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.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) + return +} + +// ListBySubscription handles requests to list all resources in a subscription. +func (client ServicesClient) ListBySubscription(ctx context.Context) (result ServiceResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListBySubscription") + defer func() { + sc := -1 + if result.srl.Response.Response != nil { + sc = result.srl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.srl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.srl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.srl.hasNextLink() && result.srl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ServicesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListBySubscriptionResponder(resp *http.Response) (result ServiceResourceList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client ServicesClient) listBySubscriptionNextResults(ctx context.Context, lastResults ServiceResourceList) (result ServiceResourceList, err error) { + req, err := lastResults.serviceResourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServicesClient) ListBySubscriptionComplete(ctx context.Context) (result ServiceResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// ListTestKeys list test keys for a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) ListTestKeys(ctx context.Context, resourceGroupName string, serviceName string) (result TestKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListTestKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListTestKeysPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListTestKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListTestKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListTestKeys", resp, "Failure sending request") + return + } + + result, err = client.ListTestKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListTestKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListTestKeysPreparer prepares the ListTestKeys request. +func (client ServicesClient) ListTestKeysPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/listTestKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListTestKeysSender sends the ListTestKeys request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListTestKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListTestKeysResponder handles the response to the ListTestKeys request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListTestKeysResponder(resp *http.Response) (result TestKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateTestKey regenerate a test key for a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// regenerateTestKeyRequest - parameters for the operation +func (client ServicesClient) RegenerateTestKey(ctx context.Context, resourceGroupName string, serviceName string, regenerateTestKeyRequest RegenerateTestKeyRequestPayload) (result TestKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.RegenerateTestKey") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RegenerateTestKeyPreparer(ctx, resourceGroupName, serviceName, regenerateTestKeyRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "RegenerateTestKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateTestKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "RegenerateTestKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateTestKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "RegenerateTestKey", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateTestKeyPreparer prepares the RegenerateTestKey request. +func (client ServicesClient) RegenerateTestKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, regenerateTestKeyRequest RegenerateTestKeyRequestPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-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.AppPlatform/Spring/{serviceName}/regenerateTestKey", pathParameters), + autorest.WithJSON(regenerateTestKeyRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateTestKeySender sends the RegenerateTestKey request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) RegenerateTestKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateTestKeyResponder handles the response to the RegenerateTestKey request. The method always +// closes the http.Response Body. +func (client ServicesClient) RegenerateTestKeyResponder(resp *http.Response) (result TestKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update operation to update an exiting Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// resource - parameters for the update operation +func (client ServicesClient) Update(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource) (result ServicesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, resource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ServicesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", pathParameters), + autorest.WithJSON(resource), + 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 ServicesClient) UpdateSender(req *http.Request) (future ServicesUpdateFuture, 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 ServicesClient) UpdateResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/appplatform/mgmt/2022-04-01/appplatform/skus.go b/services/appplatform/mgmt/2022-04-01/appplatform/skus.go new file mode 100644 index 000000000000..edb8327c21f1 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/skus.go @@ -0,0 +1,144 @@ +package appplatform + +// 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" +) + +// SkusClient is the REST API for Azure Spring Apps +type SkusClient struct { + BaseClient +} + +// NewSkusClient creates an instance of the SkusClient client. +func NewSkusClient(subscriptionID string) SkusClient { + return NewSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSkusClientWithBaseURI creates an instance of the SkusClient 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 NewSkusClientWithBaseURI(baseURI string, subscriptionID string) SkusClient { + return SkusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available skus of the Microsoft.AppPlatform provider. +func (client SkusClient) List(ctx context.Context) (result ResourceSkuCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") + defer func() { + sc := -1 + if result.rsc.Response.Response != nil { + sc = result.rsc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rsc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "List", resp, "Failure sending request") + return + } + + result.rsc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "List", resp, "Failure responding to request") + return + } + if result.rsc.hasNextLink() && result.rsc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus", 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 SkusClient) 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 SkusClient) ListResponder(resp *http.Response) (result ResourceSkuCollection, 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 SkusClient) listNextResults(ctx context.Context, lastResults ResourceSkuCollection) (result ResourceSkuCollection, err error) { + req, err := lastResults.resourceSkuCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.SkusClient", "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, "appplatform.SkusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SkusClient) ListComplete(ctx context.Context) (result ResourceSkuCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.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/appplatform/mgmt/2022-04-01/appplatform/version.go b/services/appplatform/mgmt/2022-04-01/appplatform/version.go new file mode 100644 index 000000000000..a109fc278a76 --- /dev/null +++ b/services/appplatform/mgmt/2022-04-01/appplatform/version.go @@ -0,0 +1,19 @@ +package appplatform + +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() + " appplatform/2022-04-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/CHANGELOG.md b/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/CHANGELOG.md index 52911e4cc5e4..16f464ac4bca 100644 --- a/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/CHANGELOG.md +++ b/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/CHANGELOG.md @@ -1,2 +1,20 @@ -# Change History +# Unreleased +## Additive Changes + +### New Constants + +1. ActionType.Internal + +### New Funcs + +1. OperationDetail.MarshalJSON() ([]byte, error) +1. PossibleActionTypeValues() []ActionType + +### Struct Changes + +#### New Struct Fields + +1. MetricDimension.ToBeExportedForShoebox +1. MetricSpecification.SourceMdmNamespace +1. OperationDetail.ActionType diff --git a/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/_meta.json b/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/_meta.json index fc8bec7dd50e..82febde8293a 100644 --- a/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/_meta.json +++ b/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/_meta.json @@ -1,5 +1,5 @@ { - "commit": "92ab22b49bd085116af0c61fada2c6c360702e9e", + "commit": "1be34c2955526679d441bda4fa40744b5ee5e1b1", "readme": "/_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", "tag": "package-preview-2020-11", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/enums.go b/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/enums.go index 6d83c7e3ff6f..2338763dfe94 100644 --- a/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/enums.go +++ b/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/enums.go @@ -6,6 +6,19 @@ package appplatform // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // Internal ... + Internal ActionType = "Internal" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{Internal} +} + // AppResourceProvisioningState enumerates the values for app resource provisioning state. type AppResourceProvisioningState string diff --git a/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/models.go b/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/models.go index f6471952adfe..8aa349f6f91c 100644 --- a/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/models.go +++ b/services/preview/appplatform/mgmt/2020-11-01-preview/appplatform/models.go @@ -238,14 +238,14 @@ type AppResourceProperties struct { Fqdn *string `json:"fqdn,omitempty"` // HTTPSOnly - Indicate if only https is allowed. HTTPSOnly *bool `json:"httpsOnly,omitempty"` - // EnableEndToEndTLS - Indicate if end to end TLS is enabled. - EnableEndToEndTLS *bool `json:"enableEndToEndTLS,omitempty"` // CreatedTime - READ-ONLY; Date time when the resource is created CreatedTime *date.Time `json:"createdTime,omitempty"` // TemporaryDisk - Temporary disk settings TemporaryDisk *TemporaryDisk `json:"temporaryDisk,omitempty"` // PersistentDisk - Persistent disk settings PersistentDisk *PersistentDisk `json:"persistentDisk,omitempty"` + // EnableEndToEndTLS - Indicate if end to end TLS is enabled. + EnableEndToEndTLS *bool `json:"enableEndToEndTLS,omitempty"` } // MarshalJSON is the custom marshaler for AppResourceProperties. @@ -263,15 +263,15 @@ func (arp AppResourceProperties) MarshalJSON() ([]byte, error) { if arp.HTTPSOnly != nil { objectMap["httpsOnly"] = arp.HTTPSOnly } - if arp.EnableEndToEndTLS != nil { - objectMap["enableEndToEndTLS"] = arp.EnableEndToEndTLS - } if arp.TemporaryDisk != nil { objectMap["temporaryDisk"] = arp.TemporaryDisk } if arp.PersistentDisk != nil { objectMap["persistentDisk"] = arp.PersistentDisk } + if arp.EnableEndToEndTLS != nil { + objectMap["enableEndToEndTLS"] = arp.EnableEndToEndTLS + } return json.Marshal(objectMap) } @@ -2397,6 +2397,8 @@ type MetricDimension struct { Name *string `json:"name,omitempty"` // DisplayName - Localized friendly display name of the dimension DisplayName *string `json:"displayName,omitempty"` + // ToBeExportedForShoebox - Whether this dimension should be included for the Shoebox export scenario + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` } // MetricSpecification specifications of the Metrics for Azure Monitoring @@ -2421,6 +2423,8 @@ type MetricSpecification struct { FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` // Dimensions - Dimensions of the metric Dimensions *[]MetricDimension `json:"dimensions,omitempty"` + // SourceMdmNamespace - Name of the MDM namespace. Optional. + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` } // MonitoringSettingProperties monitoring Setting properties payload @@ -2646,12 +2650,35 @@ type OperationDetail struct { IsDataAction *bool `json:"isDataAction,omitempty"` // Display - Display of the operation Display *OperationDisplay `json:"display,omitempty"` + // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'Internal' + ActionType ActionType `json:"actionType,omitempty"` // Origin - Origin of the operation Origin *string `json:"origin,omitempty"` // Properties - Properties of the operation Properties *OperationProperties `json:"properties,omitempty"` } +// MarshalJSON is the custom marshaler for OperationDetail. +func (od OperationDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.Name != nil { + objectMap["name"] = od.Name + } + if od.IsDataAction != nil { + objectMap["isDataAction"] = od.IsDataAction + } + if od.Display != nil { + objectMap["display"] = od.Display + } + if od.Origin != nil { + objectMap["origin"] = od.Origin + } + if od.Properties != nil { + objectMap["properties"] = od.Properties + } + return json.Marshal(objectMap) +} + // OperationDisplay operation display payload type OperationDisplay struct { // Provider - Resource provider of the operation diff --git a/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/CHANGELOG.md b/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/CHANGELOG.md index 52911e4cc5e4..535e52fa359c 100644 --- a/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/CHANGELOG.md +++ b/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/CHANGELOG.md @@ -1,2 +1,19 @@ -# Change History +# Unreleased +## Additive Changes + +### New Constants + +1. ActionType.ActionTypeInternal + +### New Funcs + +1. OperationDetail.MarshalJSON() ([]byte, error) +1. PossibleActionTypeValues() []ActionType + +### Struct Changes + +#### New Struct Fields + +1. MetricSpecification.SourceMdmNamespace +1. OperationDetail.ActionType diff --git a/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/_meta.json b/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/_meta.json index 268fbc2e98d7..b12a0542d2d0 100644 --- a/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/_meta.json +++ b/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/_meta.json @@ -1,5 +1,5 @@ { - "commit": "f9883569df850be792a37df17a1a28a5bdcdfc39", + "commit": "1be34c2955526679d441bda4fa40744b5ee5e1b1", "readme": "/_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", "tag": "package-preview-2021-06", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/enums.go b/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/enums.go index fec3ec77be59..6787d986046a 100644 --- a/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/enums.go +++ b/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/enums.go @@ -6,6 +6,19 @@ package appplatform // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeInternal ... + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeInternal} +} + // AppResourceProvisioningState enumerates the values for app resource provisioning state. type AppResourceProvisioningState string diff --git a/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/models.go b/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/models.go index c1cffcbab88a..5b50c3407c32 100644 --- a/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/models.go +++ b/services/preview/appplatform/mgmt/2021-06-01-preview/appplatform/models.go @@ -2450,6 +2450,8 @@ type MetricSpecification struct { FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` // Dimensions - Dimensions of the metric Dimensions *[]MetricDimension `json:"dimensions,omitempty"` + // SourceMdmNamespace - Name of the MDM namespace. Optional. + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` } // MonitoringSettingProperties monitoring Setting properties payload @@ -2675,12 +2677,35 @@ type OperationDetail struct { IsDataAction *bool `json:"isDataAction,omitempty"` // Display - Display of the operation Display *OperationDisplay `json:"display,omitempty"` + // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'ActionTypeInternal' + ActionType ActionType `json:"actionType,omitempty"` // Origin - Origin of the operation Origin *string `json:"origin,omitempty"` // Properties - Properties of the operation Properties *OperationProperties `json:"properties,omitempty"` } +// MarshalJSON is the custom marshaler for OperationDetail. +func (od OperationDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.Name != nil { + objectMap["name"] = od.Name + } + if od.IsDataAction != nil { + objectMap["isDataAction"] = od.IsDataAction + } + if od.Display != nil { + objectMap["display"] = od.Display + } + if od.Origin != nil { + objectMap["origin"] = od.Origin + } + if od.Properties != nil { + objectMap["properties"] = od.Properties + } + return json.Marshal(objectMap) +} + // OperationDisplay operation display payload type OperationDisplay struct { // Provider - Resource provider of the operation diff --git a/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/CHANGELOG.md b/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/CHANGELOG.md index 52911e4cc5e4..75b874db44bd 100644 --- a/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/CHANGELOG.md +++ b/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/CHANGELOG.md @@ -1,2 +1,20 @@ -# Change History +# Unreleased +## Additive Changes + +### New Constants + +1. ActionType.ActionTypeInternal +1. ProvisioningState.ProvisioningStateStarting +1. ProvisioningState.ProvisioningStateStopping + +### New Funcs + +1. OperationDetail.MarshalJSON() ([]byte, error) +1. PossibleActionTypeValues() []ActionType + +### Struct Changes + +#### New Struct Fields + +1. OperationDetail.ActionType diff --git a/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/_meta.json b/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/_meta.json index bee21af08ee9..807b9c8fd724 100644 --- a/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/_meta.json +++ b/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/_meta.json @@ -1,5 +1,5 @@ { - "commit": "547fc2c120bac50455ab85831747d7041a2cc4ea", + "commit": "1be34c2955526679d441bda4fa40744b5ee5e1b1", "readme": "/_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", "tag": "package-preview-2021-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/enums.go b/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/enums.go index 0f4b6aabd4b7..ebe3802cabfc 100644 --- a/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/enums.go +++ b/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/enums.go @@ -6,6 +6,19 @@ package appplatform // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeInternal ... + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeInternal} +} + // AppResourceProvisioningState enumerates the values for app resource provisioning state. type AppResourceProvisioningState string @@ -180,6 +193,10 @@ const ( ProvisioningStateMoveFailed ProvisioningState = "MoveFailed" // ProvisioningStateMoving ... ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateStarting ... + ProvisioningStateStarting ProvisioningState = "Starting" + // ProvisioningStateStopping ... + ProvisioningStateStopping ProvisioningState = "Stopping" // ProvisioningStateSucceeded ... ProvisioningStateSucceeded ProvisioningState = "Succeeded" // ProvisioningStateUpdating ... @@ -188,7 +205,7 @@ const ( // PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoved, ProvisioningStateMoveFailed, ProvisioningStateMoving, ProvisioningStateSucceeded, ProvisioningStateUpdating} + return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoved, ProvisioningStateMoveFailed, ProvisioningStateMoving, ProvisioningStateStarting, ProvisioningStateStopping, ProvisioningStateSucceeded, ProvisioningStateUpdating} } // ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code. diff --git a/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/models.go b/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/models.go index 160a0fde43ae..ffac19e8174b 100644 --- a/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/models.go +++ b/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/models.go @@ -1400,7 +1400,7 @@ type CloudErrorBody struct { // ClusterResourceProperties service properties payload type ClusterResourceProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the Service. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving', 'ProvisioningStateMoved', 'ProvisioningStateMoveFailed' + // ProvisioningState - READ-ONLY; Provisioning state of the Service. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateStarting', 'ProvisioningStateStopping', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving', 'ProvisioningStateMoved', 'ProvisioningStateMoveFailed' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` // NetworkProfile - Network profile of the Service NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` @@ -3241,12 +3241,35 @@ type OperationDetail struct { IsDataAction *bool `json:"isDataAction,omitempty"` // Display - Display of the operation Display *OperationDisplay `json:"display,omitempty"` + // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'ActionTypeInternal' + ActionType ActionType `json:"actionType,omitempty"` // Origin - Origin of the operation Origin *string `json:"origin,omitempty"` // Properties - Properties of the operation Properties *OperationProperties `json:"properties,omitempty"` } +// MarshalJSON is the custom marshaler for OperationDetail. +func (od OperationDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.Name != nil { + objectMap["name"] = od.Name + } + if od.IsDataAction != nil { + objectMap["isDataAction"] = od.IsDataAction + } + if od.Display != nil { + objectMap["display"] = od.Display + } + if od.Origin != nil { + objectMap["origin"] = od.Origin + } + if od.Properties != nil { + objectMap["properties"] = od.Properties + } + return json.Marshal(objectMap) +} + // OperationDisplay operation display payload type OperationDisplay struct { // Provider - Resource provider of the operation diff --git a/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/CHANGELOG.md b/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/CHANGELOG.md index 52911e4cc5e4..495bb62cfa45 100644 --- a/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/CHANGELOG.md +++ b/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/CHANGELOG.md @@ -1,2 +1,35 @@ -# Change History +# Unreleased +## Breaking Changes + +### Signature Changes + +#### Funcs + +1. BuildServiceAgentPoolClient.UpdatePut + - Params + - From: context.Context, string, string, string, string, BuildServiceAgentPoolSizeProperties + - To: context.Context, string, string, string, string, BuildServiceAgentPoolResource +1. BuildServiceAgentPoolClient.UpdatePutPreparer + - Params + - From: context.Context, string, string, string, string, BuildServiceAgentPoolSizeProperties + - To: context.Context, string, string, string, string, BuildServiceAgentPoolResource + +## Additive Changes + +### New Constants + +1. ActionType.ActionTypeInternal +1. ProvisioningState.ProvisioningStateStarting +1. ProvisioningState.ProvisioningStateStopping + +### New Funcs + +1. OperationDetail.MarshalJSON() ([]byte, error) +1. PossibleActionTypeValues() []ActionType + +### Struct Changes + +#### New Struct Fields + +1. OperationDetail.ActionType diff --git a/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/_meta.json b/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/_meta.json index b43d8656d130..5e8cb1fec4e0 100644 --- a/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/_meta.json +++ b/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3e1f462ff6a7daa705ac58f1772dd5c429bb8d2e", + "commit": "1be34c2955526679d441bda4fa40744b5ee5e1b1", "readme": "/_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", "tag": "package-preview-2022-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/appplatformapi/interfaces.go b/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/appplatformapi/interfaces.go index 95840c0c8cab..d8e0e4389650 100644 --- a/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/appplatformapi/interfaces.go +++ b/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/appplatformapi/interfaces.go @@ -115,7 +115,7 @@ type BuildServiceAgentPoolClientAPI interface { Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string) (result appplatform.BuildServiceAgentPoolResource, err error) List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuildServiceAgentPoolResourceCollectionPage, err error) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuildServiceAgentPoolResourceCollectionIterator, err error) - UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string, poolSize appplatform.BuildServiceAgentPoolSizeProperties) (result appplatform.BuildServiceAgentPoolUpdatePutFuture, err error) + UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string, agentPoolResource appplatform.BuildServiceAgentPoolResource) (result appplatform.BuildServiceAgentPoolUpdatePutFuture, err error) } var _ BuildServiceAgentPoolClientAPI = (*appplatform.BuildServiceAgentPoolClient)(nil) diff --git a/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/buildserviceagentpool.go b/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/buildserviceagentpool.go index f418305586f6..10ba4fa2de68 100644 --- a/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/buildserviceagentpool.go +++ b/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/buildserviceagentpool.go @@ -240,8 +240,8 @@ func (client BuildServiceAgentPoolClient) ListComplete(ctx context.Context, reso // serviceName - the name of the Service resource. // buildServiceName - the name of the build service resource. // agentPoolName - the name of the build service agent pool resource. -// poolSize - parameters for the update operation -func (client BuildServiceAgentPoolClient) UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string, poolSize BuildServiceAgentPoolSizeProperties) (result BuildServiceAgentPoolUpdatePutFuture, err error) { +// agentPoolResource - parameters for the update operation +func (client BuildServiceAgentPoolClient) UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string, agentPoolResource BuildServiceAgentPoolResource) (result BuildServiceAgentPoolUpdatePutFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolClient.UpdatePut") defer func() { @@ -252,7 +252,7 @@ func (client BuildServiceAgentPoolClient) UpdatePut(ctx context.Context, resourc tracing.EndSpan(ctx, sc, err) }() } - req, err := client.UpdatePutPreparer(ctx, resourceGroupName, serviceName, buildServiceName, agentPoolName, poolSize) + req, err := client.UpdatePutPreparer(ctx, resourceGroupName, serviceName, buildServiceName, agentPoolName, agentPoolResource) if err != nil { err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "UpdatePut", nil, "Failure preparing request") return @@ -268,7 +268,7 @@ func (client BuildServiceAgentPoolClient) UpdatePut(ctx context.Context, resourc } // UpdatePutPreparer prepares the UpdatePut request. -func (client BuildServiceAgentPoolClient) UpdatePutPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string, poolSize BuildServiceAgentPoolSizeProperties) (*http.Request, error) { +func (client BuildServiceAgentPoolClient) UpdatePutPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string, agentPoolResource BuildServiceAgentPoolResource) (*http.Request, error) { pathParameters := map[string]interface{}{ "agentPoolName": autorest.Encode("path", agentPoolName), "buildServiceName": autorest.Encode("path", buildServiceName), @@ -282,14 +282,12 @@ func (client BuildServiceAgentPoolClient) UpdatePutPreparer(ctx context.Context, "api-version": APIVersion, } - poolSize.CPU = nil - poolSize.Memory = 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.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", pathParameters), - autorest.WithJSON(poolSize), + autorest.WithJSON(agentPoolResource), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/enums.go b/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/enums.go index 0ebb2f1f703e..2b7bdae0196d 100644 --- a/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/enums.go +++ b/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/enums.go @@ -6,6 +6,19 @@ package appplatform // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // ActionTypeInternal ... + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ActionTypeInternal} +} + // APIPortalProvisioningState enumerates the values for api portal provisioning state. type APIPortalProvisioningState string @@ -401,6 +414,10 @@ const ( ProvisioningStateMoveFailed ProvisioningState = "MoveFailed" // ProvisioningStateMoving ... ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateStarting ... + ProvisioningStateStarting ProvisioningState = "Starting" + // ProvisioningStateStopping ... + ProvisioningStateStopping ProvisioningState = "Stopping" // ProvisioningStateSucceeded ... ProvisioningStateSucceeded ProvisioningState = "Succeeded" // ProvisioningStateUpdating ... @@ -409,7 +426,7 @@ const ( // PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoved, ProvisioningStateMoveFailed, ProvisioningStateMoving, ProvisioningStateSucceeded, ProvisioningStateUpdating} + return []ProvisioningState{ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoved, ProvisioningStateMoveFailed, ProvisioningStateMoving, ProvisioningStateStarting, ProvisioningStateStopping, ProvisioningStateSucceeded, ProvisioningStateUpdating} } // ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code. diff --git a/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/models.go b/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/models.go index f609b068a880..d37576a4549a 100644 --- a/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/models.go +++ b/services/preview/appplatform/mgmt/2022-01-01-preview/appplatform/models.go @@ -3712,7 +3712,7 @@ type CloudErrorBody struct { // ClusterResourceProperties service properties payload type ClusterResourceProperties struct { - // ProvisioningState - READ-ONLY; Provisioning state of the Service. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving', 'ProvisioningStateMoved', 'ProvisioningStateMoveFailed' + // ProvisioningState - READ-ONLY; Provisioning state of the Service. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateStarting', 'ProvisioningStateStopping', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving', 'ProvisioningStateMoved', 'ProvisioningStateMoveFailed' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` // NetworkProfile - Network profile of the Service NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` @@ -7251,12 +7251,35 @@ type OperationDetail struct { IsDataAction *bool `json:"isDataAction,omitempty"` // Display - Display of the operation Display *OperationDisplay `json:"display,omitempty"` + // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'ActionTypeInternal' + ActionType ActionType `json:"actionType,omitempty"` // Origin - Origin of the operation Origin *string `json:"origin,omitempty"` // Properties - Properties of the operation Properties *OperationProperties `json:"properties,omitempty"` } +// MarshalJSON is the custom marshaler for OperationDetail. +func (od OperationDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.Name != nil { + objectMap["name"] = od.Name + } + if od.IsDataAction != nil { + objectMap["isDataAction"] = od.IsDataAction + } + if od.Display != nil { + objectMap["display"] = od.Display + } + if od.Origin != nil { + objectMap["origin"] = od.Origin + } + if od.Properties != nil { + objectMap["properties"] = od.Properties + } + return json.Marshal(objectMap) +} + // OperationDisplay operation display payload type OperationDisplay struct { // Provider - Resource provider of the operation diff --git a/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/CHANGELOG.md b/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/CHANGELOG.md +++ b/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/_meta.json b/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/_meta.json index 78913da4cb5a..41a89c462791 100644 --- a/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/_meta.json +++ b/services/preview/appplatform/mgmt/2022-03-01-preview/appplatform/_meta.json @@ -1,5 +1,5 @@ { - "commit": "f7f8f5bd19939b4a11ea626f266a362b4dd5b626", + "commit": "1be34c2955526679d441bda4fa40744b5ee5e1b1", "readme": "/_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", "tag": "package-preview-2022-03", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/CHANGELOG.md b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/_meta.json b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/_meta.json new file mode 100644 index 000000000000..b61f8fb2d79c --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "1be34c2955526679d441bda4fa40744b5ee5e1b1", + "readme": "/_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", + "tag": "package-preview-2022-05", + "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-preview-2022-05 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/appplatform/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apiportalcustomdomains.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apiportalcustomdomains.go new file mode 100644 index 000000000000..7db1905ef2e6 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apiportalcustomdomains.go @@ -0,0 +1,404 @@ +package appplatform + +// 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" +) + +// APIPortalCustomDomainsClient is the REST API for Azure Spring Apps +type APIPortalCustomDomainsClient struct { + BaseClient +} + +// NewAPIPortalCustomDomainsClient creates an instance of the APIPortalCustomDomainsClient client. +func NewAPIPortalCustomDomainsClient(subscriptionID string) APIPortalCustomDomainsClient { + return NewAPIPortalCustomDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAPIPortalCustomDomainsClientWithBaseURI creates an instance of the APIPortalCustomDomainsClient 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 NewAPIPortalCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) APIPortalCustomDomainsClient { + return APIPortalCustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update the API portal custom domain. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// APIPortalName - the name of API portal. +// domainName - the name of the API portal custom domain. +// APIPortalCustomDomainResource - the API portal custom domain for the create or update operation +func (client APIPortalCustomDomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, domainName string, APIPortalCustomDomainResource APIPortalCustomDomainResource) (result APIPortalCustomDomainsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalCustomDomainsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, APIPortalName, domainName, APIPortalCustomDomainResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client APIPortalCustomDomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, domainName string, APIPortalCustomDomainResource APIPortalCustomDomainResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiPortalName": autorest.Encode("path", APIPortalName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", pathParameters), + autorest.WithJSON(APIPortalCustomDomainResource), + 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 APIPortalCustomDomainsClient) CreateOrUpdateSender(req *http.Request) (future APIPortalCustomDomainsCreateOrUpdateFuture, 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 APIPortalCustomDomainsClient) CreateOrUpdateResponder(resp *http.Response) (result APIPortalCustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the API portal custom domain. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// APIPortalName - the name of API portal. +// domainName - the name of the API portal custom domain. +func (client APIPortalCustomDomainsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, domainName string) (result APIPortalCustomDomainsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalCustomDomainsClient.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, serviceName, APIPortalName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client APIPortalCustomDomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiPortalName": autorest.Encode("path", APIPortalName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client APIPortalCustomDomainsClient) DeleteSender(req *http.Request) (future APIPortalCustomDomainsDeleteFuture, 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 APIPortalCustomDomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the API portal custom domain. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// APIPortalName - the name of API portal. +// domainName - the name of the API portal custom domain. +func (client APIPortalCustomDomainsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, domainName string) (result APIPortalCustomDomainResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalCustomDomainsClient.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, serviceName, APIPortalName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client APIPortalCustomDomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiPortalName": autorest.Encode("path", APIPortalName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client APIPortalCustomDomainsClient) 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 APIPortalCustomDomainsClient) GetResponder(resp *http.Response) (result APIPortalCustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handle requests to list all API portal custom domains. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// APIPortalName - the name of API portal. +func (client APIPortalCustomDomainsClient) List(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string) (result APIPortalCustomDomainResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalCustomDomainsClient.List") + defer func() { + sc := -1 + if result.apcdrc.Response.Response != nil { + sc = result.apcdrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, APIPortalName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.apcdrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsClient", "List", resp, "Failure sending request") + return + } + + result.apcdrc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsClient", "List", resp, "Failure responding to request") + return + } + if result.apcdrc.hasNextLink() && result.apcdrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client APIPortalCustomDomainsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiPortalName": autorest.Encode("path", APIPortalName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains", 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 APIPortalCustomDomainsClient) 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 APIPortalCustomDomainsClient) ListResponder(resp *http.Response) (result APIPortalCustomDomainResourceCollection, 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 APIPortalCustomDomainsClient) listNextResults(ctx context.Context, lastResults APIPortalCustomDomainResourceCollection) (result APIPortalCustomDomainResourceCollection, err error) { + req, err := lastResults.aPIPortalCustomDomainResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsClient", "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, "appplatform.APIPortalCustomDomainsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client APIPortalCustomDomainsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string) (result APIPortalCustomDomainResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalCustomDomainsClient.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, serviceName, APIPortalName) + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apiportals.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apiportals.go new file mode 100644 index 000000000000..95fc3eda6bf6 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apiportals.go @@ -0,0 +1,484 @@ +package appplatform + +// 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" +) + +// APIPortalsClient is the REST API for Azure Spring Apps +type APIPortalsClient struct { + BaseClient +} + +// NewAPIPortalsClient creates an instance of the APIPortalsClient client. +func NewAPIPortalsClient(subscriptionID string) APIPortalsClient { + return NewAPIPortalsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAPIPortalsClientWithBaseURI creates an instance of the APIPortalsClient 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 NewAPIPortalsClientWithBaseURI(baseURI string, subscriptionID string) APIPortalsClient { + return APIPortalsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the default API portal or update the existing API portal. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// APIPortalName - the name of API portal. +// APIPortalResource - the API portal for the create or update operation +func (client APIPortalsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, APIPortalResource APIPortalResource) (result APIPortalsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, APIPortalName, APIPortalResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client APIPortalsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, APIPortalResource APIPortalResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiPortalName": autorest.Encode("path", APIPortalName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", pathParameters), + autorest.WithJSON(APIPortalResource), + 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 APIPortalsClient) CreateOrUpdateSender(req *http.Request) (future APIPortalsCreateOrUpdateFuture, 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 APIPortalsClient) CreateOrUpdateResponder(resp *http.Response) (result APIPortalResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the default API portal. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// APIPortalName - the name of API portal. +func (client APIPortalsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string) (result APIPortalsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalsClient.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, serviceName, APIPortalName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client APIPortalsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiPortalName": autorest.Encode("path", APIPortalName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", 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 APIPortalsClient) DeleteSender(req *http.Request) (future APIPortalsDeleteFuture, 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 APIPortalsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the API portal and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// APIPortalName - the name of API portal. +func (client APIPortalsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string) (result APIPortalResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalsClient.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, serviceName, APIPortalName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client APIPortalsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiPortalName": autorest.Encode("path", APIPortalName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}", 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 APIPortalsClient) 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 APIPortalsClient) GetResponder(resp *http.Response) (result APIPortalResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client APIPortalsClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result APIPortalResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalsClient.List") + defer func() { + sc := -1 + if result.aprc.Response.Response != nil { + sc = result.aprc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aprc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "List", resp, "Failure sending request") + return + } + + result.aprc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "List", resp, "Failure responding to request") + return + } + if result.aprc.hasNextLink() && result.aprc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client APIPortalsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals", 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 APIPortalsClient) 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 APIPortalsClient) ListResponder(resp *http.Response) (result APIPortalResourceCollection, 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 APIPortalsClient) listNextResults(ctx context.Context, lastResults APIPortalResourceCollection) (result APIPortalResourceCollection, err error) { + req, err := lastResults.aPIPortalResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "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, "appplatform.APIPortalsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client APIPortalsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result APIPortalResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalsClient.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, serviceName) + return +} + +// ValidateDomain check the domains are valid as well as not in use. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// APIPortalName - the name of API portal. +// validatePayload - custom domain payload to be validated +func (client APIPortalsClient) ValidateDomain(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, validatePayload CustomDomainValidatePayload) (result CustomDomainValidateResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalsClient.ValidateDomain") + 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: validatePayload, + Constraints: []validation.Constraint{{Target: "validatePayload.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("appplatform.APIPortalsClient", "ValidateDomain", err.Error()) + } + + req, err := client.ValidateDomainPreparer(ctx, resourceGroupName, serviceName, APIPortalName, validatePayload) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "ValidateDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "ValidateDomain", resp, "Failure sending request") + return + } + + result, err = client.ValidateDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsClient", "ValidateDomain", resp, "Failure responding to request") + return + } + + return +} + +// ValidateDomainPreparer prepares the ValidateDomain request. +func (client APIPortalsClient) ValidateDomainPreparer(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, validatePayload CustomDomainValidatePayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "apiPortalName": autorest.Encode("path", APIPortalName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain", pathParameters), + autorest.WithJSON(validatePayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateDomainSender sends the ValidateDomain request. The method will close the +// http.Response Body if it receives an error. +func (client APIPortalsClient) ValidateDomainSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateDomainResponder handles the response to the ValidateDomain request. The method always +// closes the http.Response Body. +func (client APIPortalsClient) ValidateDomainResponder(resp *http.Response) (result CustomDomainValidateResult, 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/appplatform/mgmt/2022-05-01-preview/appplatform/appplatformapi/interfaces.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/appplatformapi/interfaces.go new file mode 100644 index 000000000000..f2e41d913d0c --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/appplatformapi/interfaces.go @@ -0,0 +1,292 @@ +package appplatformapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" + "github.com/Azure/go-autorest/autorest" +) + +// ServicesClientAPI contains the set of methods on the ServicesClient type. +type ServicesClientAPI interface { + CheckNameAvailability(ctx context.Context, location string, availabilityParameters appplatform.NameAvailabilityParameters) (result appplatform.NameAvailability, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, resource appplatform.ServiceResource) (result appplatform.ServicesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ServicesDeleteFuture, err error) + DisableTestEndpoint(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) + EnableTestEndpoint(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.TestKeys, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ServiceResource, err error) + List(ctx context.Context, resourceGroupName string) (result appplatform.ServiceResourceListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result appplatform.ServiceResourceListIterator, err error) + ListBySubscription(ctx context.Context) (result appplatform.ServiceResourceListPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result appplatform.ServiceResourceListIterator, err error) + ListTestKeys(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.TestKeys, err error) + RegenerateTestKey(ctx context.Context, resourceGroupName string, serviceName string, regenerateTestKeyRequest appplatform.RegenerateTestKeyRequestPayload) (result appplatform.TestKeys, err error) + Start(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ServicesStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ServicesStopFuture, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, resource appplatform.ServiceResource) (result appplatform.ServicesUpdateFuture, err error) +} + +var _ ServicesClientAPI = (*appplatform.ServicesClient)(nil) + +// ConfigServersClientAPI contains the set of methods on the ConfigServersClient type. +type ConfigServersClientAPI interface { + Get(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ConfigServerResource, err error) + UpdatePatch(ctx context.Context, resourceGroupName string, serviceName string, configServerResource appplatform.ConfigServerResource) (result appplatform.ConfigServersUpdatePatchFuture, err error) + UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, configServerResource appplatform.ConfigServerResource) (result appplatform.ConfigServersUpdatePutFuture, err error) + Validate(ctx context.Context, resourceGroupName string, serviceName string, configServerSettings appplatform.ConfigServerSettings) (result appplatform.ConfigServersValidateFuture, err error) +} + +var _ ConfigServersClientAPI = (*appplatform.ConfigServersClient)(nil) + +// ConfigurationServicesClientAPI contains the set of methods on the ConfigurationServicesClient type. +type ConfigurationServicesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string, configurationServiceResource appplatform.ConfigurationServiceResource) (result appplatform.ConfigurationServicesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string) (result appplatform.ConfigurationServicesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string) (result appplatform.ConfigurationServiceResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ConfigurationServiceResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ConfigurationServiceResourceCollectionIterator, err error) + Validate(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string, settings appplatform.ConfigurationServiceSettings) (result appplatform.ConfigurationServicesValidateFuture, err error) +} + +var _ ConfigurationServicesClientAPI = (*appplatform.ConfigurationServicesClient)(nil) + +// ServiceRegistriesClientAPI contains the set of methods on the ServiceRegistriesClient type. +type ServiceRegistriesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (result appplatform.ServiceRegistriesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (result appplatform.ServiceRegistriesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (result appplatform.ServiceRegistryResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ServiceRegistryResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.ServiceRegistryResourceCollectionIterator, err error) +} + +var _ ServiceRegistriesClientAPI = (*appplatform.ServiceRegistriesClient)(nil) + +// BuildServiceClientAPI contains the set of methods on the BuildServiceClient type. +type BuildServiceClientAPI interface { + CreateOrUpdateBuild(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildParameter appplatform.Build) (result appplatform.Build, err error) + GetBuild(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (result appplatform.Build, err error) + GetBuildResult(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildResultName string) (result appplatform.BuildResult, err error) + GetBuildResultLog(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildResultName string) (result appplatform.BuildResultLog, err error) + GetBuildService(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuildService, err error) + GetResourceUploadURL(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.ResourceUploadDefinition, err error) + GetSupportedBuildpack(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildpackName string) (result appplatform.SupportedBuildpackResource, err error) + GetSupportedStack(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, stackName string) (result appplatform.SupportedStackResource, err error) + ListBuildResults(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (result appplatform.BuildResultCollectionPage, err error) + ListBuildResultsComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (result appplatform.BuildResultCollectionIterator, err error) + ListBuilds(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuildCollectionPage, err error) + ListBuildsComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuildCollectionIterator, err error) + ListBuildServices(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.BuildServiceCollectionPage, err error) + ListBuildServicesComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.BuildServiceCollectionIterator, err error) + ListSupportedBuildpacks(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.SupportedBuildpacksCollection, err error) + ListSupportedStacks(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.SupportedStacksCollection, err error) +} + +var _ BuildServiceClientAPI = (*appplatform.BuildServiceClient)(nil) + +// BuildpackBindingClientAPI contains the set of methods on the BuildpackBindingClient type. +type BuildpackBindingClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string, buildpackBinding appplatform.BuildpackBindingResource) (result appplatform.BuildpackBindingCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string) (result appplatform.BuildpackBindingDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string) (result appplatform.BuildpackBindingResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result appplatform.BuildpackBindingResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result appplatform.BuildpackBindingResourceCollectionIterator, err error) +} + +var _ BuildpackBindingClientAPI = (*appplatform.BuildpackBindingClient)(nil) + +// BuildServiceBuilderClientAPI contains the set of methods on the BuildServiceBuilderClient type. +type BuildServiceBuilderClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, builderResource appplatform.BuilderResource) (result appplatform.BuildServiceBuilderCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result appplatform.BuildServiceBuilderDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result appplatform.BuilderResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuilderResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuilderResourceCollectionIterator, err error) +} + +var _ BuildServiceBuilderClientAPI = (*appplatform.BuildServiceBuilderClient)(nil) + +// BuildServiceAgentPoolClientAPI contains the set of methods on the BuildServiceAgentPoolClient type. +type BuildServiceAgentPoolClientAPI interface { + Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string) (result appplatform.BuildServiceAgentPoolResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuildServiceAgentPoolResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result appplatform.BuildServiceAgentPoolResourceCollectionIterator, err error) + UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string, agentPoolResource appplatform.BuildServiceAgentPoolResource) (result appplatform.BuildServiceAgentPoolUpdatePutFuture, err error) +} + +var _ BuildServiceAgentPoolClientAPI = (*appplatform.BuildServiceAgentPoolClient)(nil) + +// MonitoringSettingsClientAPI contains the set of methods on the MonitoringSettingsClient type. +type MonitoringSettingsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.MonitoringSettingResource, err error) + UpdatePatch(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource appplatform.MonitoringSettingResource) (result appplatform.MonitoringSettingsUpdatePatchFuture, err error) + UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource appplatform.MonitoringSettingResource) (result appplatform.MonitoringSettingsUpdatePutFuture, err error) +} + +var _ MonitoringSettingsClientAPI = (*appplatform.MonitoringSettingsClient)(nil) + +// AppsClientAPI contains the set of methods on the AppsClient type. +type AppsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource appplatform.AppResource) (result appplatform.AppsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.AppsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (result appplatform.AppResource, err error) + GetResourceUploadURL(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.ResourceUploadDefinition, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.AppResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.AppResourceCollectionIterator, err error) + SetActiveDeployments(ctx context.Context, resourceGroupName string, serviceName string, appName string, activeDeploymentCollection appplatform.ActiveDeploymentCollection) (result appplatform.AppsSetActiveDeploymentsFuture, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource appplatform.AppResource) (result appplatform.AppsUpdateFuture, err error) + ValidateDomain(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload appplatform.CustomDomainValidatePayload) (result appplatform.CustomDomainValidateResult, err error) +} + +var _ AppsClientAPI = (*appplatform.AppsClient)(nil) + +// BindingsClientAPI contains the set of methods on the BindingsClient type. +type BindingsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource appplatform.BindingResource) (result appplatform.BindingsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (result appplatform.BindingsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (result appplatform.BindingResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.BindingResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.BindingResourceCollectionIterator, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource appplatform.BindingResource) (result appplatform.BindingsUpdateFuture, err error) +} + +var _ BindingsClientAPI = (*appplatform.BindingsClient)(nil) + +// StoragesClientAPI contains the set of methods on the StoragesClient type. +type StoragesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, storageName string, storageResource appplatform.StorageResource) (result appplatform.StoragesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, storageName string) (result appplatform.StoragesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, storageName string) (result appplatform.StorageResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.StorageResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.StorageResourceCollectionIterator, err error) +} + +var _ StoragesClientAPI = (*appplatform.StoragesClient)(nil) + +// CertificatesClientAPI contains the set of methods on the CertificatesClient type. +type CertificatesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, certificateName string, certificateResource appplatform.CertificateResource) (result appplatform.CertificatesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (result appplatform.CertificatesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (result appplatform.CertificateResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.CertificateResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.CertificateResourceCollectionIterator, err error) +} + +var _ CertificatesClientAPI = (*appplatform.CertificatesClient)(nil) + +// CustomDomainsClientAPI contains the set of methods on the CustomDomainsClient type. +type CustomDomainsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource appplatform.CustomDomainResource) (result appplatform.CustomDomainsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (result appplatform.CustomDomainsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (result appplatform.CustomDomainResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.CustomDomainResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result appplatform.CustomDomainResourceCollectionIterator, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource appplatform.CustomDomainResource) (result appplatform.CustomDomainsUpdateFuture, err error) +} + +var _ CustomDomainsClientAPI = (*appplatform.CustomDomainsClient)(nil) + +// DeploymentsClientAPI contains the set of methods on the DeploymentsClient type. +type DeploymentsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource appplatform.DeploymentResource) (result appplatform.DeploymentsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentsDeleteFuture, err error) + GenerateHeapDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters appplatform.DiagnosticParameters) (result appplatform.DeploymentsGenerateHeapDumpFuture, err error) + GenerateThreadDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters appplatform.DiagnosticParameters) (result appplatform.DeploymentsGenerateThreadDumpFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentResource, err error) + GetLogFileURL(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.LogFileURLResponse, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result appplatform.DeploymentResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result appplatform.DeploymentResourceCollectionIterator, err error) + ListForCluster(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result appplatform.DeploymentResourceCollectionPage, err error) + ListForClusterComplete(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result appplatform.DeploymentResourceCollectionIterator, err error) + Restart(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentsRestartFuture, err error) + Start(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentsStartFuture, err error) + StartJFR(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters appplatform.DiagnosticParameters) (result appplatform.DeploymentsStartJFRFuture, err error) + Stop(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result appplatform.DeploymentsStopFuture, err error) + Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource appplatform.DeploymentResource) (result appplatform.DeploymentsUpdateFuture, err error) +} + +var _ DeploymentsClientAPI = (*appplatform.DeploymentsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result appplatform.AvailableOperationsPage, err error) + ListComplete(ctx context.Context) (result appplatform.AvailableOperationsIterator, err error) +} + +var _ OperationsClientAPI = (*appplatform.OperationsClient)(nil) + +// RuntimeVersionsClientAPI contains the set of methods on the RuntimeVersionsClient type. +type RuntimeVersionsClientAPI interface { + ListRuntimeVersions(ctx context.Context) (result appplatform.AvailableRuntimeVersions, err error) +} + +var _ RuntimeVersionsClientAPI = (*appplatform.RuntimeVersionsClient)(nil) + +// SkusClientAPI contains the set of methods on the SkusClient type. +type SkusClientAPI interface { + List(ctx context.Context) (result appplatform.ResourceSkuCollectionPage, err error) + ListComplete(ctx context.Context) (result appplatform.ResourceSkuCollectionIterator, err error) +} + +var _ SkusClientAPI = (*appplatform.SkusClient)(nil) + +// GatewaysClientAPI contains the set of methods on the GatewaysClient type. +type GatewaysClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, gatewayResource appplatform.GatewayResource) (result appplatform.GatewaysCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (result appplatform.GatewaysDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (result appplatform.GatewayResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.GatewayResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.GatewayResourceCollectionIterator, err error) + ValidateDomain(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, validatePayload appplatform.CustomDomainValidatePayload) (result appplatform.CustomDomainValidateResult, err error) +} + +var _ GatewaysClientAPI = (*appplatform.GatewaysClient)(nil) + +// GatewayRouteConfigsClientAPI contains the set of methods on the GatewayRouteConfigsClient type. +type GatewayRouteConfigsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, routeConfigName string, gatewayRouteConfigResource appplatform.GatewayRouteConfigResource) (result appplatform.GatewayRouteConfigsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, routeConfigName string) (result appplatform.GatewayRouteConfigsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, routeConfigName string) (result appplatform.GatewayRouteConfigResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (result appplatform.GatewayRouteConfigResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (result appplatform.GatewayRouteConfigResourceCollectionIterator, err error) +} + +var _ GatewayRouteConfigsClientAPI = (*appplatform.GatewayRouteConfigsClient)(nil) + +// GatewayCustomDomainsClientAPI contains the set of methods on the GatewayCustomDomainsClient type. +type GatewayCustomDomainsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, domainName string, gatewayCustomDomainResource appplatform.GatewayCustomDomainResource) (result appplatform.GatewayCustomDomainsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, domainName string) (result appplatform.GatewayCustomDomainsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, domainName string) (result appplatform.GatewayCustomDomainResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (result appplatform.GatewayCustomDomainResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (result appplatform.GatewayCustomDomainResourceCollectionIterator, err error) +} + +var _ GatewayCustomDomainsClientAPI = (*appplatform.GatewayCustomDomainsClient)(nil) + +// APIPortalsClientAPI contains the set of methods on the APIPortalsClient type. +type APIPortalsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, APIPortalResource appplatform.APIPortalResource) (result appplatform.APIPortalsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string) (result appplatform.APIPortalsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string) (result appplatform.APIPortalResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.APIPortalResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result appplatform.APIPortalResourceCollectionIterator, err error) + ValidateDomain(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, validatePayload appplatform.CustomDomainValidatePayload) (result appplatform.CustomDomainValidateResult, err error) +} + +var _ APIPortalsClientAPI = (*appplatform.APIPortalsClient)(nil) + +// APIPortalCustomDomainsClientAPI contains the set of methods on the APIPortalCustomDomainsClient type. +type APIPortalCustomDomainsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, domainName string, APIPortalCustomDomainResource appplatform.APIPortalCustomDomainResource) (result appplatform.APIPortalCustomDomainsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, domainName string) (result appplatform.APIPortalCustomDomainsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string, domainName string) (result appplatform.APIPortalCustomDomainResource, err error) + List(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string) (result appplatform.APIPortalCustomDomainResourceCollectionPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, serviceName string, APIPortalName string) (result appplatform.APIPortalCustomDomainResourceCollectionIterator, err error) +} + +var _ APIPortalCustomDomainsClientAPI = (*appplatform.APIPortalCustomDomainsClient)(nil) diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apps.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apps.go new file mode 100644 index 000000000000..a0340125baef --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/apps.go @@ -0,0 +1,760 @@ +package appplatform + +// 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" +) + +// AppsClient is the REST API for Azure Spring Apps +type AppsClient struct { + BaseClient +} + +// NewAppsClient creates an instance of the AppsClient client. +func NewAppsClient(subscriptionID string) AppsClient { + return NewAppsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAppsClientWithBaseURI creates an instance of the AppsClient 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 NewAppsClientWithBaseURI(baseURI string, subscriptionID string) AppsClient { + return AppsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new App or update an exiting App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// appResource - parameters for the create or update operation +func (client AppsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (result AppsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.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: appResource, + Constraints: []validation.Constraint{{Target: "appResource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.InclusiveMaximum, Rule: int64(5), Chain: nil}, + {Target: "appResource.Properties.TemporaryDisk.SizeInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + {Target: "appResource.Properties.PersistentDisk", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, + {Target: "appResource.Properties.PersistentDisk.SizeInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, + {Target: "appResource.Properties.PersistentDisk.UsedInGB", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.AppsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, appResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AppsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), + autorest.WithJSON(appResource), + 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 AppsClient) CreateOrUpdateSender(req *http.Request) (future AppsCreateOrUpdateFuture, 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 AppsClient) CreateOrUpdateResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete an App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client AppsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result AppsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.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, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AppsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", 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 AppsClient) DeleteSender(req *http.Request) (future AppsDeleteFuture, 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 AppsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get an App and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// syncStatus - indicates whether sync status +func (client AppsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (result AppResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.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, serviceName, appName, syncStatus) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AppsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, syncStatus string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(syncStatus) > 0 { + queryParameters["syncStatus"] = autorest.Encode("query", syncStatus) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", 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 AppsClient) 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 AppsClient) GetResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetResourceUploadURL get an resource upload URL for an App, which may be artifacts or source archive. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client AppsClient) GetResourceUploadURL(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result ResourceUploadDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.GetResourceUploadURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetResourceUploadURLPreparer(ctx, resourceGroupName, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetResourceUploadURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", resp, "Failure sending request") + return + } + + result, err = client.GetResourceUploadURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "GetResourceUploadURL", resp, "Failure responding to request") + return + } + + return +} + +// GetResourceUploadURLPreparer prepares the GetResourceUploadURL request. +func (client AppsClient) GetResourceUploadURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetResourceUploadURLSender sends the GetResourceUploadURL request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) GetResourceUploadURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResourceUploadURLResponder handles the response to the GetResourceUploadURL request. The method always +// closes the http.Response Body. +func (client AppsClient) GetResourceUploadURLResponder(resp *http.Response) (result ResourceUploadDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client AppsClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result AppResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.List") + defer func() { + sc := -1 + if result.arc.Response.Response != nil { + sc = result.arc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", resp, "Failure sending request") + return + } + + result.arc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "List", resp, "Failure responding to request") + return + } + if result.arc.hasNextLink() && result.arc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AppsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps", 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 AppsClient) 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 AppsClient) ListResponder(resp *http.Response) (result AppResourceCollection, 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 AppsClient) listNextResults(ctx context.Context, lastResults AppResourceCollection) (result AppResourceCollection, err error) { + req, err := lastResults.appResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.AppsClient", "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, "appplatform.AppsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AppsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result AppResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.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, serviceName) + return +} + +// SetActiveDeployments set existing Deployment under the app as active +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// activeDeploymentCollection - a list of Deployment name to be active. +func (client AppsClient) SetActiveDeployments(ctx context.Context, resourceGroupName string, serviceName string, appName string, activeDeploymentCollection ActiveDeploymentCollection) (result AppsSetActiveDeploymentsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.SetActiveDeployments") + 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.SetActiveDeploymentsPreparer(ctx, resourceGroupName, serviceName, appName, activeDeploymentCollection) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "SetActiveDeployments", nil, "Failure preparing request") + return + } + + result, err = client.SetActiveDeploymentsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "SetActiveDeployments", result.Response(), "Failure sending request") + return + } + + return +} + +// SetActiveDeploymentsPreparer prepares the SetActiveDeployments request. +func (client AppsClient) SetActiveDeploymentsPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, activeDeploymentCollection ActiveDeploymentCollection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments", pathParameters), + autorest.WithJSON(activeDeploymentCollection), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetActiveDeploymentsSender sends the SetActiveDeployments request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) SetActiveDeploymentsSender(req *http.Request) (future AppsSetActiveDeploymentsFuture, 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 +} + +// SetActiveDeploymentsResponder handles the response to the SetActiveDeployments request. The method always +// closes the http.Response Body. +func (client AppsClient) SetActiveDeploymentsResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update operation to update an exiting App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// appResource - parameters for the update operation +func (client AppsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (result AppsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, appResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client AppsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, appResource AppResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}", pathParameters), + autorest.WithJSON(appResource), + 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 AppsClient) UpdateSender(req *http.Request) (future AppsUpdateFuture, 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 AppsClient) UpdateResponder(resp *http.Response) (result AppResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateDomain check the resource name is valid as well as not in use. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// validatePayload - custom domain payload to be validated +func (client AppsClient) ValidateDomain(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload CustomDomainValidatePayload) (result CustomDomainValidateResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppsClient.ValidateDomain") + 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: validatePayload, + Constraints: []validation.Constraint{{Target: "validatePayload.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("appplatform.AppsClient", "ValidateDomain", err.Error()) + } + + req, err := client.ValidateDomainPreparer(ctx, resourceGroupName, serviceName, appName, validatePayload) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "ValidateDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "ValidateDomain", resp, "Failure sending request") + return + } + + result, err = client.ValidateDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsClient", "ValidateDomain", resp, "Failure responding to request") + return + } + + return +} + +// ValidateDomainPreparer prepares the ValidateDomain request. +func (client AppsClient) ValidateDomainPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, validatePayload CustomDomainValidatePayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain", pathParameters), + autorest.WithJSON(validatePayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateDomainSender sends the ValidateDomain request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) ValidateDomainSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateDomainResponder handles the response to the ValidateDomain request. The method always +// closes the http.Response Body. +func (client AppsClient) ValidateDomainResponder(resp *http.Response) (result CustomDomainValidateResult, 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/appplatform/mgmt/2022-05-01-preview/appplatform/bindings.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/bindings.go new file mode 100644 index 000000000000..9b96c17bf86d --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/bindings.go @@ -0,0 +1,490 @@ +package appplatform + +// 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" +) + +// BindingsClient is the REST API for Azure Spring Apps +type BindingsClient struct { + BaseClient +} + +// NewBindingsClient creates an instance of the BindingsClient client. +func NewBindingsClient(subscriptionID string) BindingsClient { + return NewBindingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBindingsClientWithBaseURI creates an instance of the BindingsClient 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 NewBindingsClientWithBaseURI(baseURI string, subscriptionID string) BindingsClient { + return BindingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Binding or update an exiting Binding. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// bindingName - the name of the Binding resource. +// bindingResource - parameters for the create or update operation +func (client BindingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource BindingResource) (result BindingsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, bindingName, bindingResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BindingsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource BindingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "bindingName": autorest.Encode("path", bindingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", pathParameters), + autorest.WithJSON(bindingResource), + 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 BindingsClient) CreateOrUpdateSender(req *http.Request) (future BindingsCreateOrUpdateFuture, 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 BindingsClient) CreateOrUpdateResponder(resp *http.Response) (result BindingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete a Binding. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// bindingName - the name of the Binding resource. +func (client BindingsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (result BindingsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.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, serviceName, appName, bindingName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BindingsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "bindingName": autorest.Encode("path", bindingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", 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 BindingsClient) DeleteSender(req *http.Request) (future BindingsDeleteFuture, 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 BindingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a Binding and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// bindingName - the name of the Binding resource. +func (client BindingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (result BindingResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.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, serviceName, appName, bindingName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BindingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "bindingName": autorest.Encode("path", bindingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", 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 BindingsClient) 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 BindingsClient) GetResponder(resp *http.Response) (result BindingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in an App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client BindingsClient) List(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result BindingResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.List") + defer func() { + sc := -1 + if result.brc.Response.Response != nil { + sc = result.brc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.brc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "List", resp, "Failure sending request") + return + } + + result.brc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "List", resp, "Failure responding to request") + return + } + if result.brc.hasNextLink() && result.brc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BindingsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings", 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 BindingsClient) 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 BindingsClient) ListResponder(resp *http.Response) (result BindingResourceCollection, 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 BindingsClient) listNextResults(ctx context.Context, lastResults BindingResourceCollection) (result BindingResourceCollection, err error) { + req, err := lastResults.bindingResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BindingsClient", "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, "appplatform.BindingsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BindingsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result BindingResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.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, serviceName, appName) + return +} + +// Update operation to update an exiting Binding. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// bindingName - the name of the Binding resource. +// bindingResource - parameters for the update operation +func (client BindingsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource BindingResource) (result BindingsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, bindingName, bindingResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client BindingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, bindingName string, bindingResource BindingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "bindingName": autorest.Encode("path", bindingName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}", pathParameters), + autorest.WithJSON(bindingResource), + 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 BindingsClient) UpdateSender(req *http.Request) (future BindingsUpdateFuture, 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 BindingsClient) UpdateResponder(resp *http.Response) (result BindingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildpackbinding.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildpackbinding.go new file mode 100644 index 000000000000..3ec8827e1cef --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildpackbinding.go @@ -0,0 +1,412 @@ +package appplatform + +// 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" +) + +// BuildpackBindingClient is the REST API for Azure Spring Apps +type BuildpackBindingClient struct { + BaseClient +} + +// NewBuildpackBindingClient creates an instance of the BuildpackBindingClient client. +func NewBuildpackBindingClient(subscriptionID string) BuildpackBindingClient { + return NewBuildpackBindingClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBuildpackBindingClientWithBaseURI creates an instance of the BuildpackBindingClient 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 NewBuildpackBindingClientWithBaseURI(baseURI string, subscriptionID string) BuildpackBindingClient { + return BuildpackBindingClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a buildpack binding. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +// buildpackBindingName - the name of the Buildpack Binding Name +// buildpackBinding - the target buildpack binding for the create or update operation +func (client BuildpackBindingClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string, buildpackBinding BuildpackBindingResource) (result BuildpackBindingCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, buildServiceName, builderName, buildpackBindingName, buildpackBinding) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BuildpackBindingClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string, buildpackBinding BuildpackBindingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildpackBindingName": autorest.Encode("path", buildpackBindingName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}", pathParameters), + autorest.WithJSON(buildpackBinding), + 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 BuildpackBindingClient) CreateOrUpdateSender(req *http.Request) (future BuildpackBindingCreateOrUpdateFuture, 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 BuildpackBindingClient) CreateOrUpdateResponder(resp *http.Response) (result BuildpackBindingResource, 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 operation to delete a Buildpack Binding +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +// buildpackBindingName - the name of the Buildpack Binding Name +func (client BuildpackBindingClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string) (result BuildpackBindingDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingClient.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, serviceName, buildServiceName, builderName, buildpackBindingName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BuildpackBindingClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildpackBindingName": autorest.Encode("path", buildpackBindingName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}", 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 BuildpackBindingClient) DeleteSender(req *http.Request) (future BuildpackBindingDeleteFuture, 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 BuildpackBindingClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a buildpack binding by name. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +// buildpackBindingName - the name of the Buildpack Binding Name +func (client BuildpackBindingClient) Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string) (result BuildpackBindingResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingClient.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, serviceName, buildServiceName, builderName, buildpackBindingName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BuildpackBindingClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, buildpackBindingName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildpackBindingName": autorest.Encode("path", buildpackBindingName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}", 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 BuildpackBindingClient) 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 BuildpackBindingClient) GetResponder(resp *http.Response) (result BuildpackBindingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all buildpack bindings in a builder. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +func (client BuildpackBindingClient) List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result BuildpackBindingResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingClient.List") + defer func() { + sc := -1 + if result.bbrc.Response.Response != nil { + sc = result.bbrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, buildServiceName, builderName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.bbrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "List", resp, "Failure sending request") + return + } + + result.bbrc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "List", resp, "Failure responding to request") + return + } + if result.bbrc.hasNextLink() && result.bbrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BuildpackBindingClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings", 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 BuildpackBindingClient) 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 BuildpackBindingClient) ListResponder(resp *http.Response) (result BuildpackBindingResourceCollection, 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 BuildpackBindingClient) listNextResults(ctx context.Context, lastResults BuildpackBindingResourceCollection) (result BuildpackBindingResourceCollection, err error) { + req, err := lastResults.buildpackBindingResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "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, "appplatform.BuildpackBindingClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BuildpackBindingClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result BuildpackBindingResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingClient.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, serviceName, buildServiceName, builderName) + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildservice.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildservice.go new file mode 100644 index 000000000000..9df212a46cc5 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildservice.go @@ -0,0 +1,1203 @@ +package appplatform + +// 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" +) + +// BuildServiceClient is the REST API for Azure Spring Apps +type BuildServiceClient struct { + BaseClient +} + +// NewBuildServiceClient creates an instance of the BuildServiceClient client. +func NewBuildServiceClient(subscriptionID string) BuildServiceClient { + return NewBuildServiceClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBuildServiceClientWithBaseURI creates an instance of the BuildServiceClient 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 NewBuildServiceClientWithBaseURI(baseURI string, subscriptionID string) BuildServiceClient { + return BuildServiceClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdateBuild create or update a KPack build. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// buildName - the name of the build resource. +// buildParameter - parameters for the create or update operation +func (client BuildServiceClient) CreateOrUpdateBuild(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildParameter Build) (result Build, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.CreateOrUpdateBuild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdateBuildPreparer(ctx, resourceGroupName, serviceName, buildServiceName, buildName, buildParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "CreateOrUpdateBuild", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateBuildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "CreateOrUpdateBuild", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateBuildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "CreateOrUpdateBuild", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateBuildPreparer prepares the CreateOrUpdateBuild request. +func (client BuildServiceClient) CreateOrUpdateBuildPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildParameter Build) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildName": autorest.Encode("path", buildName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", pathParameters), + autorest.WithJSON(buildParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateBuildSender sends the CreateOrUpdateBuild request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) CreateOrUpdateBuildSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateBuildResponder handles the response to the CreateOrUpdateBuild request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) CreateOrUpdateBuildResponder(resp *http.Response) (result Build, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBuild get a KPack build. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// buildName - the name of the build resource. +func (client BuildServiceClient) GetBuild(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (result Build, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetBuild") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetBuildPreparer(ctx, resourceGroupName, serviceName, buildServiceName, buildName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuild", nil, "Failure preparing request") + return + } + + resp, err := client.GetBuildSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuild", resp, "Failure sending request") + return + } + + result, err = client.GetBuildResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuild", resp, "Failure responding to request") + return + } + + return +} + +// GetBuildPreparer prepares the GetBuild request. +func (client BuildServiceClient) GetBuildPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildName": autorest.Encode("path", buildName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBuildSender sends the GetBuild request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetBuildSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBuildResponder handles the response to the GetBuild request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetBuildResponder(resp *http.Response) (result Build, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBuildResult get a KPack build result. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// buildName - the name of the build resource. +// buildResultName - the name of the build result resource. +func (client BuildServiceClient) GetBuildResult(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildResultName string) (result BuildResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetBuildResult") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetBuildResultPreparer(ctx, resourceGroupName, serviceName, buildServiceName, buildName, buildResultName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildResult", nil, "Failure preparing request") + return + } + + resp, err := client.GetBuildResultSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildResult", resp, "Failure sending request") + return + } + + result, err = client.GetBuildResultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildResult", resp, "Failure responding to request") + return + } + + return +} + +// GetBuildResultPreparer prepares the GetBuildResult request. +func (client BuildServiceClient) GetBuildResultPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildResultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildName": autorest.Encode("path", buildName), + "buildResultName": autorest.Encode("path", buildResultName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBuildResultSender sends the GetBuildResult request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetBuildResultSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBuildResultResponder handles the response to the GetBuildResult request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetBuildResultResponder(resp *http.Response) (result BuildResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBuildResultLog get a KPack build result log download URL. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// buildName - the name of the build resource. +// buildResultName - the name of the build result resource. +func (client BuildServiceClient) GetBuildResultLog(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildResultName string) (result BuildResultLog, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetBuildResultLog") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetBuildResultLogPreparer(ctx, resourceGroupName, serviceName, buildServiceName, buildName, buildResultName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildResultLog", nil, "Failure preparing request") + return + } + + resp, err := client.GetBuildResultLogSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildResultLog", resp, "Failure sending request") + return + } + + result, err = client.GetBuildResultLogResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildResultLog", resp, "Failure responding to request") + return + } + + return +} + +// GetBuildResultLogPreparer prepares the GetBuildResultLog request. +func (client BuildServiceClient) GetBuildResultLogPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string, buildResultName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildName": autorest.Encode("path", buildName), + "buildResultName": autorest.Encode("path", buildResultName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBuildResultLogSender sends the GetBuildResultLog request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetBuildResultLogSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBuildResultLogResponder handles the response to the GetBuildResultLog request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetBuildResultLogResponder(resp *http.Response) (result BuildResultLog, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBuildService get a build service resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceClient) GetBuildService(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuildService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetBuildService") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetBuildServicePreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildService", nil, "Failure preparing request") + return + } + + resp, err := client.GetBuildServiceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildService", resp, "Failure sending request") + return + } + + result, err = client.GetBuildServiceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetBuildService", resp, "Failure responding to request") + return + } + + return +} + +// GetBuildServicePreparer prepares the GetBuildService request. +func (client BuildServiceClient) GetBuildServicePreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBuildServiceSender sends the GetBuildService request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetBuildServiceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBuildServiceResponder handles the response to the GetBuildService request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetBuildServiceResponder(resp *http.Response) (result BuildService, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetResourceUploadURL get an resource upload URL for build service, which may be artifacts or source archive. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceClient) GetResourceUploadURL(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result ResourceUploadDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetResourceUploadURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetResourceUploadURLPreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetResourceUploadURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetResourceUploadURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetResourceUploadURL", resp, "Failure sending request") + return + } + + result, err = client.GetResourceUploadURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetResourceUploadURL", resp, "Failure responding to request") + return + } + + return +} + +// GetResourceUploadURLPreparer prepares the GetResourceUploadURL request. +func (client BuildServiceClient) GetResourceUploadURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetResourceUploadURLSender sends the GetResourceUploadURL request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetResourceUploadURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResourceUploadURLResponder handles the response to the GetResourceUploadURL request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetResourceUploadURLResponder(resp *http.Response) (result ResourceUploadDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSupportedBuildpack get the supported buildpack resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// buildpackName - the name of the buildpack resource. +func (client BuildServiceClient) GetSupportedBuildpack(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildpackName string) (result SupportedBuildpackResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetSupportedBuildpack") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetSupportedBuildpackPreparer(ctx, resourceGroupName, serviceName, buildServiceName, buildpackName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetSupportedBuildpack", nil, "Failure preparing request") + return + } + + resp, err := client.GetSupportedBuildpackSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetSupportedBuildpack", resp, "Failure sending request") + return + } + + result, err = client.GetSupportedBuildpackResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetSupportedBuildpack", resp, "Failure responding to request") + return + } + + return +} + +// GetSupportedBuildpackPreparer prepares the GetSupportedBuildpack request. +func (client BuildServiceClient) GetSupportedBuildpackPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildpackName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildpackName": autorest.Encode("path", buildpackName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSupportedBuildpackSender sends the GetSupportedBuildpack request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetSupportedBuildpackSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSupportedBuildpackResponder handles the response to the GetSupportedBuildpack request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetSupportedBuildpackResponder(resp *http.Response) (result SupportedBuildpackResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSupportedStack get the supported stack resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// stackName - the name of the stack resource. +func (client BuildServiceClient) GetSupportedStack(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, stackName string) (result SupportedStackResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.GetSupportedStack") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetSupportedStackPreparer(ctx, resourceGroupName, serviceName, buildServiceName, stackName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetSupportedStack", nil, "Failure preparing request") + return + } + + resp, err := client.GetSupportedStackSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetSupportedStack", resp, "Failure sending request") + return + } + + result, err = client.GetSupportedStackResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "GetSupportedStack", resp, "Failure responding to request") + return + } + + return +} + +// GetSupportedStackPreparer prepares the GetSupportedStack request. +func (client BuildServiceClient) GetSupportedStackPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, stackName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "stackName": autorest.Encode("path", stackName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSupportedStackSender sends the GetSupportedStack request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) GetSupportedStackSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSupportedStackResponder handles the response to the GetSupportedStack request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) GetSupportedStackResponder(resp *http.Response) (result SupportedStackResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBuildResults list KPack build results. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// buildName - the name of the build resource. +func (client BuildServiceClient) ListBuildResults(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (result BuildResultCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListBuildResults") + defer func() { + sc := -1 + if result.brc.Response.Response != nil { + sc = result.brc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBuildResultsNextResults + req, err := client.ListBuildResultsPreparer(ctx, resourceGroupName, serviceName, buildServiceName, buildName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuildResults", nil, "Failure preparing request") + return + } + + resp, err := client.ListBuildResultsSender(req) + if err != nil { + result.brc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuildResults", resp, "Failure sending request") + return + } + + result.brc, err = client.ListBuildResultsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuildResults", resp, "Failure responding to request") + return + } + if result.brc.hasNextLink() && result.brc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBuildResultsPreparer prepares the ListBuildResults request. +func (client BuildServiceClient) ListBuildResultsPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildName": autorest.Encode("path", buildName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBuildResultsSender sends the ListBuildResults request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) ListBuildResultsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBuildResultsResponder handles the response to the ListBuildResults request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) ListBuildResultsResponder(resp *http.Response) (result BuildResultCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBuildResultsNextResults retrieves the next set of results, if any. +func (client BuildServiceClient) listBuildResultsNextResults(ctx context.Context, lastResults BuildResultCollection) (result BuildResultCollection, err error) { + req, err := lastResults.buildResultCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildResultsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBuildResultsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildResultsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBuildResultsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildResultsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBuildResultsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BuildServiceClient) ListBuildResultsComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, buildName string) (result BuildResultCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListBuildResults") + 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.ListBuildResults(ctx, resourceGroupName, serviceName, buildServiceName, buildName) + return +} + +// ListBuilds list KPack builds. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceClient) ListBuilds(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuildCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListBuilds") + defer func() { + sc := -1 + if result.bc.Response.Response != nil { + sc = result.bc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBuildsNextResults + req, err := client.ListBuildsPreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuilds", nil, "Failure preparing request") + return + } + + resp, err := client.ListBuildsSender(req) + if err != nil { + result.bc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuilds", resp, "Failure sending request") + return + } + + result.bc, err = client.ListBuildsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuilds", resp, "Failure responding to request") + return + } + if result.bc.hasNextLink() && result.bc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBuildsPreparer prepares the ListBuilds request. +func (client BuildServiceClient) ListBuildsPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBuildsSender sends the ListBuilds request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) ListBuildsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBuildsResponder handles the response to the ListBuilds request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) ListBuildsResponder(resp *http.Response) (result BuildCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBuildsNextResults retrieves the next set of results, if any. +func (client BuildServiceClient) listBuildsNextResults(ctx context.Context, lastResults BuildCollection) (result BuildCollection, err error) { + req, err := lastResults.buildCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBuildsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBuildsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBuildsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BuildServiceClient) ListBuildsComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuildCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListBuilds") + 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.ListBuilds(ctx, resourceGroupName, serviceName, buildServiceName) + return +} + +// ListBuildServices list build services resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client BuildServiceClient) ListBuildServices(ctx context.Context, resourceGroupName string, serviceName string) (result BuildServiceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListBuildServices") + defer func() { + sc := -1 + if result.bsc.Response.Response != nil { + sc = result.bsc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBuildServicesNextResults + req, err := client.ListBuildServicesPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuildServices", nil, "Failure preparing request") + return + } + + resp, err := client.ListBuildServicesSender(req) + if err != nil { + result.bsc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuildServices", resp, "Failure sending request") + return + } + + result.bsc, err = client.ListBuildServicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListBuildServices", resp, "Failure responding to request") + return + } + if result.bsc.hasNextLink() && result.bsc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBuildServicesPreparer prepares the ListBuildServices request. +func (client BuildServiceClient) ListBuildServicesPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBuildServicesSender sends the ListBuildServices request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) ListBuildServicesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBuildServicesResponder handles the response to the ListBuildServices request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) ListBuildServicesResponder(resp *http.Response) (result BuildServiceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBuildServicesNextResults retrieves the next set of results, if any. +func (client BuildServiceClient) listBuildServicesNextResults(ctx context.Context, lastResults BuildServiceCollection) (result BuildServiceCollection, err error) { + req, err := lastResults.buildServiceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildServicesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBuildServicesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildServicesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBuildServicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "listBuildServicesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBuildServicesComplete enumerates all values, automatically crossing page boundaries as required. +func (client BuildServiceClient) ListBuildServicesComplete(ctx context.Context, resourceGroupName string, serviceName string) (result BuildServiceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListBuildServices") + 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.ListBuildServices(ctx, resourceGroupName, serviceName) + return +} + +// ListSupportedBuildpacks get all supported buildpacks. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceClient) ListSupportedBuildpacks(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result SupportedBuildpacksCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListSupportedBuildpacks") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSupportedBuildpacksPreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListSupportedBuildpacks", nil, "Failure preparing request") + return + } + + resp, err := client.ListSupportedBuildpacksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListSupportedBuildpacks", resp, "Failure sending request") + return + } + + result, err = client.ListSupportedBuildpacksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListSupportedBuildpacks", resp, "Failure responding to request") + return + } + + return +} + +// ListSupportedBuildpacksPreparer prepares the ListSupportedBuildpacks request. +func (client BuildServiceClient) ListSupportedBuildpacksPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSupportedBuildpacksSender sends the ListSupportedBuildpacks request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) ListSupportedBuildpacksSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSupportedBuildpacksResponder handles the response to the ListSupportedBuildpacks request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) ListSupportedBuildpacksResponder(resp *http.Response) (result SupportedBuildpacksCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListSupportedStacks get all supported stacks. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceClient) ListSupportedStacks(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result SupportedStacksCollection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceClient.ListSupportedStacks") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListSupportedStacksPreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListSupportedStacks", nil, "Failure preparing request") + return + } + + resp, err := client.ListSupportedStacksSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListSupportedStacks", resp, "Failure sending request") + return + } + + result, err = client.ListSupportedStacksResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceClient", "ListSupportedStacks", resp, "Failure responding to request") + return + } + + return +} + +// ListSupportedStacksPreparer prepares the ListSupportedStacks request. +func (client BuildServiceClient) ListSupportedStacksPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSupportedStacksSender sends the ListSupportedStacks request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceClient) ListSupportedStacksSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListSupportedStacksResponder handles the response to the ListSupportedStacks request. The method always +// closes the http.Response Body. +func (client BuildServiceClient) ListSupportedStacksResponder(resp *http.Response) (result SupportedStacksCollection, 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/appplatform/mgmt/2022-05-01-preview/appplatform/buildserviceagentpool.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildserviceagentpool.go new file mode 100644 index 000000000000..e9ff56445997 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildserviceagentpool.go @@ -0,0 +1,321 @@ +package appplatform + +// 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" +) + +// BuildServiceAgentPoolClient is the REST API for Azure Spring Apps +type BuildServiceAgentPoolClient struct { + BaseClient +} + +// NewBuildServiceAgentPoolClient creates an instance of the BuildServiceAgentPoolClient client. +func NewBuildServiceAgentPoolClient(subscriptionID string) BuildServiceAgentPoolClient { + return NewBuildServiceAgentPoolClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBuildServiceAgentPoolClientWithBaseURI creates an instance of the BuildServiceAgentPoolClient 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 NewBuildServiceAgentPoolClientWithBaseURI(baseURI string, subscriptionID string) BuildServiceAgentPoolClient { + return BuildServiceAgentPoolClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get build service agent pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// agentPoolName - the name of the build service agent pool resource. +func (client BuildServiceAgentPoolClient) Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string) (result BuildServiceAgentPoolResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolClient.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, serviceName, buildServiceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BuildServiceAgentPoolClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceAgentPoolClient) 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 BuildServiceAgentPoolClient) GetResponder(resp *http.Response) (result BuildServiceAgentPoolResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list build service agent pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceAgentPoolClient) List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuildServiceAgentPoolResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolClient.List") + defer func() { + sc := -1 + if result.bsaprc.Response.Response != nil { + sc = result.bsaprc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.bsaprc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "List", resp, "Failure sending request") + return + } + + result.bsaprc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "List", resp, "Failure responding to request") + return + } + if result.bsaprc.hasNextLink() && result.bsaprc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BuildServiceAgentPoolClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceAgentPoolClient) 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 BuildServiceAgentPoolClient) ListResponder(resp *http.Response) (result BuildServiceAgentPoolResourceCollection, 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 BuildServiceAgentPoolClient) listNextResults(ctx context.Context, lastResults BuildServiceAgentPoolResourceCollection) (result BuildServiceAgentPoolResourceCollection, err error) { + req, err := lastResults.buildServiceAgentPoolResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "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, "appplatform.BuildServiceAgentPoolClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BuildServiceAgentPoolClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuildServiceAgentPoolResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolClient.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, serviceName, buildServiceName) + return +} + +// UpdatePut create or update build service agent pool. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// agentPoolName - the name of the build service agent pool resource. +// agentPoolResource - parameters for the update operation +func (client BuildServiceAgentPoolClient) UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string, agentPoolResource BuildServiceAgentPoolResource) (result BuildServiceAgentPoolUpdatePutFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolClient.UpdatePut") + 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.UpdatePutPreparer(ctx, resourceGroupName, serviceName, buildServiceName, agentPoolName, agentPoolResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "UpdatePut", nil, "Failure preparing request") + return + } + + result, err = client.UpdatePutSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolClient", "UpdatePut", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePutPreparer prepares the UpdatePut request. +func (client BuildServiceAgentPoolClient) UpdatePutPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, agentPoolName string, agentPoolResource BuildServiceAgentPoolResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}", pathParameters), + autorest.WithJSON(agentPoolResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePutSender sends the UpdatePut request. The method will close the +// http.Response Body if it receives an error. +func (client BuildServiceAgentPoolClient) UpdatePutSender(req *http.Request) (future BuildServiceAgentPoolUpdatePutFuture, 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 +} + +// UpdatePutResponder handles the response to the UpdatePut request. The method always +// closes the http.Response Body. +func (client BuildServiceAgentPoolClient) UpdatePutResponder(resp *http.Response) (result BuildServiceAgentPoolResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildservicebuilder.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildservicebuilder.go new file mode 100644 index 000000000000..0af93994c57a --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/buildservicebuilder.go @@ -0,0 +1,404 @@ +package appplatform + +// 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" +) + +// BuildServiceBuilderClient is the REST API for Azure Spring Apps +type BuildServiceBuilderClient struct { + BaseClient +} + +// NewBuildServiceBuilderClient creates an instance of the BuildServiceBuilderClient client. +func NewBuildServiceBuilderClient(subscriptionID string) BuildServiceBuilderClient { + return NewBuildServiceBuilderClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBuildServiceBuilderClientWithBaseURI creates an instance of the BuildServiceBuilderClient 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 NewBuildServiceBuilderClientWithBaseURI(baseURI string, subscriptionID string) BuildServiceBuilderClient { + return BuildServiceBuilderClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a KPack builder. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +// builderResource - the target builder for the create or update operation +func (client BuildServiceBuilderClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, builderResource BuilderResource) (result BuildServiceBuilderCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceBuilderClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, buildServiceName, builderName, builderResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BuildServiceBuilderClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string, builderResource BuilderResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", pathParameters), + autorest.WithJSON(builderResource), + 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 BuildServiceBuilderClient) CreateOrUpdateSender(req *http.Request) (future BuildServiceBuilderCreateOrUpdateFuture, 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 BuildServiceBuilderClient) CreateOrUpdateResponder(resp *http.Response) (result BuilderResource, 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 KPack builder. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +func (client BuildServiceBuilderClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result BuildServiceBuilderDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceBuilderClient.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, serviceName, buildServiceName, builderName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BuildServiceBuilderClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", 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 BuildServiceBuilderClient) DeleteSender(req *http.Request) (future BuildServiceBuilderDeleteFuture, 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 BuildServiceBuilderClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a KPack builder. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +// builderName - the name of the builder resource. +func (client BuildServiceBuilderClient) Get(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (result BuilderResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceBuilderClient.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, serviceName, buildServiceName, builderName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BuildServiceBuilderClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string, builderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "builderName": autorest.Encode("path", builderName), + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}", 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 BuildServiceBuilderClient) 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 BuildServiceBuilderClient) GetResponder(resp *http.Response) (result BuilderResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list KPack builders result. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// buildServiceName - the name of the build service resource. +func (client BuildServiceBuilderClient) List(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuilderResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceBuilderClient.List") + defer func() { + sc := -1 + if result.brc.Response.Response != nil { + sc = result.brc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, buildServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.brc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "List", resp, "Failure sending request") + return + } + + result.brc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "List", resp, "Failure responding to request") + return + } + if result.brc.hasNextLink() && result.brc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BuildServiceBuilderClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "buildServiceName": autorest.Encode("path", buildServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders", 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 BuildServiceBuilderClient) 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 BuildServiceBuilderClient) ListResponder(resp *http.Response) (result BuilderResourceCollection, 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 BuildServiceBuilderClient) listNextResults(ctx context.Context, lastResults BuilderResourceCollection) (result BuilderResourceCollection, err error) { + req, err := lastResults.builderResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "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, "appplatform.BuildServiceBuilderClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BuildServiceBuilderClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, buildServiceName string) (result BuilderResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceBuilderClient.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, serviceName, buildServiceName) + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/certificates.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/certificates.go new file mode 100644 index 000000000000..28d323fcb2a9 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/certificates.go @@ -0,0 +1,395 @@ +package appplatform + +// 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" +) + +// CertificatesClient is the REST API for Azure Spring Apps +type CertificatesClient struct { + BaseClient +} + +// NewCertificatesClient creates an instance of the CertificatesClient client. +func NewCertificatesClient(subscriptionID string) CertificatesClient { + return NewCertificatesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCertificatesClientWithBaseURI creates an instance of the CertificatesClient 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 NewCertificatesClientWithBaseURI(baseURI string, subscriptionID string) CertificatesClient { + return CertificatesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update certificate resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// certificateName - the name of the certificate resource. +// certificateResource - parameters for the create or update operation +func (client CertificatesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, certificateName string, certificateResource CertificateResource) (result CertificatesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, certificateName, certificateResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CertificatesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateName string, certificateResource CertificateResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", pathParameters), + autorest.WithJSON(certificateResource), + 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 CertificatesClient) CreateOrUpdateSender(req *http.Request) (future CertificatesCreateOrUpdateFuture, 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 CertificatesClient) CreateOrUpdateResponder(resp *http.Response) (result CertificateResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the certificate resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// certificateName - the name of the certificate resource. +func (client CertificatesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (result CertificatesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.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, serviceName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CertificatesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", 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 CertificatesClient) DeleteSender(req *http.Request) (future CertificatesDeleteFuture, 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 CertificatesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the certificate resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// certificateName - the name of the certificate resource. +func (client CertificatesClient) Get(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (result CertificateResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.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, serviceName, certificateName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CertificatesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, certificateName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "certificateName": autorest.Encode("path", certificateName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}", 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 CertificatesClient) 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 CertificatesClient) GetResponder(resp *http.Response) (result CertificateResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all the certificates of one user. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client CertificatesClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result CertificateResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.List") + defer func() { + sc := -1 + if result.crc.Response.Response != nil { + sc = result.crc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.crc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "List", resp, "Failure sending request") + return + } + + result.crc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "List", resp, "Failure responding to request") + return + } + if result.crc.hasNextLink() && result.crc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client CertificatesClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates", 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 CertificatesClient) 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 CertificatesClient) ListResponder(resp *http.Response) (result CertificateResourceCollection, 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 CertificatesClient) listNextResults(ctx context.Context, lastResults CertificateResourceCollection) (result CertificateResourceCollection, err error) { + req, err := lastResults.certificateResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "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, "appplatform.CertificatesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CertificatesClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result CertificateResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificatesClient.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, serviceName) + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/client.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/client.go new file mode 100644 index 000000000000..1cea2e3bec92 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/client.go @@ -0,0 +1,41 @@ +// Package appplatform implements the Azure ARM Appplatform service API version 2022-05-01-preview. +// +// REST API for Azure Spring Apps +package appplatform + +// 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 Appplatform + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Appplatform. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/configservers.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/configservers.go new file mode 100644 index 000000000000..d810a1543abc --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/configservers.go @@ -0,0 +1,376 @@ +package appplatform + +// 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" +) + +// ConfigServersClient is the REST API for Azure Spring Apps +type ConfigServersClient struct { + BaseClient +} + +// NewConfigServersClient creates an instance of the ConfigServersClient client. +func NewConfigServersClient(subscriptionID string) ConfigServersClient { + return NewConfigServersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConfigServersClientWithBaseURI creates an instance of the ConfigServersClient 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 NewConfigServersClientWithBaseURI(baseURI string, subscriptionID string) ConfigServersClient { + return ConfigServersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the config server and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ConfigServersClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result ConfigServerResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigServersClient.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, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConfigServersClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigServersClient) 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 ConfigServersClient) GetResponder(resp *http.Response) (result ConfigServerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePatch update the config server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configServerResource - parameters for the update operation +func (client ConfigServersClient) UpdatePatch(ctx context.Context, resourceGroupName string, serviceName string, configServerResource ConfigServerResource) (result ConfigServersUpdatePatchFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigServersClient.UpdatePatch") + 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.UpdatePatchPreparer(ctx, resourceGroupName, serviceName, configServerResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "UpdatePatch", nil, "Failure preparing request") + return + } + + result, err = client.UpdatePatchSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "UpdatePatch", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePatchPreparer prepares the UpdatePatch request. +func (client ConfigServersClient) UpdatePatchPreparer(ctx context.Context, resourceGroupName string, serviceName string, configServerResource ConfigServerResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", pathParameters), + autorest.WithJSON(configServerResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePatchSender sends the UpdatePatch request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigServersClient) UpdatePatchSender(req *http.Request) (future ConfigServersUpdatePatchFuture, 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 +} + +// UpdatePatchResponder handles the response to the UpdatePatch request. The method always +// closes the http.Response Body. +func (client ConfigServersClient) UpdatePatchResponder(resp *http.Response) (result ConfigServerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePut update the config server. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configServerResource - parameters for the update operation +func (client ConfigServersClient) UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, configServerResource ConfigServerResource) (result ConfigServersUpdatePutFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigServersClient.UpdatePut") + 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: configServerResource, + Constraints: []validation.Constraint{{Target: "configServerResource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "configServerResource.Properties.ConfigServer", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "configServerResource.Properties.ConfigServer.GitProperty", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "configServerResource.Properties.ConfigServer.GitProperty.URI", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.ConfigServersClient", "UpdatePut", err.Error()) + } + + req, err := client.UpdatePutPreparer(ctx, resourceGroupName, serviceName, configServerResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "UpdatePut", nil, "Failure preparing request") + return + } + + result, err = client.UpdatePutSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "UpdatePut", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePutPreparer prepares the UpdatePut request. +func (client ConfigServersClient) UpdatePutPreparer(ctx context.Context, resourceGroupName string, serviceName string, configServerResource ConfigServerResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default", pathParameters), + autorest.WithJSON(configServerResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePutSender sends the UpdatePut request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigServersClient) UpdatePutSender(req *http.Request) (future ConfigServersUpdatePutFuture, 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 +} + +// UpdatePutResponder handles the response to the UpdatePut request. The method always +// closes the http.Response Body. +func (client ConfigServersClient) UpdatePutResponder(resp *http.Response) (result ConfigServerResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Validate check if the config server settings are valid. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configServerSettings - config server settings to be validated +func (client ConfigServersClient) Validate(ctx context.Context, resourceGroupName string, serviceName string, configServerSettings ConfigServerSettings) (result ConfigServersValidateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigServersClient.Validate") + 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: configServerSettings, + Constraints: []validation.Constraint{{Target: "configServerSettings.GitProperty", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "configServerSettings.GitProperty.URI", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("appplatform.ConfigServersClient", "Validate", err.Error()) + } + + req, err := client.ValidatePreparer(ctx, resourceGroupName, serviceName, configServerSettings) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "Validate", nil, "Failure preparing request") + return + } + + result, err = client.ValidateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersClient", "Validate", result.Response(), "Failure sending request") + return + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client ConfigServersClient) ValidatePreparer(ctx context.Context, resourceGroupName string, serviceName string, configServerSettings ConfigServerSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate", pathParameters), + autorest.WithJSON(configServerSettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigServersClient) ValidateSender(req *http.Request) (future ConfigServersValidateFuture, 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 +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client ConfigServersClient) ValidateResponder(resp *http.Response) (result ConfigServerSettingsValidateResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/configurationservices.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/configurationservices.go new file mode 100644 index 000000000000..76e475672863 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/configurationservices.go @@ -0,0 +1,482 @@ +package appplatform + +// 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" +) + +// ConfigurationServicesClient is the REST API for Azure Spring Apps +type ConfigurationServicesClient struct { + BaseClient +} + +// NewConfigurationServicesClient creates an instance of the ConfigurationServicesClient client. +func NewConfigurationServicesClient(subscriptionID string) ConfigurationServicesClient { + return NewConfigurationServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConfigurationServicesClientWithBaseURI creates an instance of the ConfigurationServicesClient 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 NewConfigurationServicesClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationServicesClient { + return ConfigurationServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the default Application Configuration Service or update the existing Application Configuration +// Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configurationServiceName - the name of Application Configuration Service. +// configurationServiceResource - parameters for the update operation +func (client ConfigurationServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string, configurationServiceResource ConfigurationServiceResource) (result ConfigurationServicesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServicesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, configurationServiceName, configurationServiceResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConfigurationServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string, configurationServiceResource ConfigurationServiceResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationServiceName": autorest.Encode("path", configurationServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", pathParameters), + autorest.WithJSON(configurationServiceResource), + 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 ConfigurationServicesClient) CreateOrUpdateSender(req *http.Request) (future ConfigurationServicesCreateOrUpdateFuture, 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 ConfigurationServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ConfigurationServiceResource, 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 disable the default Application Configuration Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configurationServiceName - the name of Application Configuration Service. +func (client ConfigurationServicesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string) (result ConfigurationServicesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServicesClient.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, serviceName, configurationServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConfigurationServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationServiceName": autorest.Encode("path", configurationServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", 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 ConfigurationServicesClient) DeleteSender(req *http.Request) (future ConfigurationServicesDeleteFuture, 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 ConfigurationServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the Application Configuration Service and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configurationServiceName - the name of Application Configuration Service. +func (client ConfigurationServicesClient) Get(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string) (result ConfigurationServiceResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServicesClient.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, serviceName, configurationServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConfigurationServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationServiceName": autorest.Encode("path", configurationServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}", 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 ConfigurationServicesClient) 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 ConfigurationServicesClient) GetResponder(resp *http.Response) (result ConfigurationServiceResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ConfigurationServicesClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result ConfigurationServiceResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServicesClient.List") + defer func() { + sc := -1 + if result.csrc.Response.Response != nil { + sc = result.csrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.csrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "List", resp, "Failure sending request") + return + } + + result.csrc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "List", resp, "Failure responding to request") + return + } + if result.csrc.hasNextLink() && result.csrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ConfigurationServicesClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices", 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 ConfigurationServicesClient) 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 ConfigurationServicesClient) ListResponder(resp *http.Response) (result ConfigurationServiceResourceCollection, 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 ConfigurationServicesClient) listNextResults(ctx context.Context, lastResults ConfigurationServiceResourceCollection) (result ConfigurationServiceResourceCollection, err error) { + req, err := lastResults.configurationServiceResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "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, "appplatform.ConfigurationServicesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ConfigurationServicesClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result ConfigurationServiceResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServicesClient.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, serviceName) + return +} + +// Validate check if the Application Configuration Service settings are valid. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// configurationServiceName - the name of Application Configuration Service. +// settings - application Configuration Service settings to be validated +func (client ConfigurationServicesClient) Validate(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string, settings ConfigurationServiceSettings) (result ConfigurationServicesValidateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServicesClient.Validate") + 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.ValidatePreparer(ctx, resourceGroupName, serviceName, configurationServiceName, settings) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Validate", nil, "Failure preparing request") + return + } + + result, err = client.ValidateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesClient", "Validate", result.Response(), "Failure sending request") + return + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client ConfigurationServicesClient) ValidatePreparer(ctx context.Context, resourceGroupName string, serviceName string, configurationServiceName string, settings ConfigurationServiceSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationServiceName": autorest.Encode("path", configurationServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate", pathParameters), + autorest.WithJSON(settings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationServicesClient) ValidateSender(req *http.Request) (future ConfigurationServicesValidateFuture, 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 +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client ConfigurationServicesClient) ValidateResponder(resp *http.Response) (result ConfigurationServiceSettingsValidateResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/customdomains.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/customdomains.go new file mode 100644 index 000000000000..7f628c6cd739 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/customdomains.go @@ -0,0 +1,490 @@ +package appplatform + +// 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" +) + +// CustomDomainsClient is the REST API for Azure Spring Apps +type CustomDomainsClient struct { + BaseClient +} + +// NewCustomDomainsClient creates an instance of the CustomDomainsClient client. +func NewCustomDomainsClient(subscriptionID string) CustomDomainsClient { + return NewCustomDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCustomDomainsClientWithBaseURI creates an instance of the CustomDomainsClient 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 NewCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) CustomDomainsClient { + return CustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update custom domain of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// domainName - the name of the custom domain resource. +// domainResource - parameters for the create or update operation +func (client CustomDomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource) (result CustomDomainsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, domainName, domainResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CustomDomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", pathParameters), + autorest.WithJSON(domainResource), + 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 CustomDomainsClient) CreateOrUpdateSender(req *http.Request) (future CustomDomainsCreateOrUpdateFuture, 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 CustomDomainsClient) CreateOrUpdateResponder(resp *http.Response) (result CustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the custom domain of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// domainName - the name of the custom domain resource. +func (client CustomDomainsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (result CustomDomainsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.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, serviceName, appName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CustomDomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) DeleteSender(req *http.Request) (future CustomDomainsDeleteFuture, 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 CustomDomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the custom domain of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// domainName - the name of the custom domain resource. +func (client CustomDomainsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (result CustomDomainResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.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, serviceName, appName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CustomDomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CustomDomainsClient) 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 CustomDomainsClient) GetResponder(resp *http.Response) (result CustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list the custom domains of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +func (client CustomDomainsClient) List(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result CustomDomainResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.List") + defer func() { + sc := -1 + if result.cdrc.Response.Response != nil { + sc = result.cdrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, appName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.cdrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "List", resp, "Failure sending request") + return + } + + result.cdrc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "List", resp, "Failure responding to request") + return + } + if result.cdrc.hasNextLink() && result.cdrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client CustomDomainsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains", 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 CustomDomainsClient) 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 CustomDomainsClient) ListResponder(resp *http.Response) (result CustomDomainResourceCollection, 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 CustomDomainsClient) listNextResults(ctx context.Context, lastResults CustomDomainResourceCollection) (result CustomDomainResourceCollection, err error) { + req, err := lastResults.customDomainResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "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, "appplatform.CustomDomainsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CustomDomainsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string) (result CustomDomainResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.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, serviceName, appName) + return +} + +// Update update custom domain of one lifecycle application. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// domainName - the name of the custom domain resource. +// domainResource - parameters for the create or update operation +func (client CustomDomainsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource) (result CustomDomainsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, domainName, domainResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client CustomDomainsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, domainName string, domainResource CustomDomainResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "domainName": autorest.Encode("path", domainName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}", pathParameters), + autorest.WithJSON(domainResource), + 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 CustomDomainsClient) UpdateSender(req *http.Request) (future CustomDomainsUpdateFuture, 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 CustomDomainsClient) UpdateResponder(resp *http.Response) (result CustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/deployments.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/deployments.go new file mode 100644 index 000000000000..e1a456e48c0e --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/deployments.go @@ -0,0 +1,1221 @@ +package appplatform + +// 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" +) + +// DeploymentsClient is the REST API for Azure Spring Apps +type DeploymentsClient struct { + BaseClient +} + +// NewDeploymentsClient creates an instance of the DeploymentsClient client. +func NewDeploymentsClient(subscriptionID string) DeploymentsClient { + return NewDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDeploymentsClientWithBaseURI creates an instance of the DeploymentsClient 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 NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient { + return DeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Deployment or update an exiting Deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +// deploymentResource - parameters for the create or update operation +func (client DeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (result DeploymentsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.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: deploymentResource, + Constraints: []validation.Constraint{{Target: "deploymentResource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.LivenessProbe", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.LivenessProbe.DisableProbe", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "deploymentResource.Properties.DeploymentSettings.ReadinessProbe", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.ReadinessProbe.DisableProbe", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "deploymentResource.Properties.DeploymentSettings.StartupProbe", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "deploymentResource.Properties.DeploymentSettings.StartupProbe.DisableProbe", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.DeploymentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, deploymentResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(deploymentResource), + 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 DeploymentsClient) CreateOrUpdateSender(req *http.Request) (future DeploymentsCreateOrUpdateFuture, 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 DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result DeploymentResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete a Deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.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, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DeploymentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", 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 DeploymentsClient) DeleteSender(req *http.Request) (future DeploymentsDeleteFuture, 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 DeploymentsClient) 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 +} + +// GenerateHeapDump generate Heap Dump +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +// diagnosticParameters - parameters for the diagnostic operation +func (client DeploymentsClient) GenerateHeapDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (result DeploymentsGenerateHeapDumpFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GenerateHeapDump") + 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.GenerateHeapDumpPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GenerateHeapDump", nil, "Failure preparing request") + return + } + + result, err = client.GenerateHeapDumpSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GenerateHeapDump", result.Response(), "Failure sending request") + return + } + + return +} + +// GenerateHeapDumpPreparer prepares the GenerateHeapDump request. +func (client DeploymentsClient) GenerateHeapDumpPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", pathParameters), + autorest.WithJSON(diagnosticParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateHeapDumpSender sends the GenerateHeapDump request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GenerateHeapDumpSender(req *http.Request) (future DeploymentsGenerateHeapDumpFuture, 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 +} + +// GenerateHeapDumpResponder handles the response to the GenerateHeapDump request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GenerateHeapDumpResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateThreadDump generate Thread Dump +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +// diagnosticParameters - parameters for the diagnostic operation +func (client DeploymentsClient) GenerateThreadDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (result DeploymentsGenerateThreadDumpFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GenerateThreadDump") + 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.GenerateThreadDumpPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GenerateThreadDump", nil, "Failure preparing request") + return + } + + result, err = client.GenerateThreadDumpSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GenerateThreadDump", result.Response(), "Failure sending request") + return + } + + return +} + +// GenerateThreadDumpPreparer prepares the GenerateThreadDump request. +func (client DeploymentsClient) GenerateThreadDumpPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", pathParameters), + autorest.WithJSON(diagnosticParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateThreadDumpSender sends the GenerateThreadDump request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GenerateThreadDumpSender(req *http.Request) (future DeploymentsGenerateThreadDumpFuture, 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 +} + +// GenerateThreadDumpResponder handles the response to the GenerateThreadDump request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GenerateThreadDumpResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a Deployment and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.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, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DeploymentsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", 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 DeploymentsClient) 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 DeploymentsClient) GetResponder(resp *http.Response) (result DeploymentResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLogFileURL get deployment log file URL +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) GetLogFileURL(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result LogFileURLResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetLogFileURL") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetLogFileURLPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GetLogFileURL", nil, "Failure preparing request") + return + } + + resp, err := client.GetLogFileURLSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GetLogFileURL", resp, "Failure sending request") + return + } + + result, err = client.GetLogFileURLResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GetLogFileURL", resp, "Failure responding to request") + return + } + + return +} + +// GetLogFileURLPreparer prepares the GetLogFileURL request. +func (client DeploymentsClient) GetLogFileURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLogFileURLSender sends the GetLogFileURL request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) GetLogFileURLSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetLogFileURLResponder handles the response to the GetLogFileURL request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) GetLogFileURLResponder(resp *http.Response) (result LogFileURLResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in an App. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// version - version of the deployments to be listed +func (client DeploymentsClient) List(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result DeploymentResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.List") + defer func() { + sc := -1 + if result.drc.Response.Response != nil { + sc = result.drc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, appName, version) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.drc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", resp, "Failure sending request") + return + } + + result.drc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", resp, "Failure responding to request") + return + } + if result.drc.hasNextLink() && result.drc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DeploymentsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if version != nil && len(version) > 0 { + queryParameters["version"] = version + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", 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 DeploymentsClient) 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 DeploymentsClient) ListResponder(resp *http.Response) (result DeploymentResourceCollection, 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 DeploymentsClient) listNextResults(ctx context.Context, lastResults DeploymentResourceCollection) (result DeploymentResourceCollection, err error) { + req, err := lastResults.deploymentResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "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, "appplatform.DeploymentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result DeploymentResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.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, serviceName, appName, version) + return +} + +// ListForCluster list deployments for a certain service +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// version - version of the deployments to be listed +func (client DeploymentsClient) ListForCluster(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result DeploymentResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListForCluster") + defer func() { + sc := -1 + if result.drc.Response.Response != nil { + sc = result.drc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listForClusterNextResults + req, err := client.ListForClusterPreparer(ctx, resourceGroupName, serviceName, version) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListForCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListForClusterSender(req) + if err != nil { + result.drc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListForCluster", resp, "Failure sending request") + return + } + + result.drc, err = client.ListForClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListForCluster", resp, "Failure responding to request") + return + } + if result.drc.hasNextLink() && result.drc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForClusterPreparer prepares the ListForCluster request. +func (client DeploymentsClient) ListForClusterPreparer(ctx context.Context, resourceGroupName string, serviceName string, version []string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if version != nil && len(version) > 0 { + queryParameters["version"] = version + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForClusterSender sends the ListForCluster request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) ListForClusterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListForClusterResponder handles the response to the ListForCluster request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) ListForClusterResponder(resp *http.Response) (result DeploymentResourceCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForClusterNextResults retrieves the next set of results, if any. +func (client DeploymentsClient) listForClusterNextResults(ctx context.Context, lastResults DeploymentResourceCollection) (result DeploymentResourceCollection, err error) { + req, err := lastResults.deploymentResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listForClusterNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listForClusterNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listForClusterNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForClusterComplete enumerates all values, automatically crossing page boundaries as required. +func (client DeploymentsClient) ListForClusterComplete(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result DeploymentResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListForCluster") + 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.ListForCluster(ctx, resourceGroupName, serviceName, version) + return +} + +// Restart restart the deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Restart(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsRestartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Restart") + 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.RestartPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Restart", nil, "Failure preparing request") + return + } + + result, err = client.RestartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Restart", result.Response(), "Failure sending request") + return + } + + return +} + +// RestartPreparer prepares the Restart request. +func (client DeploymentsClient) RestartPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestartSender sends the Restart request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) RestartSender(req *http.Request) (future DeploymentsRestartFuture, 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 +} + +// RestartResponder handles the response to the Restart request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Start start the deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Start(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Start") + 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.StartPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client DeploymentsClient) StartPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) StartSender(req *http.Request) (future DeploymentsStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// StartJFR start JFR +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +// diagnosticParameters - parameters for the diagnostic operation +func (client DeploymentsClient) StartJFR(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (result DeploymentsStartJFRFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.StartJFR") + 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.StartJFRPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "StartJFR", nil, "Failure preparing request") + return + } + + result, err = client.StartJFRSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "StartJFR", result.Response(), "Failure sending request") + return + } + + return +} + +// StartJFRPreparer prepares the StartJFR request. +func (client DeploymentsClient) StartJFRPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR", pathParameters), + autorest.WithJSON(diagnosticParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartJFRSender sends the StartJFR request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) StartJFRSender(req *http.Request) (future DeploymentsStartJFRFuture, 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 +} + +// StartJFRResponder handles the response to the StartJFR request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) StartJFRResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stop the deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +func (client DeploymentsClient) Stop(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Stop") + 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.StopPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client DeploymentsClient) StopPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client DeploymentsClient) StopSender(req *http.Request) (future DeploymentsStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client DeploymentsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update operation to update an exiting Deployment. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// appName - the name of the App resource. +// deploymentName - the name of the Deployment resource. +// deploymentResource - parameters for the update operation +func (client DeploymentsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (result DeploymentsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, deploymentResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DeploymentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "appName": autorest.Encode("path", appName), + "deploymentName": autorest.Encode("path", deploymentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", pathParameters), + autorest.WithJSON(deploymentResource), + 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 DeploymentsClient) UpdateSender(req *http.Request) (future DeploymentsUpdateFuture, 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 DeploymentsClient) UpdateResponder(resp *http.Response) (result DeploymentResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/enums.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/enums.go new file mode 100644 index 000000000000..e31babe04d7f --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/enums.go @@ -0,0 +1,710 @@ +package appplatform + +// 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. + +// ActionType enumerates the values for action type. +type ActionType string + +const ( + // Internal ... + Internal ActionType = "Internal" +) + +// PossibleActionTypeValues returns an array of possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{Internal} +} + +// APIPortalProvisioningState enumerates the values for api portal provisioning state. +type APIPortalProvisioningState string + +const ( + // Creating ... + Creating APIPortalProvisioningState = "Creating" + // Deleting ... + Deleting APIPortalProvisioningState = "Deleting" + // Failed ... + Failed APIPortalProvisioningState = "Failed" + // Succeeded ... + Succeeded APIPortalProvisioningState = "Succeeded" + // Updating ... + Updating APIPortalProvisioningState = "Updating" +) + +// PossibleAPIPortalProvisioningStateValues returns an array of possible values for the APIPortalProvisioningState const type. +func PossibleAPIPortalProvisioningStateValues() []APIPortalProvisioningState { + return []APIPortalProvisioningState{Creating, Deleting, Failed, Succeeded, Updating} +} + +// AppResourceProvisioningState enumerates the values for app resource provisioning state. +type AppResourceProvisioningState string + +const ( + // AppResourceProvisioningStateCreating ... + AppResourceProvisioningStateCreating AppResourceProvisioningState = "Creating" + // AppResourceProvisioningStateDeleting ... + AppResourceProvisioningStateDeleting AppResourceProvisioningState = "Deleting" + // AppResourceProvisioningStateFailed ... + AppResourceProvisioningStateFailed AppResourceProvisioningState = "Failed" + // AppResourceProvisioningStateSucceeded ... + AppResourceProvisioningStateSucceeded AppResourceProvisioningState = "Succeeded" + // AppResourceProvisioningStateUpdating ... + AppResourceProvisioningStateUpdating AppResourceProvisioningState = "Updating" +) + +// PossibleAppResourceProvisioningStateValues returns an array of possible values for the AppResourceProvisioningState const type. +func PossibleAppResourceProvisioningStateValues() []AppResourceProvisioningState { + return []AppResourceProvisioningState{AppResourceProvisioningStateCreating, AppResourceProvisioningStateDeleting, AppResourceProvisioningStateFailed, AppResourceProvisioningStateSucceeded, AppResourceProvisioningStateUpdating} +} + +// BindingType enumerates the values for binding type. +type BindingType string + +const ( + // ApacheSkyWalking ... + ApacheSkyWalking BindingType = "ApacheSkyWalking" + // AppDynamics ... + AppDynamics BindingType = "AppDynamics" + // ApplicationInsights ... + ApplicationInsights BindingType = "ApplicationInsights" + // Dynatrace ... + Dynatrace BindingType = "Dynatrace" + // ElasticAPM ... + ElasticAPM BindingType = "ElasticAPM" + // NewRelic ... + NewRelic BindingType = "NewRelic" +) + +// PossibleBindingTypeValues returns an array of possible values for the BindingType const type. +func PossibleBindingTypeValues() []BindingType { + return []BindingType{ApacheSkyWalking, AppDynamics, ApplicationInsights, Dynatrace, ElasticAPM, NewRelic} +} + +// BuilderProvisioningState enumerates the values for builder provisioning state. +type BuilderProvisioningState string + +const ( + // BuilderProvisioningStateCreating ... + BuilderProvisioningStateCreating BuilderProvisioningState = "Creating" + // BuilderProvisioningStateDeleting ... + BuilderProvisioningStateDeleting BuilderProvisioningState = "Deleting" + // BuilderProvisioningStateFailed ... + BuilderProvisioningStateFailed BuilderProvisioningState = "Failed" + // BuilderProvisioningStateSucceeded ... + BuilderProvisioningStateSucceeded BuilderProvisioningState = "Succeeded" + // BuilderProvisioningStateUpdating ... + BuilderProvisioningStateUpdating BuilderProvisioningState = "Updating" +) + +// PossibleBuilderProvisioningStateValues returns an array of possible values for the BuilderProvisioningState const type. +func PossibleBuilderProvisioningStateValues() []BuilderProvisioningState { + return []BuilderProvisioningState{BuilderProvisioningStateCreating, BuilderProvisioningStateDeleting, BuilderProvisioningStateFailed, BuilderProvisioningStateSucceeded, BuilderProvisioningStateUpdating} +} + +// BuildpackBindingProvisioningState enumerates the values for buildpack binding provisioning state. +type BuildpackBindingProvisioningState string + +const ( + // BuildpackBindingProvisioningStateCreating ... + BuildpackBindingProvisioningStateCreating BuildpackBindingProvisioningState = "Creating" + // BuildpackBindingProvisioningStateDeleting ... + BuildpackBindingProvisioningStateDeleting BuildpackBindingProvisioningState = "Deleting" + // BuildpackBindingProvisioningStateFailed ... + BuildpackBindingProvisioningStateFailed BuildpackBindingProvisioningState = "Failed" + // BuildpackBindingProvisioningStateSucceeded ... + BuildpackBindingProvisioningStateSucceeded BuildpackBindingProvisioningState = "Succeeded" + // BuildpackBindingProvisioningStateUpdating ... + BuildpackBindingProvisioningStateUpdating BuildpackBindingProvisioningState = "Updating" +) + +// PossibleBuildpackBindingProvisioningStateValues returns an array of possible values for the BuildpackBindingProvisioningState const type. +func PossibleBuildpackBindingProvisioningStateValues() []BuildpackBindingProvisioningState { + return []BuildpackBindingProvisioningState{BuildpackBindingProvisioningStateCreating, BuildpackBindingProvisioningStateDeleting, BuildpackBindingProvisioningStateFailed, BuildpackBindingProvisioningStateSucceeded, BuildpackBindingProvisioningStateUpdating} +} + +// BuildProvisioningState enumerates the values for build provisioning state. +type BuildProvisioningState string + +const ( + // BuildProvisioningStateCreating ... + BuildProvisioningStateCreating BuildProvisioningState = "Creating" + // BuildProvisioningStateDeleting ... + BuildProvisioningStateDeleting BuildProvisioningState = "Deleting" + // BuildProvisioningStateFailed ... + BuildProvisioningStateFailed BuildProvisioningState = "Failed" + // BuildProvisioningStateSucceeded ... + BuildProvisioningStateSucceeded BuildProvisioningState = "Succeeded" + // BuildProvisioningStateUpdating ... + BuildProvisioningStateUpdating BuildProvisioningState = "Updating" +) + +// PossibleBuildProvisioningStateValues returns an array of possible values for the BuildProvisioningState const type. +func PossibleBuildProvisioningStateValues() []BuildProvisioningState { + return []BuildProvisioningState{BuildProvisioningStateCreating, BuildProvisioningStateDeleting, BuildProvisioningStateFailed, BuildProvisioningStateSucceeded, BuildProvisioningStateUpdating} +} + +// BuildResultProvisioningState enumerates the values for build result provisioning state. +type BuildResultProvisioningState string + +const ( + // BuildResultProvisioningStateBuilding ... + BuildResultProvisioningStateBuilding BuildResultProvisioningState = "Building" + // BuildResultProvisioningStateDeleting ... + BuildResultProvisioningStateDeleting BuildResultProvisioningState = "Deleting" + // BuildResultProvisioningStateFailed ... + BuildResultProvisioningStateFailed BuildResultProvisioningState = "Failed" + // BuildResultProvisioningStateQueuing ... + BuildResultProvisioningStateQueuing BuildResultProvisioningState = "Queuing" + // BuildResultProvisioningStateSucceeded ... + BuildResultProvisioningStateSucceeded BuildResultProvisioningState = "Succeeded" +) + +// PossibleBuildResultProvisioningStateValues returns an array of possible values for the BuildResultProvisioningState const type. +func PossibleBuildResultProvisioningStateValues() []BuildResultProvisioningState { + return []BuildResultProvisioningState{BuildResultProvisioningStateBuilding, BuildResultProvisioningStateDeleting, BuildResultProvisioningStateFailed, BuildResultProvisioningStateQueuing, BuildResultProvisioningStateSucceeded} +} + +// BuildServiceProvisioningState enumerates the values for build service provisioning state. +type BuildServiceProvisioningState string + +const ( + // BuildServiceProvisioningStateCreating ... + BuildServiceProvisioningStateCreating BuildServiceProvisioningState = "Creating" + // BuildServiceProvisioningStateDeleting ... + BuildServiceProvisioningStateDeleting BuildServiceProvisioningState = "Deleting" + // BuildServiceProvisioningStateFailed ... + BuildServiceProvisioningStateFailed BuildServiceProvisioningState = "Failed" + // BuildServiceProvisioningStateSucceeded ... + BuildServiceProvisioningStateSucceeded BuildServiceProvisioningState = "Succeeded" + // BuildServiceProvisioningStateUpdating ... + BuildServiceProvisioningStateUpdating BuildServiceProvisioningState = "Updating" +) + +// PossibleBuildServiceProvisioningStateValues returns an array of possible values for the BuildServiceProvisioningState const type. +func PossibleBuildServiceProvisioningStateValues() []BuildServiceProvisioningState { + return []BuildServiceProvisioningState{BuildServiceProvisioningStateCreating, BuildServiceProvisioningStateDeleting, BuildServiceProvisioningStateFailed, BuildServiceProvisioningStateSucceeded, BuildServiceProvisioningStateUpdating} +} + +// CertificateResourceProvisioningState enumerates the values for certificate resource provisioning state. +type CertificateResourceProvisioningState string + +const ( + // CertificateResourceProvisioningStateCreating ... + CertificateResourceProvisioningStateCreating CertificateResourceProvisioningState = "Creating" + // CertificateResourceProvisioningStateDeleting ... + CertificateResourceProvisioningStateDeleting CertificateResourceProvisioningState = "Deleting" + // CertificateResourceProvisioningStateFailed ... + CertificateResourceProvisioningStateFailed CertificateResourceProvisioningState = "Failed" + // CertificateResourceProvisioningStateSucceeded ... + CertificateResourceProvisioningStateSucceeded CertificateResourceProvisioningState = "Succeeded" + // CertificateResourceProvisioningStateUpdating ... + CertificateResourceProvisioningStateUpdating CertificateResourceProvisioningState = "Updating" +) + +// PossibleCertificateResourceProvisioningStateValues returns an array of possible values for the CertificateResourceProvisioningState const type. +func PossibleCertificateResourceProvisioningStateValues() []CertificateResourceProvisioningState { + return []CertificateResourceProvisioningState{CertificateResourceProvisioningStateCreating, CertificateResourceProvisioningStateDeleting, CertificateResourceProvisioningStateFailed, CertificateResourceProvisioningStateSucceeded, CertificateResourceProvisioningStateUpdating} +} + +// ConfigServerState enumerates the values for config server state. +type ConfigServerState string + +const ( + // ConfigServerStateDeleted ... + ConfigServerStateDeleted ConfigServerState = "Deleted" + // ConfigServerStateFailed ... + ConfigServerStateFailed ConfigServerState = "Failed" + // ConfigServerStateNotAvailable ... + ConfigServerStateNotAvailable ConfigServerState = "NotAvailable" + // ConfigServerStateSucceeded ... + ConfigServerStateSucceeded ConfigServerState = "Succeeded" + // ConfigServerStateUpdating ... + ConfigServerStateUpdating ConfigServerState = "Updating" +) + +// PossibleConfigServerStateValues returns an array of possible values for the ConfigServerState const type. +func PossibleConfigServerStateValues() []ConfigServerState { + return []ConfigServerState{ConfigServerStateDeleted, ConfigServerStateFailed, ConfigServerStateNotAvailable, ConfigServerStateSucceeded, ConfigServerStateUpdating} +} + +// ConfigurationServiceProvisioningState enumerates the values for configuration service provisioning state. +type ConfigurationServiceProvisioningState string + +const ( + // ConfigurationServiceProvisioningStateCreating ... + ConfigurationServiceProvisioningStateCreating ConfigurationServiceProvisioningState = "Creating" + // ConfigurationServiceProvisioningStateDeleting ... + ConfigurationServiceProvisioningStateDeleting ConfigurationServiceProvisioningState = "Deleting" + // ConfigurationServiceProvisioningStateFailed ... + ConfigurationServiceProvisioningStateFailed ConfigurationServiceProvisioningState = "Failed" + // ConfigurationServiceProvisioningStateSucceeded ... + ConfigurationServiceProvisioningStateSucceeded ConfigurationServiceProvisioningState = "Succeeded" + // ConfigurationServiceProvisioningStateUpdating ... + ConfigurationServiceProvisioningStateUpdating ConfigurationServiceProvisioningState = "Updating" +) + +// PossibleConfigurationServiceProvisioningStateValues returns an array of possible values for the ConfigurationServiceProvisioningState const type. +func PossibleConfigurationServiceProvisioningStateValues() []ConfigurationServiceProvisioningState { + return []ConfigurationServiceProvisioningState{ConfigurationServiceProvisioningStateCreating, ConfigurationServiceProvisioningStateDeleting, ConfigurationServiceProvisioningStateFailed, ConfigurationServiceProvisioningStateSucceeded, ConfigurationServiceProvisioningStateUpdating} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// CustomDomainResourceProvisioningState enumerates the values for custom domain resource provisioning state. +type CustomDomainResourceProvisioningState string + +const ( + // CustomDomainResourceProvisioningStateCreating ... + CustomDomainResourceProvisioningStateCreating CustomDomainResourceProvisioningState = "Creating" + // CustomDomainResourceProvisioningStateDeleting ... + CustomDomainResourceProvisioningStateDeleting CustomDomainResourceProvisioningState = "Deleting" + // CustomDomainResourceProvisioningStateFailed ... + CustomDomainResourceProvisioningStateFailed CustomDomainResourceProvisioningState = "Failed" + // CustomDomainResourceProvisioningStateSucceeded ... + CustomDomainResourceProvisioningStateSucceeded CustomDomainResourceProvisioningState = "Succeeded" + // CustomDomainResourceProvisioningStateUpdating ... + CustomDomainResourceProvisioningStateUpdating CustomDomainResourceProvisioningState = "Updating" +) + +// PossibleCustomDomainResourceProvisioningStateValues returns an array of possible values for the CustomDomainResourceProvisioningState const type. +func PossibleCustomDomainResourceProvisioningStateValues() []CustomDomainResourceProvisioningState { + return []CustomDomainResourceProvisioningState{CustomDomainResourceProvisioningStateCreating, CustomDomainResourceProvisioningStateDeleting, CustomDomainResourceProvisioningStateFailed, CustomDomainResourceProvisioningStateSucceeded, CustomDomainResourceProvisioningStateUpdating} +} + +// DeploymentResourceProvisioningState enumerates the values for deployment resource provisioning state. +type DeploymentResourceProvisioningState string + +const ( + // DeploymentResourceProvisioningStateCreating ... + DeploymentResourceProvisioningStateCreating DeploymentResourceProvisioningState = "Creating" + // DeploymentResourceProvisioningStateFailed ... + DeploymentResourceProvisioningStateFailed DeploymentResourceProvisioningState = "Failed" + // DeploymentResourceProvisioningStateSucceeded ... + DeploymentResourceProvisioningStateSucceeded DeploymentResourceProvisioningState = "Succeeded" + // DeploymentResourceProvisioningStateUpdating ... + DeploymentResourceProvisioningStateUpdating DeploymentResourceProvisioningState = "Updating" +) + +// PossibleDeploymentResourceProvisioningStateValues returns an array of possible values for the DeploymentResourceProvisioningState const type. +func PossibleDeploymentResourceProvisioningStateValues() []DeploymentResourceProvisioningState { + return []DeploymentResourceProvisioningState{DeploymentResourceProvisioningStateCreating, DeploymentResourceProvisioningStateFailed, DeploymentResourceProvisioningStateSucceeded, DeploymentResourceProvisioningStateUpdating} +} + +// DeploymentResourceStatus enumerates the values for deployment resource status. +type DeploymentResourceStatus string + +const ( + // Running ... + Running DeploymentResourceStatus = "Running" + // Stopped ... + Stopped DeploymentResourceStatus = "Stopped" +) + +// PossibleDeploymentResourceStatusValues returns an array of possible values for the DeploymentResourceStatus const type. +func PossibleDeploymentResourceStatusValues() []DeploymentResourceStatus { + return []DeploymentResourceStatus{Running, Stopped} +} + +// GatewayProvisioningState enumerates the values for gateway provisioning state. +type GatewayProvisioningState string + +const ( + // GatewayProvisioningStateCreating ... + GatewayProvisioningStateCreating GatewayProvisioningState = "Creating" + // GatewayProvisioningStateDeleting ... + GatewayProvisioningStateDeleting GatewayProvisioningState = "Deleting" + // GatewayProvisioningStateFailed ... + GatewayProvisioningStateFailed GatewayProvisioningState = "Failed" + // GatewayProvisioningStateSucceeded ... + GatewayProvisioningStateSucceeded GatewayProvisioningState = "Succeeded" + // GatewayProvisioningStateUpdating ... + GatewayProvisioningStateUpdating GatewayProvisioningState = "Updating" +) + +// PossibleGatewayProvisioningStateValues returns an array of possible values for the GatewayProvisioningState const type. +func PossibleGatewayProvisioningStateValues() []GatewayProvisioningState { + return []GatewayProvisioningState{GatewayProvisioningStateCreating, GatewayProvisioningStateDeleting, GatewayProvisioningStateFailed, GatewayProvisioningStateSucceeded, GatewayProvisioningStateUpdating} +} + +// HTTPSchemeType enumerates the values for http scheme type. +type HTTPSchemeType string + +const ( + // HTTP ... + HTTP HTTPSchemeType = "HTTP" + // HTTPS ... + HTTPS HTTPSchemeType = "HTTPS" +) + +// PossibleHTTPSchemeTypeValues returns an array of possible values for the HTTPSchemeType const type. +func PossibleHTTPSchemeTypeValues() []HTTPSchemeType { + return []HTTPSchemeType{HTTP, HTTPS} +} + +// KPackBuildStageProvisioningState enumerates the values for k pack build stage provisioning state. +type KPackBuildStageProvisioningState string + +const ( + // KPackBuildStageProvisioningStateFailed ... + KPackBuildStageProvisioningStateFailed KPackBuildStageProvisioningState = "Failed" + // KPackBuildStageProvisioningStateNotStarted ... + KPackBuildStageProvisioningStateNotStarted KPackBuildStageProvisioningState = "NotStarted" + // KPackBuildStageProvisioningStateRunning ... + KPackBuildStageProvisioningStateRunning KPackBuildStageProvisioningState = "Running" + // KPackBuildStageProvisioningStateSucceeded ... + KPackBuildStageProvisioningStateSucceeded KPackBuildStageProvisioningState = "Succeeded" +) + +// PossibleKPackBuildStageProvisioningStateValues returns an array of possible values for the KPackBuildStageProvisioningState const type. +func PossibleKPackBuildStageProvisioningStateValues() []KPackBuildStageProvisioningState { + return []KPackBuildStageProvisioningState{KPackBuildStageProvisioningStateFailed, KPackBuildStageProvisioningStateNotStarted, KPackBuildStageProvisioningStateRunning, KPackBuildStageProvisioningStateSucceeded} +} + +// LastModifiedByType enumerates the values for last modified by type. +type LastModifiedByType string + +const ( + // LastModifiedByTypeApplication ... + LastModifiedByTypeApplication LastModifiedByType = "Application" + // LastModifiedByTypeKey ... + LastModifiedByTypeKey LastModifiedByType = "Key" + // LastModifiedByTypeManagedIdentity ... + LastModifiedByTypeManagedIdentity LastModifiedByType = "ManagedIdentity" + // LastModifiedByTypeUser ... + LastModifiedByTypeUser LastModifiedByType = "User" +) + +// PossibleLastModifiedByTypeValues returns an array of possible values for the LastModifiedByType const type. +func PossibleLastModifiedByTypeValues() []LastModifiedByType { + return []LastModifiedByType{LastModifiedByTypeApplication, LastModifiedByTypeKey, LastModifiedByTypeManagedIdentity, LastModifiedByTypeUser} +} + +// ManagedIdentityType enumerates the values for managed identity type. +type ManagedIdentityType string + +const ( + // None ... + None ManagedIdentityType = "None" + // SystemAssigned ... + SystemAssigned ManagedIdentityType = "SystemAssigned" + // SystemAssignedUserAssigned ... + SystemAssignedUserAssigned ManagedIdentityType = "SystemAssigned,UserAssigned" + // UserAssigned ... + UserAssigned ManagedIdentityType = "UserAssigned" +) + +// PossibleManagedIdentityTypeValues returns an array of possible values for the ManagedIdentityType const type. +func PossibleManagedIdentityTypeValues() []ManagedIdentityType { + return []ManagedIdentityType{None, SystemAssigned, SystemAssignedUserAssigned, UserAssigned} +} + +// MonitoringSettingState enumerates the values for monitoring setting state. +type MonitoringSettingState string + +const ( + // MonitoringSettingStateFailed ... + MonitoringSettingStateFailed MonitoringSettingState = "Failed" + // MonitoringSettingStateNotAvailable ... + MonitoringSettingStateNotAvailable MonitoringSettingState = "NotAvailable" + // MonitoringSettingStateSucceeded ... + MonitoringSettingStateSucceeded MonitoringSettingState = "Succeeded" + // MonitoringSettingStateUpdating ... + MonitoringSettingStateUpdating MonitoringSettingState = "Updating" +) + +// PossibleMonitoringSettingStateValues returns an array of possible values for the MonitoringSettingState const type. +func PossibleMonitoringSettingStateValues() []MonitoringSettingState { + return []MonitoringSettingState{MonitoringSettingStateFailed, MonitoringSettingStateNotAvailable, MonitoringSettingStateSucceeded, MonitoringSettingStateUpdating} +} + +// PowerState enumerates the values for power state. +type PowerState string + +const ( + // PowerStateRunning ... + PowerStateRunning PowerState = "Running" + // PowerStateStopped ... + PowerStateStopped PowerState = "Stopped" +) + +// PossiblePowerStateValues returns an array of possible values for the PowerState const type. +func PossiblePowerStateValues() []PowerState { + return []PowerState{PowerStateRunning, PowerStateStopped} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted ... + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateMoved ... + ProvisioningStateMoved ProvisioningState = "Moved" + // ProvisioningStateMoveFailed ... + ProvisioningStateMoveFailed ProvisioningState = "MoveFailed" + // ProvisioningStateMoving ... + ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateStarting ... + ProvisioningStateStarting ProvisioningState = "Starting" + // ProvisioningStateStopping ... + ProvisioningStateStopping ProvisioningState = "Stopping" + // 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, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoved, ProvisioningStateMoveFailed, ProvisioningStateMoving, ProvisioningStateStarting, ProvisioningStateStopping, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code. +type ResourceSkuRestrictionsReasonCode string + +const ( + // NotAvailableForSubscription ... + NotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription" + // QuotaID ... + QuotaID ResourceSkuRestrictionsReasonCode = "QuotaId" +) + +// PossibleResourceSkuRestrictionsReasonCodeValues returns an array of possible values for the ResourceSkuRestrictionsReasonCode const type. +func PossibleResourceSkuRestrictionsReasonCodeValues() []ResourceSkuRestrictionsReasonCode { + return []ResourceSkuRestrictionsReasonCode{NotAvailableForSubscription, QuotaID} +} + +// ResourceSkuRestrictionsType enumerates the values for resource sku restrictions type. +type ResourceSkuRestrictionsType string + +const ( + // Location ... + Location ResourceSkuRestrictionsType = "Location" + // Zone ... + Zone ResourceSkuRestrictionsType = "Zone" +) + +// PossibleResourceSkuRestrictionsTypeValues returns an array of possible values for the ResourceSkuRestrictionsType const type. +func PossibleResourceSkuRestrictionsTypeValues() []ResourceSkuRestrictionsType { + return []ResourceSkuRestrictionsType{Location, Zone} +} + +// ServiceRegistryProvisioningState enumerates the values for service registry provisioning state. +type ServiceRegistryProvisioningState string + +const ( + // ServiceRegistryProvisioningStateCreating ... + ServiceRegistryProvisioningStateCreating ServiceRegistryProvisioningState = "Creating" + // ServiceRegistryProvisioningStateDeleting ... + ServiceRegistryProvisioningStateDeleting ServiceRegistryProvisioningState = "Deleting" + // ServiceRegistryProvisioningStateFailed ... + ServiceRegistryProvisioningStateFailed ServiceRegistryProvisioningState = "Failed" + // ServiceRegistryProvisioningStateSucceeded ... + ServiceRegistryProvisioningStateSucceeded ServiceRegistryProvisioningState = "Succeeded" + // ServiceRegistryProvisioningStateUpdating ... + ServiceRegistryProvisioningStateUpdating ServiceRegistryProvisioningState = "Updating" +) + +// PossibleServiceRegistryProvisioningStateValues returns an array of possible values for the ServiceRegistryProvisioningState const type. +func PossibleServiceRegistryProvisioningStateValues() []ServiceRegistryProvisioningState { + return []ServiceRegistryProvisioningState{ServiceRegistryProvisioningStateCreating, ServiceRegistryProvisioningStateDeleting, ServiceRegistryProvisioningStateFailed, ServiceRegistryProvisioningStateSucceeded, ServiceRegistryProvisioningStateUpdating} +} + +// SkuScaleType enumerates the values for sku scale type. +type SkuScaleType string + +const ( + // SkuScaleTypeAutomatic ... + SkuScaleTypeAutomatic SkuScaleType = "Automatic" + // SkuScaleTypeManual ... + SkuScaleTypeManual SkuScaleType = "Manual" + // SkuScaleTypeNone ... + SkuScaleTypeNone SkuScaleType = "None" +) + +// PossibleSkuScaleTypeValues returns an array of possible values for the SkuScaleType const type. +func PossibleSkuScaleTypeValues() []SkuScaleType { + return []SkuScaleType{SkuScaleTypeAutomatic, SkuScaleTypeManual, SkuScaleTypeNone} +} + +// StorageType enumerates the values for storage type. +type StorageType string + +const ( + // StorageTypeStorageAccount ... + StorageTypeStorageAccount StorageType = "StorageAccount" + // StorageTypeStorageProperties ... + StorageTypeStorageProperties StorageType = "StorageProperties" +) + +// PossibleStorageTypeValues returns an array of possible values for the StorageType const type. +func PossibleStorageTypeValues() []StorageType { + return []StorageType{StorageTypeStorageAccount, StorageTypeStorageProperties} +} + +// SupportedRuntimePlatform enumerates the values for supported runtime platform. +type SupportedRuntimePlatform string + +const ( + // Java ... + Java SupportedRuntimePlatform = "Java" + // NETCore ... + NETCore SupportedRuntimePlatform = ".NET Core" +) + +// PossibleSupportedRuntimePlatformValues returns an array of possible values for the SupportedRuntimePlatform const type. +func PossibleSupportedRuntimePlatformValues() []SupportedRuntimePlatform { + return []SupportedRuntimePlatform{Java, NETCore} +} + +// SupportedRuntimeValue enumerates the values for supported runtime value. +type SupportedRuntimeValue string + +const ( + // Java11 ... + Java11 SupportedRuntimeValue = "Java_11" + // Java17 ... + Java17 SupportedRuntimeValue = "Java_17" + // Java8 ... + Java8 SupportedRuntimeValue = "Java_8" + // NetCore31 ... + NetCore31 SupportedRuntimeValue = "NetCore_31" +) + +// PossibleSupportedRuntimeValueValues returns an array of possible values for the SupportedRuntimeValue const type. +func PossibleSupportedRuntimeValueValues() []SupportedRuntimeValue { + return []SupportedRuntimeValue{Java11, Java17, Java8, NetCore31} +} + +// TestKeyType enumerates the values for test key type. +type TestKeyType string + +const ( + // Primary ... + Primary TestKeyType = "Primary" + // Secondary ... + Secondary TestKeyType = "Secondary" +) + +// PossibleTestKeyTypeValues returns an array of possible values for the TestKeyType const type. +func PossibleTestKeyTypeValues() []TestKeyType { + return []TestKeyType{Primary, Secondary} +} + +// TrafficDirection enumerates the values for traffic direction. +type TrafficDirection string + +const ( + // Inbound ... + Inbound TrafficDirection = "Inbound" + // Outbound ... + Outbound TrafficDirection = "Outbound" +) + +// PossibleTrafficDirectionValues returns an array of possible values for the TrafficDirection const type. +func PossibleTrafficDirectionValues() []TrafficDirection { + return []TrafficDirection{Inbound, Outbound} +} + +// Type enumerates the values for type. +type Type string + +const ( + // TypeAzureFileVolume ... + TypeAzureFileVolume Type = "AzureFileVolume" + // TypeCustomPersistentDiskProperties ... + TypeCustomPersistentDiskProperties Type = "CustomPersistentDiskProperties" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{TypeAzureFileVolume, TypeCustomPersistentDiskProperties} +} + +// TypeBasicCertificateProperties enumerates the values for type basic certificate properties. +type TypeBasicCertificateProperties string + +const ( + // TypeCertificateProperties ... + TypeCertificateProperties TypeBasicCertificateProperties = "CertificateProperties" + // TypeContentCertificate ... + TypeContentCertificate TypeBasicCertificateProperties = "ContentCertificate" + // TypeKeyVaultCertificate ... + TypeKeyVaultCertificate TypeBasicCertificateProperties = "KeyVaultCertificate" +) + +// PossibleTypeBasicCertificatePropertiesValues returns an array of possible values for the TypeBasicCertificateProperties const type. +func PossibleTypeBasicCertificatePropertiesValues() []TypeBasicCertificateProperties { + return []TypeBasicCertificateProperties{TypeCertificateProperties, TypeContentCertificate, TypeKeyVaultCertificate} +} + +// TypeBasicProbeAction enumerates the values for type basic probe action. +type TypeBasicProbeAction string + +const ( + // TypeExecAction ... + TypeExecAction TypeBasicProbeAction = "ExecAction" + // TypeHTTPGetAction ... + TypeHTTPGetAction TypeBasicProbeAction = "HTTPGetAction" + // TypeProbeAction ... + TypeProbeAction TypeBasicProbeAction = "ProbeAction" + // TypeTCPSocketAction ... + TypeTCPSocketAction TypeBasicProbeAction = "TCPSocketAction" +) + +// PossibleTypeBasicProbeActionValues returns an array of possible values for the TypeBasicProbeAction const type. +func PossibleTypeBasicProbeActionValues() []TypeBasicProbeAction { + return []TypeBasicProbeAction{TypeExecAction, TypeHTTPGetAction, TypeProbeAction, TypeTCPSocketAction} +} + +// TypeBasicUserSourceInfo enumerates the values for type basic user source info. +type TypeBasicUserSourceInfo string + +const ( + // TypeBuildResult ... + TypeBuildResult TypeBasicUserSourceInfo = "BuildResult" + // TypeContainer ... + TypeContainer TypeBasicUserSourceInfo = "Container" + // TypeJar ... + TypeJar TypeBasicUserSourceInfo = "Jar" + // TypeNetCoreZip ... + TypeNetCoreZip TypeBasicUserSourceInfo = "NetCoreZip" + // TypeSource ... + TypeSource TypeBasicUserSourceInfo = "Source" + // TypeUploadedUserSourceInfo ... + TypeUploadedUserSourceInfo TypeBasicUserSourceInfo = "UploadedUserSourceInfo" + // TypeUserSourceInfo ... + TypeUserSourceInfo TypeBasicUserSourceInfo = "UserSourceInfo" +) + +// PossibleTypeBasicUserSourceInfoValues returns an array of possible values for the TypeBasicUserSourceInfo const type. +func PossibleTypeBasicUserSourceInfoValues() []TypeBasicUserSourceInfo { + return []TypeBasicUserSourceInfo{TypeBuildResult, TypeContainer, TypeJar, TypeNetCoreZip, TypeSource, TypeUploadedUserSourceInfo, TypeUserSourceInfo} +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gatewaycustomdomains.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gatewaycustomdomains.go new file mode 100644 index 000000000000..2ba9a4e5b900 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gatewaycustomdomains.go @@ -0,0 +1,404 @@ +package appplatform + +// 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" +) + +// GatewayCustomDomainsClient is the REST API for Azure Spring Apps +type GatewayCustomDomainsClient struct { + BaseClient +} + +// NewGatewayCustomDomainsClient creates an instance of the GatewayCustomDomainsClient client. +func NewGatewayCustomDomainsClient(subscriptionID string) GatewayCustomDomainsClient { + return NewGatewayCustomDomainsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGatewayCustomDomainsClientWithBaseURI creates an instance of the GatewayCustomDomainsClient 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 NewGatewayCustomDomainsClientWithBaseURI(baseURI string, subscriptionID string) GatewayCustomDomainsClient { + return GatewayCustomDomainsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update the Spring Cloud Gateway custom domain. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// gatewayName - the name of Spring Cloud Gateway. +// domainName - the name of the Spring Cloud Gateway custom domain. +// gatewayCustomDomainResource - the gateway custom domain resource for the create or update operation +func (client GatewayCustomDomainsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, domainName string, gatewayCustomDomainResource GatewayCustomDomainResource) (result GatewayCustomDomainsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCustomDomainsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, gatewayName, domainName, gatewayCustomDomainResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GatewayCustomDomainsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, domainName string, gatewayCustomDomainResource GatewayCustomDomainResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", pathParameters), + autorest.WithJSON(gatewayCustomDomainResource), + 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 GatewayCustomDomainsClient) CreateOrUpdateSender(req *http.Request) (future GatewayCustomDomainsCreateOrUpdateFuture, 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 GatewayCustomDomainsClient) CreateOrUpdateResponder(resp *http.Response) (result GatewayCustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the Spring Cloud Gateway custom domain. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// gatewayName - the name of Spring Cloud Gateway. +// domainName - the name of the Spring Cloud Gateway custom domain. +func (client GatewayCustomDomainsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, domainName string) (result GatewayCustomDomainsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCustomDomainsClient.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, serviceName, gatewayName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GatewayCustomDomainsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client GatewayCustomDomainsClient) DeleteSender(req *http.Request) (future GatewayCustomDomainsDeleteFuture, 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 GatewayCustomDomainsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the Spring Cloud Gateway custom domain. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// gatewayName - the name of Spring Cloud Gateway. +// domainName - the name of the Spring Cloud Gateway custom domain. +func (client GatewayCustomDomainsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, domainName string) (result GatewayCustomDomainResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCustomDomainsClient.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, serviceName, gatewayName, domainName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client GatewayCustomDomainsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, domainName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainName": autorest.Encode("path", domainName), + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client GatewayCustomDomainsClient) 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 GatewayCustomDomainsClient) GetResponder(resp *http.Response) (result GatewayCustomDomainResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handle requests to list all Spring Cloud Gateway custom domains. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// gatewayName - the name of Spring Cloud Gateway. +func (client GatewayCustomDomainsClient) List(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (result GatewayCustomDomainResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCustomDomainsClient.List") + defer func() { + sc := -1 + if result.gcdrc.Response.Response != nil { + sc = result.gcdrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.gcdrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsClient", "List", resp, "Failure sending request") + return + } + + result.gcdrc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsClient", "List", resp, "Failure responding to request") + return + } + if result.gcdrc.hasNextLink() && result.gcdrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client GatewayCustomDomainsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains", 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 GatewayCustomDomainsClient) 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 GatewayCustomDomainsClient) ListResponder(resp *http.Response) (result GatewayCustomDomainResourceCollection, 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 GatewayCustomDomainsClient) listNextResults(ctx context.Context, lastResults GatewayCustomDomainResourceCollection) (result GatewayCustomDomainResourceCollection, err error) { + req, err := lastResults.gatewayCustomDomainResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsClient", "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, "appplatform.GatewayCustomDomainsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client GatewayCustomDomainsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (result GatewayCustomDomainResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCustomDomainsClient.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, serviceName, gatewayName) + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gatewayrouteconfigs.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gatewayrouteconfigs.go new file mode 100644 index 000000000000..1f80054fa1a1 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gatewayrouteconfigs.go @@ -0,0 +1,405 @@ +package appplatform + +// 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" +) + +// GatewayRouteConfigsClient is the REST API for Azure Spring Apps +type GatewayRouteConfigsClient struct { + BaseClient +} + +// NewGatewayRouteConfigsClient creates an instance of the GatewayRouteConfigsClient client. +func NewGatewayRouteConfigsClient(subscriptionID string) GatewayRouteConfigsClient { + return NewGatewayRouteConfigsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGatewayRouteConfigsClientWithBaseURI creates an instance of the GatewayRouteConfigsClient 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 NewGatewayRouteConfigsClientWithBaseURI(baseURI string, subscriptionID string) GatewayRouteConfigsClient { + return GatewayRouteConfigsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the default Spring Cloud Gateway route configs or update the existing Spring Cloud Gateway +// route configs. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// gatewayName - the name of Spring Cloud Gateway. +// routeConfigName - the name of the Spring Cloud Gateway route config. +// gatewayRouteConfigResource - the Spring Cloud Gateway route config for the create or update operation +func (client GatewayRouteConfigsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, routeConfigName string, gatewayRouteConfigResource GatewayRouteConfigResource) (result GatewayRouteConfigsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayRouteConfigsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, gatewayName, routeConfigName, gatewayRouteConfigResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GatewayRouteConfigsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, routeConfigName string, gatewayRouteConfigResource GatewayRouteConfigResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeConfigName": autorest.Encode("path", routeConfigName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", pathParameters), + autorest.WithJSON(gatewayRouteConfigResource), + 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 GatewayRouteConfigsClient) CreateOrUpdateSender(req *http.Request) (future GatewayRouteConfigsCreateOrUpdateFuture, 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 GatewayRouteConfigsClient) CreateOrUpdateResponder(resp *http.Response) (result GatewayRouteConfigResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the Spring Cloud Gateway route config. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// gatewayName - the name of Spring Cloud Gateway. +// routeConfigName - the name of the Spring Cloud Gateway route config. +func (client GatewayRouteConfigsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, routeConfigName string) (result GatewayRouteConfigsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayRouteConfigsClient.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, serviceName, gatewayName, routeConfigName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GatewayRouteConfigsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, routeConfigName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeConfigName": autorest.Encode("path", routeConfigName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", 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 GatewayRouteConfigsClient) DeleteSender(req *http.Request) (future GatewayRouteConfigsDeleteFuture, 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 GatewayRouteConfigsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the Spring Cloud Gateway route configs. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// gatewayName - the name of Spring Cloud Gateway. +// routeConfigName - the name of the Spring Cloud Gateway route config. +func (client GatewayRouteConfigsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, routeConfigName string) (result GatewayRouteConfigResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayRouteConfigsClient.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, serviceName, gatewayName, routeConfigName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client GatewayRouteConfigsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, routeConfigName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeConfigName": autorest.Encode("path", routeConfigName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}", 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 GatewayRouteConfigsClient) 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 GatewayRouteConfigsClient) GetResponder(resp *http.Response) (result GatewayRouteConfigResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handle requests to list all Spring Cloud Gateway route configs. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// gatewayName - the name of Spring Cloud Gateway. +func (client GatewayRouteConfigsClient) List(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (result GatewayRouteConfigResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayRouteConfigsClient.List") + defer func() { + sc := -1 + if result.grcrc.Response.Response != nil { + sc = result.grcrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.grcrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsClient", "List", resp, "Failure sending request") + return + } + + result.grcrc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsClient", "List", resp, "Failure responding to request") + return + } + if result.grcrc.hasNextLink() && result.grcrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client GatewayRouteConfigsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs", 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 GatewayRouteConfigsClient) 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 GatewayRouteConfigsClient) ListResponder(resp *http.Response) (result GatewayRouteConfigResourceCollection, 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 GatewayRouteConfigsClient) listNextResults(ctx context.Context, lastResults GatewayRouteConfigResourceCollection) (result GatewayRouteConfigResourceCollection, err error) { + req, err := lastResults.gatewayRouteConfigResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsClient", "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, "appplatform.GatewayRouteConfigsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client GatewayRouteConfigsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (result GatewayRouteConfigResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayRouteConfigsClient.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, serviceName, gatewayName) + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gateways.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gateways.go new file mode 100644 index 000000000000..31fb4c9e4aae --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/gateways.go @@ -0,0 +1,484 @@ +package appplatform + +// 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" +) + +// GatewaysClient is the REST API for Azure Spring Apps +type GatewaysClient struct { + BaseClient +} + +// NewGatewaysClient creates an instance of the GatewaysClient client. +func NewGatewaysClient(subscriptionID string) GatewaysClient { + return NewGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewGatewaysClientWithBaseURI creates an instance of the GatewaysClient 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 NewGatewaysClientWithBaseURI(baseURI string, subscriptionID string) GatewaysClient { + return GatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// gatewayName - the name of Spring Cloud Gateway. +// gatewayResource - the gateway for the create or update operation +func (client GatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, gatewayResource GatewayResource) (result GatewaysCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewaysClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, gatewayName, gatewayResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client GatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, gatewayResource GatewayResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", pathParameters), + autorest.WithJSON(gatewayResource), + 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 GatewaysClient) CreateOrUpdateSender(req *http.Request) (future GatewaysCreateOrUpdateFuture, 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 GatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result GatewayResource, 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 disable the default Spring Cloud Gateway. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// gatewayName - the name of Spring Cloud Gateway. +func (client GatewaysClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (result GatewaysDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewaysClient.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, serviceName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client GatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", 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 GatewaysClient) DeleteSender(req *http.Request) (future GatewaysDeleteFuture, 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 GatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the Spring Cloud Gateway and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// gatewayName - the name of Spring Cloud Gateway. +func (client GatewaysClient) Get(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (result GatewayResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewaysClient.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, serviceName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client GatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}", 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 GatewaysClient) 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 GatewaysClient) GetResponder(resp *http.Response) (result GatewayResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client GatewaysClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result GatewayResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewaysClient.List") + defer func() { + sc := -1 + if result.grc.Response.Response != nil { + sc = result.grc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.grc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "List", resp, "Failure sending request") + return + } + + result.grc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "List", resp, "Failure responding to request") + return + } + if result.grc.hasNextLink() && result.grc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client GatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways", 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 GatewaysClient) 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 GatewaysClient) ListResponder(resp *http.Response) (result GatewayResourceCollection, 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 GatewaysClient) listNextResults(ctx context.Context, lastResults GatewayResourceCollection) (result GatewayResourceCollection, err error) { + req, err := lastResults.gatewayResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "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, "appplatform.GatewaysClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client GatewaysClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result GatewayResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewaysClient.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, serviceName) + return +} + +// ValidateDomain check the domains are valid as well as not in use. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// gatewayName - the name of Spring Cloud Gateway. +// validatePayload - custom domain payload to be validated +func (client GatewaysClient) ValidateDomain(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, validatePayload CustomDomainValidatePayload) (result CustomDomainValidateResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewaysClient.ValidateDomain") + 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: validatePayload, + Constraints: []validation.Constraint{{Target: "validatePayload.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("appplatform.GatewaysClient", "ValidateDomain", err.Error()) + } + + req, err := client.ValidateDomainPreparer(ctx, resourceGroupName, serviceName, gatewayName, validatePayload) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "ValidateDomain", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateDomainSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "ValidateDomain", resp, "Failure sending request") + return + } + + result, err = client.ValidateDomainResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysClient", "ValidateDomain", resp, "Failure responding to request") + return + } + + return +} + +// ValidateDomainPreparer prepares the ValidateDomain request. +func (client GatewaysClient) ValidateDomainPreparer(ctx context.Context, resourceGroupName string, serviceName string, gatewayName string, validatePayload CustomDomainValidatePayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain", pathParameters), + autorest.WithJSON(validatePayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateDomainSender sends the ValidateDomain request. The method will close the +// http.Response Body if it receives an error. +func (client GatewaysClient) ValidateDomainSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateDomainResponder handles the response to the ValidateDomain request. The method always +// closes the http.Response Body. +func (client GatewaysClient) ValidateDomainResponder(resp *http.Response) (result CustomDomainValidateResult, 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/appplatform/mgmt/2022-05-01-preview/appplatform/models.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/models.go new file mode 100644 index 000000000000..b1bf359d5b3d --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/models.go @@ -0,0 +1,9834 @@ +package appplatform + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform" + +// ActiveDeploymentCollection object that includes an array of Deployment resource name and set them as +// active. +type ActiveDeploymentCollection struct { + // ActiveDeploymentNames - Collection of Deployment name. + ActiveDeploymentNames *[]string `json:"activeDeploymentNames,omitempty"` +} + +// APIPortalCustomDomainProperties the properties of custom domain for API portal +type APIPortalCustomDomainProperties struct { + // Thumbprint - The thumbprint of bound certificate. + Thumbprint *string `json:"thumbprint,omitempty"` +} + +// APIPortalCustomDomainResource custom domain of the API portal +type APIPortalCustomDomainResource struct { + autorest.Response `json:"-"` + Properties *APIPortalCustomDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIPortalCustomDomainResource. +func (apcdr APIPortalCustomDomainResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apcdr.Properties != nil { + objectMap["properties"] = apcdr.Properties + } + if apcdr.SystemData != nil { + objectMap["systemData"] = apcdr.SystemData + } + return json.Marshal(objectMap) +} + +// APIPortalCustomDomainResourceCollection object that includes an array of API portal custom domain +// resources and a possible link for next set +type APIPortalCustomDomainResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of API portal custom domain resources + Value *[]APIPortalCustomDomainResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// APIPortalCustomDomainResourceCollectionIterator provides access to a complete listing of +// APIPortalCustomDomainResource values. +type APIPortalCustomDomainResourceCollectionIterator struct { + i int + page APIPortalCustomDomainResourceCollectionPage +} + +// 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 *APIPortalCustomDomainResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalCustomDomainResourceCollectionIterator.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 *APIPortalCustomDomainResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter APIPortalCustomDomainResourceCollectionIterator) 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 APIPortalCustomDomainResourceCollectionIterator) Response() APIPortalCustomDomainResourceCollection { + 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 APIPortalCustomDomainResourceCollectionIterator) Value() APIPortalCustomDomainResource { + if !iter.page.NotDone() { + return APIPortalCustomDomainResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the APIPortalCustomDomainResourceCollectionIterator type. +func NewAPIPortalCustomDomainResourceCollectionIterator(page APIPortalCustomDomainResourceCollectionPage) APIPortalCustomDomainResourceCollectionIterator { + return APIPortalCustomDomainResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (apcdrc APIPortalCustomDomainResourceCollection) IsEmpty() bool { + return apcdrc.Value == nil || len(*apcdrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (apcdrc APIPortalCustomDomainResourceCollection) hasNextLink() bool { + return apcdrc.NextLink != nil && len(*apcdrc.NextLink) != 0 +} + +// aPIPortalCustomDomainResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (apcdrc APIPortalCustomDomainResourceCollection) aPIPortalCustomDomainResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !apcdrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(apcdrc.NextLink))) +} + +// APIPortalCustomDomainResourceCollectionPage contains a page of APIPortalCustomDomainResource values. +type APIPortalCustomDomainResourceCollectionPage struct { + fn func(context.Context, APIPortalCustomDomainResourceCollection) (APIPortalCustomDomainResourceCollection, error) + apcdrc APIPortalCustomDomainResourceCollection +} + +// 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 *APIPortalCustomDomainResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalCustomDomainResourceCollectionPage.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.apcdrc) + if err != nil { + return err + } + page.apcdrc = 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 *APIPortalCustomDomainResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page APIPortalCustomDomainResourceCollectionPage) NotDone() bool { + return !page.apcdrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page APIPortalCustomDomainResourceCollectionPage) Response() APIPortalCustomDomainResourceCollection { + return page.apcdrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page APIPortalCustomDomainResourceCollectionPage) Values() []APIPortalCustomDomainResource { + if page.apcdrc.IsEmpty() { + return nil + } + return *page.apcdrc.Value +} + +// Creates a new instance of the APIPortalCustomDomainResourceCollectionPage type. +func NewAPIPortalCustomDomainResourceCollectionPage(cur APIPortalCustomDomainResourceCollection, getNextPage func(context.Context, APIPortalCustomDomainResourceCollection) (APIPortalCustomDomainResourceCollection, error)) APIPortalCustomDomainResourceCollectionPage { + return APIPortalCustomDomainResourceCollectionPage{ + fn: getNextPage, + apcdrc: cur, + } +} + +// APIPortalCustomDomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type APIPortalCustomDomainsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(APIPortalCustomDomainsClient) (APIPortalCustomDomainResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *APIPortalCustomDomainsCreateOrUpdateFuture) 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 APIPortalCustomDomainsCreateOrUpdateFuture.Result. +func (future *APIPortalCustomDomainsCreateOrUpdateFuture) result(client APIPortalCustomDomainsClient) (apcdr APIPortalCustomDomainResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + apcdr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.APIPortalCustomDomainsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if apcdr.Response.Response, err = future.GetResult(sender); err == nil && apcdr.Response.Response.StatusCode != http.StatusNoContent { + apcdr, err = client.CreateOrUpdateResponder(apcdr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsCreateOrUpdateFuture", "Result", apcdr.Response.Response, "Failure responding to request") + } + } + return +} + +// APIPortalCustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type APIPortalCustomDomainsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(APIPortalCustomDomainsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *APIPortalCustomDomainsDeleteFuture) 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 APIPortalCustomDomainsDeleteFuture.Result. +func (future *APIPortalCustomDomainsDeleteFuture) result(client APIPortalCustomDomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalCustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.APIPortalCustomDomainsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// APIPortalInstance collection of instances belong to the API portal +type APIPortalInstance struct { + // Name - READ-ONLY; Name of the API portal instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the API portal instance + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIPortalInstance. +func (API APIPortalInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// APIPortalProperties API portal properties payload +type APIPortalProperties struct { + // ProvisioningState - READ-ONLY; State of the API portal. Possible values include: 'Creating', 'Updating', 'Succeeded', 'Failed', 'Deleting' + ProvisioningState APIPortalProvisioningState `json:"provisioningState,omitempty"` + // Public - Indicates whether the API portal exposes endpoint. + Public *bool `json:"public,omitempty"` + // URL - READ-ONLY; URL of the API portal, exposed when 'public' is true. + URL *string `json:"url,omitempty"` + // HTTPSOnly - Indicate if only https is allowed. + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + // GatewayIds - The array of resource Ids of gateway to integrate with API portal. + GatewayIds *[]string `json:"gatewayIds,omitempty"` + // SourceUrls - Collection of OpenAPI source URL locations. + SourceUrls *[]string `json:"sourceUrls,omitempty"` + SsoProperties *SsoProperties `json:"ssoProperties,omitempty"` + // ResourceRequests - READ-ONLY; The requested resource quantity for required CPU and Memory. + ResourceRequests *APIPortalResourceRequests `json:"resourceRequests,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to API portal. + Instances *[]APIPortalInstance `json:"instances,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIPortalProperties. +func (app APIPortalProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if app.Public != nil { + objectMap["public"] = app.Public + } + if app.HTTPSOnly != nil { + objectMap["httpsOnly"] = app.HTTPSOnly + } + if app.GatewayIds != nil { + objectMap["gatewayIds"] = app.GatewayIds + } + if app.SourceUrls != nil { + objectMap["sourceUrls"] = app.SourceUrls + } + if app.SsoProperties != nil { + objectMap["ssoProperties"] = app.SsoProperties + } + return json.Marshal(objectMap) +} + +// APIPortalResource API portal resource +type APIPortalResource struct { + autorest.Response `json:"-"` + Properties *APIPortalProperties `json:"properties,omitempty"` + // Sku - Sku of the API portal resource + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIPortalResource. +func (apr APIPortalResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apr.Properties != nil { + objectMap["properties"] = apr.Properties + } + if apr.Sku != nil { + objectMap["sku"] = apr.Sku + } + if apr.SystemData != nil { + objectMap["systemData"] = apr.SystemData + } + return json.Marshal(objectMap) +} + +// APIPortalResourceCollection object that includes an array of API portal resources and a possible link +// for next set +type APIPortalResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of API portal resources + Value *[]APIPortalResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// APIPortalResourceCollectionIterator provides access to a complete listing of APIPortalResource values. +type APIPortalResourceCollectionIterator struct { + i int + page APIPortalResourceCollectionPage +} + +// 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 *APIPortalResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalResourceCollectionIterator.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 *APIPortalResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter APIPortalResourceCollectionIterator) 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 APIPortalResourceCollectionIterator) Response() APIPortalResourceCollection { + 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 APIPortalResourceCollectionIterator) Value() APIPortalResource { + if !iter.page.NotDone() { + return APIPortalResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the APIPortalResourceCollectionIterator type. +func NewAPIPortalResourceCollectionIterator(page APIPortalResourceCollectionPage) APIPortalResourceCollectionIterator { + return APIPortalResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aprc APIPortalResourceCollection) IsEmpty() bool { + return aprc.Value == nil || len(*aprc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aprc APIPortalResourceCollection) hasNextLink() bool { + return aprc.NextLink != nil && len(*aprc.NextLink) != 0 +} + +// aPIPortalResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aprc APIPortalResourceCollection) aPIPortalResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !aprc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aprc.NextLink))) +} + +// APIPortalResourceCollectionPage contains a page of APIPortalResource values. +type APIPortalResourceCollectionPage struct { + fn func(context.Context, APIPortalResourceCollection) (APIPortalResourceCollection, error) + aprc APIPortalResourceCollection +} + +// 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 *APIPortalResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/APIPortalResourceCollectionPage.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.aprc) + if err != nil { + return err + } + page.aprc = 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 *APIPortalResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page APIPortalResourceCollectionPage) NotDone() bool { + return !page.aprc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page APIPortalResourceCollectionPage) Response() APIPortalResourceCollection { + return page.aprc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page APIPortalResourceCollectionPage) Values() []APIPortalResource { + if page.aprc.IsEmpty() { + return nil + } + return *page.aprc.Value +} + +// Creates a new instance of the APIPortalResourceCollectionPage type. +func NewAPIPortalResourceCollectionPage(cur APIPortalResourceCollection, getNextPage func(context.Context, APIPortalResourceCollection) (APIPortalResourceCollection, error)) APIPortalResourceCollectionPage { + return APIPortalResourceCollectionPage{ + fn: getNextPage, + aprc: cur, + } +} + +// APIPortalResourceRequests resource requests of the API portal +type APIPortalResourceRequests struct { + // CPU - READ-ONLY; Cpu allocated to each API portal instance + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to each API portal instance + Memory *string `json:"memory,omitempty"` +} + +// MarshalJSON is the custom marshaler for APIPortalResourceRequests. +func (aprr APIPortalResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// APIPortalsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type APIPortalsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(APIPortalsClient) (APIPortalResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *APIPortalsCreateOrUpdateFuture) 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 APIPortalsCreateOrUpdateFuture.Result. +func (future *APIPortalsCreateOrUpdateFuture) result(client APIPortalsClient) (apr APIPortalResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + apr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.APIPortalsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if apr.Response.Response, err = future.GetResult(sender); err == nil && apr.Response.Response.StatusCode != http.StatusNoContent { + apr, err = client.CreateOrUpdateResponder(apr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsCreateOrUpdateFuture", "Result", apr.Response.Response, "Failure responding to request") + } + } + return +} + +// APIPortalsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type APIPortalsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(APIPortalsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *APIPortalsDeleteFuture) 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 APIPortalsDeleteFuture.Result. +func (future *APIPortalsDeleteFuture) result(client APIPortalsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.APIPortalsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.APIPortalsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ApplicationInsightsAgentVersions application Insights agent versions properties payload +type ApplicationInsightsAgentVersions struct { + // Java - READ-ONLY; Indicates the version of application insight java agent + Java *string `json:"java,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationInsightsAgentVersions. +func (aiav ApplicationInsightsAgentVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AppResource app resource payload +type AppResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the App resource + Properties *AppResourceProperties `json:"properties,omitempty"` + // Identity - The Managed Identity type of the app resource + Identity *ManagedIdentityProperties `json:"identity,omitempty"` + // Location - The GEO location of the application, always the same with its parent resource + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppResource. +func (ar AppResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.Properties != nil { + objectMap["properties"] = ar.Properties + } + if ar.Identity != nil { + objectMap["identity"] = ar.Identity + } + if ar.Location != nil { + objectMap["location"] = ar.Location + } + if ar.SystemData != nil { + objectMap["systemData"] = ar.SystemData + } + return json.Marshal(objectMap) +} + +// AppResourceCollection object that includes an array of App resources and a possible link for next set +type AppResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of App resources + Value *[]AppResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// AppResourceCollectionIterator provides access to a complete listing of AppResource values. +type AppResourceCollectionIterator struct { + i int + page AppResourceCollectionPage +} + +// 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 *AppResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppResourceCollectionIterator.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 *AppResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppResourceCollectionIterator) 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 AppResourceCollectionIterator) Response() AppResourceCollection { + 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 AppResourceCollectionIterator) Value() AppResource { + if !iter.page.NotDone() { + return AppResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppResourceCollectionIterator type. +func NewAppResourceCollectionIterator(page AppResourceCollectionPage) AppResourceCollectionIterator { + return AppResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arc AppResourceCollection) IsEmpty() bool { + return arc.Value == nil || len(*arc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arc AppResourceCollection) hasNextLink() bool { + return arc.NextLink != nil && len(*arc.NextLink) != 0 +} + +// appResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arc AppResourceCollection) appResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !arc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arc.NextLink))) +} + +// AppResourceCollectionPage contains a page of AppResource values. +type AppResourceCollectionPage struct { + fn func(context.Context, AppResourceCollection) (AppResourceCollection, error) + arc AppResourceCollection +} + +// 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 *AppResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppResourceCollectionPage.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.arc) + if err != nil { + return err + } + page.arc = 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 *AppResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppResourceCollectionPage) NotDone() bool { + return !page.arc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppResourceCollectionPage) Response() AppResourceCollection { + return page.arc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppResourceCollectionPage) Values() []AppResource { + if page.arc.IsEmpty() { + return nil + } + return *page.arc.Value +} + +// Creates a new instance of the AppResourceCollectionPage type. +func NewAppResourceCollectionPage(cur AppResourceCollection, getNextPage func(context.Context, AppResourceCollection) (AppResourceCollection, error)) AppResourceCollectionPage { + return AppResourceCollectionPage{ + fn: getNextPage, + arc: cur, + } +} + +// AppResourceProperties app resource properties payload +type AppResourceProperties struct { + // Public - Indicates whether the App exposes public endpoint + Public *bool `json:"public,omitempty"` + // URL - READ-ONLY; URL of the App + URL *string `json:"url,omitempty"` + // AddonConfigs - Collection of addons + AddonConfigs map[string]map[string]interface{} `json:"addonConfigs"` + // ProvisioningState - READ-ONLY; Provisioning state of the App. Possible values include: 'AppResourceProvisioningStateSucceeded', 'AppResourceProvisioningStateFailed', 'AppResourceProvisioningStateCreating', 'AppResourceProvisioningStateUpdating', 'AppResourceProvisioningStateDeleting' + ProvisioningState AppResourceProvisioningState `json:"provisioningState,omitempty"` + // Fqdn - Fully qualified dns Name. + Fqdn *string `json:"fqdn,omitempty"` + // HTTPSOnly - Indicate if only https is allowed. + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + // TemporaryDisk - Temporary disk settings + TemporaryDisk *TemporaryDisk `json:"temporaryDisk,omitempty"` + // PersistentDisk - Persistent disk settings + PersistentDisk *PersistentDisk `json:"persistentDisk,omitempty"` + // CustomPersistentDisks - List of custom persistent disks + CustomPersistentDisks *[]CustomPersistentDiskResource `json:"customPersistentDisks,omitempty"` + // EnableEndToEndTLS - Indicate if end to end TLS is enabled. + EnableEndToEndTLS *bool `json:"enableEndToEndTLS,omitempty"` + // LoadedCertificates - Collection of loaded certificates + LoadedCertificates *[]LoadedCertificate `json:"loadedCertificates,omitempty"` + // VnetAddons - Additional App settings in vnet injection instance + VnetAddons *AppVNetAddons `json:"vnetAddons,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppResourceProperties. +func (arp AppResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arp.Public != nil { + objectMap["public"] = arp.Public + } + if arp.AddonConfigs != nil { + objectMap["addonConfigs"] = arp.AddonConfigs + } + if arp.Fqdn != nil { + objectMap["fqdn"] = arp.Fqdn + } + if arp.HTTPSOnly != nil { + objectMap["httpsOnly"] = arp.HTTPSOnly + } + if arp.TemporaryDisk != nil { + objectMap["temporaryDisk"] = arp.TemporaryDisk + } + if arp.PersistentDisk != nil { + objectMap["persistentDisk"] = arp.PersistentDisk + } + if arp.CustomPersistentDisks != nil { + objectMap["customPersistentDisks"] = arp.CustomPersistentDisks + } + if arp.EnableEndToEndTLS != nil { + objectMap["enableEndToEndTLS"] = arp.EnableEndToEndTLS + } + if arp.LoadedCertificates != nil { + objectMap["loadedCertificates"] = arp.LoadedCertificates + } + if arp.VnetAddons != nil { + objectMap["vnetAddons"] = arp.VnetAddons + } + return json.Marshal(objectMap) +} + +// AppsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (AppResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsCreateOrUpdateFuture) 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 AppsCreateOrUpdateFuture.Result. +func (future *AppsCreateOrUpdateFuture) result(client AppsClient) (ar AppResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.AppsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { + ar, err = client.CreateOrUpdateResponder(ar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsCreateOrUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type AppsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsDeleteFuture) 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 AppsDeleteFuture.Result. +func (future *AppsDeleteFuture) result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.AppsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AppsSetActiveDeploymentsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AppsSetActiveDeploymentsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (AppResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsSetActiveDeploymentsFuture) 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 AppsSetActiveDeploymentsFuture.Result. +func (future *AppsSetActiveDeploymentsFuture) result(client AppsClient) (ar AppResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsSetActiveDeploymentsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.AppsSetActiveDeploymentsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { + ar, err = client.SetActiveDeploymentsResponder(ar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsSetActiveDeploymentsFuture", "Result", ar.Response.Response, "Failure responding to request") + } + } + return +} + +// AppsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type AppsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AppsClient) (AppResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AppsUpdateFuture) 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 AppsUpdateFuture.Result. +func (future *AppsUpdateFuture) result(client AppsClient) (ar AppResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.AppsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ar.Response.Response, err = future.GetResult(sender); err == nil && ar.Response.Response.StatusCode != http.StatusNoContent { + ar, err = client.UpdateResponder(ar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.AppsUpdateFuture", "Result", ar.Response.Response, "Failure responding to request") + } + } + return +} + +// AppVNetAddons additional App settings in vnet injection instance +type AppVNetAddons struct { + // PublicEndpoint - Indicates whether the App in vnet injection instance exposes endpoint which could be accessed from internet. + PublicEndpoint *bool `json:"publicEndpoint,omitempty"` + // PublicEndpointURL - READ-ONLY; URL of the App in vnet injection instance which could be accessed from internet + PublicEndpointURL *string `json:"publicEndpointUrl,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppVNetAddons. +func (avna AppVNetAddons) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if avna.PublicEndpoint != nil { + objectMap["publicEndpoint"] = avna.PublicEndpoint + } + return json.Marshal(objectMap) +} + +// AvailableOperations available operations of the service +type AvailableOperations struct { + autorest.Response `json:"-"` + // Value - Collection of available operation details + Value *[]OperationDetail `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// AvailableOperationsIterator provides access to a complete listing of OperationDetail values. +type AvailableOperationsIterator struct { + i int + page AvailableOperationsPage +} + +// 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 *AvailableOperationsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsIterator.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 *AvailableOperationsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailableOperationsIterator) 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 AvailableOperationsIterator) Response() AvailableOperations { + 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 AvailableOperationsIterator) Value() OperationDetail { + if !iter.page.NotDone() { + return OperationDetail{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailableOperationsIterator type. +func NewAvailableOperationsIterator(page AvailableOperationsPage) AvailableOperationsIterator { + return AvailableOperationsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ao AvailableOperations) IsEmpty() bool { + return ao.Value == nil || len(*ao.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ao AvailableOperations) hasNextLink() bool { + return ao.NextLink != nil && len(*ao.NextLink) != 0 +} + +// availableOperationsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ao AvailableOperations) availableOperationsPreparer(ctx context.Context) (*http.Request, error) { + if !ao.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ao.NextLink))) +} + +// AvailableOperationsPage contains a page of OperationDetail values. +type AvailableOperationsPage struct { + fn func(context.Context, AvailableOperations) (AvailableOperations, error) + ao AvailableOperations +} + +// 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 *AvailableOperationsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableOperationsPage.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.ao) + if err != nil { + return err + } + page.ao = 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 *AvailableOperationsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailableOperationsPage) NotDone() bool { + return !page.ao.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailableOperationsPage) Response() AvailableOperations { + return page.ao +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailableOperationsPage) Values() []OperationDetail { + if page.ao.IsEmpty() { + return nil + } + return *page.ao.Value +} + +// Creates a new instance of the AvailableOperationsPage type. +func NewAvailableOperationsPage(cur AvailableOperations, getNextPage func(context.Context, AvailableOperations) (AvailableOperations, error)) AvailableOperationsPage { + return AvailableOperationsPage{ + fn: getNextPage, + ao: cur, + } +} + +// AvailableRuntimeVersions ... +type AvailableRuntimeVersions struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; A list of all supported runtime versions. + Value *[]SupportedRuntimeVersion `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailableRuntimeVersions. +func (arv AvailableRuntimeVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFileVolume the properties of the Azure File volume. Azure File shares are mounted as volumes. +type AzureFileVolume struct { + // ShareName - The share name of the Azure File share. + ShareName *string `json:"shareName,omitempty"` + // MountPath - The mount path of the persistent disk. + MountPath *string `json:"mountPath,omitempty"` + // ReadOnly - Indicates whether the persistent disk is a readOnly one. + ReadOnly *bool `json:"readOnly,omitempty"` + // MountOptions - These are the mount options for a persistent disk. + MountOptions *[]string `json:"mountOptions,omitempty"` + // Type - Possible values include: 'TypeCustomPersistentDiskProperties', 'TypeAzureFileVolume' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFileVolume. +func (afv AzureFileVolume) MarshalJSON() ([]byte, error) { + afv.Type = TypeAzureFileVolume + objectMap := make(map[string]interface{}) + if afv.ShareName != nil { + objectMap["shareName"] = afv.ShareName + } + if afv.MountPath != nil { + objectMap["mountPath"] = afv.MountPath + } + if afv.ReadOnly != nil { + objectMap["readOnly"] = afv.ReadOnly + } + if afv.MountOptions != nil { + objectMap["mountOptions"] = afv.MountOptions + } + if afv.Type != "" { + objectMap["type"] = afv.Type + } + return json.Marshal(objectMap) +} + +// AsAzureFileVolume is the BasicCustomPersistentDiskProperties implementation for AzureFileVolume. +func (afv AzureFileVolume) AsAzureFileVolume() (*AzureFileVolume, bool) { + return &afv, true +} + +// AsCustomPersistentDiskProperties is the BasicCustomPersistentDiskProperties implementation for AzureFileVolume. +func (afv AzureFileVolume) AsCustomPersistentDiskProperties() (*CustomPersistentDiskProperties, bool) { + return nil, false +} + +// AsBasicCustomPersistentDiskProperties is the BasicCustomPersistentDiskProperties implementation for AzureFileVolume. +func (afv AzureFileVolume) AsBasicCustomPersistentDiskProperties() (BasicCustomPersistentDiskProperties, bool) { + return &afv, true +} + +// BindingResource binding resource payload +type BindingResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Binding resource + Properties *BindingResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BindingResource. +func (br BindingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if br.Properties != nil { + objectMap["properties"] = br.Properties + } + if br.SystemData != nil { + objectMap["systemData"] = br.SystemData + } + return json.Marshal(objectMap) +} + +// BindingResourceCollection object that includes an array of Binding resources and a possible link for +// next set +type BindingResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Binding resources + Value *[]BindingResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BindingResourceCollectionIterator provides access to a complete listing of BindingResource values. +type BindingResourceCollectionIterator struct { + i int + page BindingResourceCollectionPage +} + +// 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 *BindingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingResourceCollectionIterator.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 *BindingResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BindingResourceCollectionIterator) 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 BindingResourceCollectionIterator) Response() BindingResourceCollection { + 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 BindingResourceCollectionIterator) Value() BindingResource { + if !iter.page.NotDone() { + return BindingResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BindingResourceCollectionIterator type. +func NewBindingResourceCollectionIterator(page BindingResourceCollectionPage) BindingResourceCollectionIterator { + return BindingResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (brc BindingResourceCollection) IsEmpty() bool { + return brc.Value == nil || len(*brc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (brc BindingResourceCollection) hasNextLink() bool { + return brc.NextLink != nil && len(*brc.NextLink) != 0 +} + +// bindingResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (brc BindingResourceCollection) bindingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !brc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(brc.NextLink))) +} + +// BindingResourceCollectionPage contains a page of BindingResource values. +type BindingResourceCollectionPage struct { + fn func(context.Context, BindingResourceCollection) (BindingResourceCollection, error) + brc BindingResourceCollection +} + +// 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 *BindingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BindingResourceCollectionPage.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.brc) + if err != nil { + return err + } + page.brc = 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 *BindingResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BindingResourceCollectionPage) NotDone() bool { + return !page.brc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BindingResourceCollectionPage) Response() BindingResourceCollection { + return page.brc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BindingResourceCollectionPage) Values() []BindingResource { + if page.brc.IsEmpty() { + return nil + } + return *page.brc.Value +} + +// Creates a new instance of the BindingResourceCollectionPage type. +func NewBindingResourceCollectionPage(cur BindingResourceCollection, getNextPage func(context.Context, BindingResourceCollection) (BindingResourceCollection, error)) BindingResourceCollectionPage { + return BindingResourceCollectionPage{ + fn: getNextPage, + brc: cur, + } +} + +// BindingResourceProperties binding resource properties payload +type BindingResourceProperties struct { + // ResourceName - READ-ONLY; The name of the bound resource + ResourceName *string `json:"resourceName,omitempty"` + // ResourceType - READ-ONLY; The standard Azure resource type of the bound resource + ResourceType *string `json:"resourceType,omitempty"` + // ResourceID - The Azure resource id of the bound resource + ResourceID *string `json:"resourceId,omitempty"` + // Key - The key of the bound resource + Key *string `json:"key,omitempty"` + // BindingParameters - Binding parameters of the Binding resource + BindingParameters map[string]interface{} `json:"bindingParameters"` + // GeneratedProperties - READ-ONLY; The generated Spring Boot property file for this binding. The secret will be deducted. + GeneratedProperties *string `json:"generatedProperties,omitempty"` + // CreatedAt - READ-ONLY; Creation time of the Binding resource + CreatedAt *string `json:"createdAt,omitempty"` + // UpdatedAt - READ-ONLY; Update time of the Binding resource + UpdatedAt *string `json:"updatedAt,omitempty"` +} + +// MarshalJSON is the custom marshaler for BindingResourceProperties. +func (brp BindingResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if brp.ResourceID != nil { + objectMap["resourceId"] = brp.ResourceID + } + if brp.Key != nil { + objectMap["key"] = brp.Key + } + if brp.BindingParameters != nil { + objectMap["bindingParameters"] = brp.BindingParameters + } + return json.Marshal(objectMap) +} + +// BindingsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BindingsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BindingsClient) (BindingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BindingsCreateOrUpdateFuture) 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 BindingsCreateOrUpdateFuture.Result. +func (future *BindingsCreateOrUpdateFuture) result(client BindingsClient) (br BindingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + br.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BindingsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if br.Response.Response, err = future.GetResult(sender); err == nil && br.Response.Response.StatusCode != http.StatusNoContent { + br, err = client.CreateOrUpdateResponder(br.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsCreateOrUpdateFuture", "Result", br.Response.Response, "Failure responding to request") + } + } + return +} + +// BindingsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BindingsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BindingsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BindingsDeleteFuture) 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 BindingsDeleteFuture.Result. +func (future *BindingsDeleteFuture) result(client BindingsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BindingsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BindingsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BindingsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BindingsClient) (BindingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BindingsUpdateFuture) 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 BindingsUpdateFuture.Result. +func (future *BindingsUpdateFuture) result(client BindingsClient) (br BindingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + br.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BindingsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if br.Response.Response, err = future.GetResult(sender); err == nil && br.Response.Response.StatusCode != http.StatusNoContent { + br, err = client.UpdateResponder(br.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BindingsUpdateFuture", "Result", br.Response.Response, "Failure responding to request") + } + } + return +} + +// Build build resource payload +type Build struct { + autorest.Response `json:"-"` + // Properties - Properties of the build resource + Properties *BuildProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Build. +func (b Build) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if b.Properties != nil { + objectMap["properties"] = b.Properties + } + if b.SystemData != nil { + objectMap["systemData"] = b.SystemData + } + return json.Marshal(objectMap) +} + +// BuildCollection object that includes an array of Build resources and a possible link for next set +type BuildCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Build resources + Value *[]Build `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildCollectionIterator provides access to a complete listing of Build values. +type BuildCollectionIterator struct { + i int + page BuildCollectionPage +} + +// 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 *BuildCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildCollectionIterator.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 *BuildCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildCollectionIterator) 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 BuildCollectionIterator) Response() BuildCollection { + 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 BuildCollectionIterator) Value() Build { + if !iter.page.NotDone() { + return Build{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildCollectionIterator type. +func NewBuildCollectionIterator(page BuildCollectionPage) BuildCollectionIterator { + return BuildCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bc BuildCollection) IsEmpty() bool { + return bc.Value == nil || len(*bc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bc BuildCollection) hasNextLink() bool { + return bc.NextLink != nil && len(*bc.NextLink) != 0 +} + +// buildCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bc BuildCollection) buildCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bc.NextLink))) +} + +// BuildCollectionPage contains a page of Build values. +type BuildCollectionPage struct { + fn func(context.Context, BuildCollection) (BuildCollection, error) + bc BuildCollection +} + +// 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 *BuildCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildCollectionPage.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.bc) + if err != nil { + return err + } + page.bc = 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 *BuildCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildCollectionPage) NotDone() bool { + return !page.bc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildCollectionPage) Response() BuildCollection { + return page.bc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildCollectionPage) Values() []Build { + if page.bc.IsEmpty() { + return nil + } + return *page.bc.Value +} + +// Creates a new instance of the BuildCollectionPage type. +func NewBuildCollectionPage(cur BuildCollection, getNextPage func(context.Context, BuildCollection) (BuildCollection, error)) BuildCollectionPage { + return BuildCollectionPage{ + fn: getNextPage, + bc: cur, + } +} + +// BuilderProperties kPack Builder properties payload +type BuilderProperties struct { + // ProvisioningState - READ-ONLY; Builder provision status. Possible values include: 'BuilderProvisioningStateCreating', 'BuilderProvisioningStateUpdating', 'BuilderProvisioningStateSucceeded', 'BuilderProvisioningStateFailed', 'BuilderProvisioningStateDeleting' + ProvisioningState BuilderProvisioningState `json:"provisioningState,omitempty"` + // Stack - Builder cluster stack property. + Stack *StackProperties `json:"stack,omitempty"` + // BuildpackGroups - Builder buildpack groups. + BuildpackGroups *[]BuildpacksGroupProperties `json:"buildpackGroups,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuilderProperties. +func (bp BuilderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.Stack != nil { + objectMap["stack"] = bp.Stack + } + if bp.BuildpackGroups != nil { + objectMap["buildpackGroups"] = bp.BuildpackGroups + } + return json.Marshal(objectMap) +} + +// BuilderResource kPack Builder resource +type BuilderResource struct { + autorest.Response `json:"-"` + // Properties - Property of the Builder resource. + Properties *BuilderProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuilderResource. +func (br BuilderResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if br.Properties != nil { + objectMap["properties"] = br.Properties + } + if br.SystemData != nil { + objectMap["systemData"] = br.SystemData + } + return json.Marshal(objectMap) +} + +// BuilderResourceCollection object that includes an array of Builder resources and a possible link for +// next set +type BuilderResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Builder resources + Value *[]BuilderResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuilderResourceCollectionIterator provides access to a complete listing of BuilderResource values. +type BuilderResourceCollectionIterator struct { + i int + page BuilderResourceCollectionPage +} + +// 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 *BuilderResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuilderResourceCollectionIterator.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 *BuilderResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuilderResourceCollectionIterator) 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 BuilderResourceCollectionIterator) Response() BuilderResourceCollection { + 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 BuilderResourceCollectionIterator) Value() BuilderResource { + if !iter.page.NotDone() { + return BuilderResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuilderResourceCollectionIterator type. +func NewBuilderResourceCollectionIterator(page BuilderResourceCollectionPage) BuilderResourceCollectionIterator { + return BuilderResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (brc BuilderResourceCollection) IsEmpty() bool { + return brc.Value == nil || len(*brc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (brc BuilderResourceCollection) hasNextLink() bool { + return brc.NextLink != nil && len(*brc.NextLink) != 0 +} + +// builderResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (brc BuilderResourceCollection) builderResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !brc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(brc.NextLink))) +} + +// BuilderResourceCollectionPage contains a page of BuilderResource values. +type BuilderResourceCollectionPage struct { + fn func(context.Context, BuilderResourceCollection) (BuilderResourceCollection, error) + brc BuilderResourceCollection +} + +// 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 *BuilderResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuilderResourceCollectionPage.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.brc) + if err != nil { + return err + } + page.brc = 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 *BuilderResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuilderResourceCollectionPage) NotDone() bool { + return !page.brc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuilderResourceCollectionPage) Response() BuilderResourceCollection { + return page.brc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuilderResourceCollectionPage) Values() []BuilderResource { + if page.brc.IsEmpty() { + return nil + } + return *page.brc.Value +} + +// Creates a new instance of the BuilderResourceCollectionPage type. +func NewBuilderResourceCollectionPage(cur BuilderResourceCollection, getNextPage func(context.Context, BuilderResourceCollection) (BuilderResourceCollection, error)) BuilderResourceCollectionPage { + return BuilderResourceCollectionPage{ + fn: getNextPage, + brc: cur, + } +} + +// BuildpackBindingCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BuildpackBindingCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildpackBindingClient) (BuildpackBindingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildpackBindingCreateOrUpdateFuture) 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 BuildpackBindingCreateOrUpdateFuture.Result. +func (future *BuildpackBindingCreateOrUpdateFuture) result(client BuildpackBindingClient) (bbr BuildpackBindingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bbr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildpackBindingCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bbr.Response.Response, err = future.GetResult(sender); err == nil && bbr.Response.Response.StatusCode != http.StatusNoContent { + bbr, err = client.CreateOrUpdateResponder(bbr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingCreateOrUpdateFuture", "Result", bbr.Response.Response, "Failure responding to request") + } + } + return +} + +// BuildpackBindingDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BuildpackBindingDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildpackBindingClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildpackBindingDeleteFuture) 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 BuildpackBindingDeleteFuture.Result. +func (future *BuildpackBindingDeleteFuture) result(client BuildpackBindingClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildpackBindingDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildpackBindingDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BuildpackBindingLaunchProperties buildpack Binding Launch Properties +type BuildpackBindingLaunchProperties struct { + // Properties - Non-sensitive properties for launchProperties + Properties map[string]*string `json:"properties"` + // Secrets - Sensitive properties for launchProperties + Secrets map[string]*string `json:"secrets"` +} + +// MarshalJSON is the custom marshaler for BuildpackBindingLaunchProperties. +func (bblp BuildpackBindingLaunchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bblp.Properties != nil { + objectMap["properties"] = bblp.Properties + } + if bblp.Secrets != nil { + objectMap["secrets"] = bblp.Secrets + } + return json.Marshal(objectMap) +} + +// BuildpackBindingProperties properties of a buildpack binding +type BuildpackBindingProperties struct { + // BindingType - Buildpack Binding Type. Possible values include: 'ApplicationInsights', 'ApacheSkyWalking', 'AppDynamics', 'Dynatrace', 'NewRelic', 'ElasticAPM' + BindingType BindingType `json:"bindingType,omitempty"` + // ProvisioningState - READ-ONLY; State of the Buildpack Binding. Possible values include: 'BuildpackBindingProvisioningStateCreating', 'BuildpackBindingProvisioningStateUpdating', 'BuildpackBindingProvisioningStateSucceeded', 'BuildpackBindingProvisioningStateFailed', 'BuildpackBindingProvisioningStateDeleting' + ProvisioningState BuildpackBindingProvisioningState `json:"provisioningState,omitempty"` + // LaunchProperties - The object describes the buildpack binding launch properties + LaunchProperties *BuildpackBindingLaunchProperties `json:"launchProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildpackBindingProperties. +func (bbp BuildpackBindingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bbp.BindingType != "" { + objectMap["bindingType"] = bbp.BindingType + } + if bbp.LaunchProperties != nil { + objectMap["launchProperties"] = bbp.LaunchProperties + } + return json.Marshal(objectMap) +} + +// BuildpackBindingResource buildpack Binding Resource object +type BuildpackBindingResource struct { + autorest.Response `json:"-"` + // Properties - Properties of a buildpack binding + Properties *BuildpackBindingProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildpackBindingResource. +func (bbr BuildpackBindingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bbr.Properties != nil { + objectMap["properties"] = bbr.Properties + } + if bbr.SystemData != nil { + objectMap["systemData"] = bbr.SystemData + } + return json.Marshal(objectMap) +} + +// BuildpackBindingResourceCollection object that includes an array of BuildpackBinding resources and a +// possible link for next set +type BuildpackBindingResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of BuildpackBinding resources + Value *[]BuildpackBindingResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildpackBindingResourceCollectionIterator provides access to a complete listing of +// BuildpackBindingResource values. +type BuildpackBindingResourceCollectionIterator struct { + i int + page BuildpackBindingResourceCollectionPage +} + +// 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 *BuildpackBindingResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingResourceCollectionIterator.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 *BuildpackBindingResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildpackBindingResourceCollectionIterator) 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 BuildpackBindingResourceCollectionIterator) Response() BuildpackBindingResourceCollection { + 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 BuildpackBindingResourceCollectionIterator) Value() BuildpackBindingResource { + if !iter.page.NotDone() { + return BuildpackBindingResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildpackBindingResourceCollectionIterator type. +func NewBuildpackBindingResourceCollectionIterator(page BuildpackBindingResourceCollectionPage) BuildpackBindingResourceCollectionIterator { + return BuildpackBindingResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bbrc BuildpackBindingResourceCollection) IsEmpty() bool { + return bbrc.Value == nil || len(*bbrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bbrc BuildpackBindingResourceCollection) hasNextLink() bool { + return bbrc.NextLink != nil && len(*bbrc.NextLink) != 0 +} + +// buildpackBindingResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bbrc BuildpackBindingResourceCollection) buildpackBindingResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bbrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bbrc.NextLink))) +} + +// BuildpackBindingResourceCollectionPage contains a page of BuildpackBindingResource values. +type BuildpackBindingResourceCollectionPage struct { + fn func(context.Context, BuildpackBindingResourceCollection) (BuildpackBindingResourceCollection, error) + bbrc BuildpackBindingResourceCollection +} + +// 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 *BuildpackBindingResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildpackBindingResourceCollectionPage.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.bbrc) + if err != nil { + return err + } + page.bbrc = 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 *BuildpackBindingResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildpackBindingResourceCollectionPage) NotDone() bool { + return !page.bbrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildpackBindingResourceCollectionPage) Response() BuildpackBindingResourceCollection { + return page.bbrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildpackBindingResourceCollectionPage) Values() []BuildpackBindingResource { + if page.bbrc.IsEmpty() { + return nil + } + return *page.bbrc.Value +} + +// Creates a new instance of the BuildpackBindingResourceCollectionPage type. +func NewBuildpackBindingResourceCollectionPage(cur BuildpackBindingResourceCollection, getNextPage func(context.Context, BuildpackBindingResourceCollection) (BuildpackBindingResourceCollection, error)) BuildpackBindingResourceCollectionPage { + return BuildpackBindingResourceCollectionPage{ + fn: getNextPage, + bbrc: cur, + } +} + +// BuildpackProperties buildpack properties payload +type BuildpackProperties struct { + // ID - Id of the buildpack + ID *string `json:"id,omitempty"` +} + +// BuildpacksGroupProperties buildpack group properties of the Builder +type BuildpacksGroupProperties struct { + // Name - Buildpack group name + Name *string `json:"name,omitempty"` + // Buildpacks - Buildpacks in the buildpack group + Buildpacks *[]BuildpackProperties `json:"buildpacks,omitempty"` +} + +// BuildProperties build resource properties payload +type BuildProperties struct { + // RelativePath - The relative path of source code + RelativePath *string `json:"relativePath,omitempty"` + // Builder - The resource id of builder to build the source code + Builder *string `json:"builder,omitempty"` + // AgentPool - The resource id of agent pool + AgentPool *string `json:"agentPool,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the KPack build result. Possible values include: 'BuildProvisioningStateCreating', 'BuildProvisioningStateUpdating', 'BuildProvisioningStateSucceeded', 'BuildProvisioningStateFailed', 'BuildProvisioningStateDeleting' + ProvisioningState BuildProvisioningState `json:"provisioningState,omitempty"` + // Env - The environment variables for this build + Env map[string]*string `json:"env"` + // TriggeredBuildResult - The build result triggered by this build + TriggeredBuildResult *TriggeredBuildResult `json:"triggeredBuildResult,omitempty"` + // ResourceRequests - The customized build resource for this build + ResourceRequests *BuildResourceRequests `json:"resourceRequests,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildProperties. +func (bp BuildProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bp.RelativePath != nil { + objectMap["relativePath"] = bp.RelativePath + } + if bp.Builder != nil { + objectMap["builder"] = bp.Builder + } + if bp.AgentPool != nil { + objectMap["agentPool"] = bp.AgentPool + } + if bp.Env != nil { + objectMap["env"] = bp.Env + } + if bp.TriggeredBuildResult != nil { + objectMap["triggeredBuildResult"] = bp.TriggeredBuildResult + } + if bp.ResourceRequests != nil { + objectMap["resourceRequests"] = bp.ResourceRequests + } + return json.Marshal(objectMap) +} + +// BuildResourceRequests resource request payload of Build Resource. +type BuildResourceRequests struct { + // CPU - Optional Cpu allocated to the build resource. 1 core can be represented by 1 or 1000m. + // The default value is 1, this should not exceed build service agent pool cpu size. + CPU *string `json:"cpu,omitempty"` + // Memory - Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi or 1024Mi. + // The default value is 2Gi, this should not exceed build service agent pool memory size. + Memory *string `json:"memory,omitempty"` +} + +// BuildResult build result resource payload +type BuildResult struct { + autorest.Response `json:"-"` + // Properties - Properties of the build result resource + Properties *BuildResultProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildResult. +func (br BuildResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if br.Properties != nil { + objectMap["properties"] = br.Properties + } + if br.SystemData != nil { + objectMap["systemData"] = br.SystemData + } + return json.Marshal(objectMap) +} + +// BuildResultCollection object that includes an array of Build result resources and a possible link for +// next set +type BuildResultCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Build result resources + Value *[]BuildResult `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildResultCollectionIterator provides access to a complete listing of BuildResult values. +type BuildResultCollectionIterator struct { + i int + page BuildResultCollectionPage +} + +// 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 *BuildResultCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildResultCollectionIterator.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 *BuildResultCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildResultCollectionIterator) 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 BuildResultCollectionIterator) Response() BuildResultCollection { + 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 BuildResultCollectionIterator) Value() BuildResult { + if !iter.page.NotDone() { + return BuildResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildResultCollectionIterator type. +func NewBuildResultCollectionIterator(page BuildResultCollectionPage) BuildResultCollectionIterator { + return BuildResultCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (brc BuildResultCollection) IsEmpty() bool { + return brc.Value == nil || len(*brc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (brc BuildResultCollection) hasNextLink() bool { + return brc.NextLink != nil && len(*brc.NextLink) != 0 +} + +// buildResultCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (brc BuildResultCollection) buildResultCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !brc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(brc.NextLink))) +} + +// BuildResultCollectionPage contains a page of BuildResult values. +type BuildResultCollectionPage struct { + fn func(context.Context, BuildResultCollection) (BuildResultCollection, error) + brc BuildResultCollection +} + +// 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 *BuildResultCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildResultCollectionPage.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.brc) + if err != nil { + return err + } + page.brc = 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 *BuildResultCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildResultCollectionPage) NotDone() bool { + return !page.brc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildResultCollectionPage) Response() BuildResultCollection { + return page.brc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildResultCollectionPage) Values() []BuildResult { + if page.brc.IsEmpty() { + return nil + } + return *page.brc.Value +} + +// Creates a new instance of the BuildResultCollectionPage type. +func NewBuildResultCollectionPage(cur BuildResultCollection, getNextPage func(context.Context, BuildResultCollection) (BuildResultCollection, error)) BuildResultCollectionPage { + return BuildResultCollectionPage{ + fn: getNextPage, + brc: cur, + } +} + +// BuildResultLog build result log resource properties payload +type BuildResultLog struct { + autorest.Response `json:"-"` + // BlobURL - The public download URL of this build result log + BlobURL *string `json:"blobUrl,omitempty"` +} + +// BuildResultProperties build result resource properties payload +type BuildResultProperties struct { + // Name - The name of this build result + Name *string `json:"name,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the KPack build result. Possible values include: 'BuildResultProvisioningStateQueuing', 'BuildResultProvisioningStateBuilding', 'BuildResultProvisioningStateSucceeded', 'BuildResultProvisioningStateFailed', 'BuildResultProvisioningStateDeleting' + ProvisioningState BuildResultProvisioningState `json:"provisioningState,omitempty"` + // BuildPodName - The build pod name which can be used to get the build log streaming. + BuildPodName *string `json:"buildPodName,omitempty"` + // BuildStages - READ-ONLY; All of the build stage (init-container and container) resources in build pod. + BuildStages *[]BuildStageProperties `json:"buildStages,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildResultProperties. +func (brp BuildResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if brp.Name != nil { + objectMap["name"] = brp.Name + } + if brp.BuildPodName != nil { + objectMap["buildPodName"] = brp.BuildPodName + } + return json.Marshal(objectMap) +} + +// BuildResultUserSourceInfo reference to a build result +type BuildResultUserSourceInfo struct { + // BuildResultID - Resource id of an existing succeeded build result under the same Spring instance. + BuildResultID *string `json:"buildResultId,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult', 'TypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) MarshalJSON() ([]byte, error) { + brusi.Type = TypeBuildResult + objectMap := make(map[string]interface{}) + if brusi.BuildResultID != nil { + objectMap["buildResultId"] = brusi.BuildResultID + } + if brusi.Version != nil { + objectMap["version"] = brusi.Version + } + if brusi.Type != "" { + objectMap["type"] = brusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return &brusi, true +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for BuildResultUserSourceInfo. +func (brusi BuildResultUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &brusi, true +} + +// BuildService build service resource payload +type BuildService struct { + autorest.Response `json:"-"` + // Properties - Properties of the build resource + Properties *BuildServiceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildService. +func (bs BuildService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bs.Properties != nil { + objectMap["properties"] = bs.Properties + } + if bs.SystemData != nil { + objectMap["systemData"] = bs.SystemData + } + return json.Marshal(objectMap) +} + +// BuildServiceAgentPoolProperties build service agent pool properties +type BuildServiceAgentPoolProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the build service agent pool + ProvisioningState *string `json:"provisioningState,omitempty"` + // PoolSize - build service agent pool size properties + PoolSize *BuildServiceAgentPoolSizeProperties `json:"poolSize,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServiceAgentPoolProperties. +func (bsapp BuildServiceAgentPoolProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsapp.PoolSize != nil { + objectMap["poolSize"] = bsapp.PoolSize + } + return json.Marshal(objectMap) +} + +// BuildServiceAgentPoolResource the build service agent pool resource +type BuildServiceAgentPoolResource struct { + autorest.Response `json:"-"` + // Properties - build service agent pool properties + Properties *BuildServiceAgentPoolProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServiceAgentPoolResource. +func (bsapr BuildServiceAgentPoolResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsapr.Properties != nil { + objectMap["properties"] = bsapr.Properties + } + if bsapr.SystemData != nil { + objectMap["systemData"] = bsapr.SystemData + } + return json.Marshal(objectMap) +} + +// BuildServiceAgentPoolResourceCollection object that includes an array of build service agent pool +// resources and a possible link for next set +type BuildServiceAgentPoolResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of build service agent pool resource + Value *[]BuildServiceAgentPoolResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildServiceAgentPoolResourceCollectionIterator provides access to a complete listing of +// BuildServiceAgentPoolResource values. +type BuildServiceAgentPoolResourceCollectionIterator struct { + i int + page BuildServiceAgentPoolResourceCollectionPage +} + +// 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 *BuildServiceAgentPoolResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolResourceCollectionIterator.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 *BuildServiceAgentPoolResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildServiceAgentPoolResourceCollectionIterator) 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 BuildServiceAgentPoolResourceCollectionIterator) Response() BuildServiceAgentPoolResourceCollection { + 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 BuildServiceAgentPoolResourceCollectionIterator) Value() BuildServiceAgentPoolResource { + if !iter.page.NotDone() { + return BuildServiceAgentPoolResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildServiceAgentPoolResourceCollectionIterator type. +func NewBuildServiceAgentPoolResourceCollectionIterator(page BuildServiceAgentPoolResourceCollectionPage) BuildServiceAgentPoolResourceCollectionIterator { + return BuildServiceAgentPoolResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsaprc BuildServiceAgentPoolResourceCollection) IsEmpty() bool { + return bsaprc.Value == nil || len(*bsaprc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsaprc BuildServiceAgentPoolResourceCollection) hasNextLink() bool { + return bsaprc.NextLink != nil && len(*bsaprc.NextLink) != 0 +} + +// buildServiceAgentPoolResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsaprc BuildServiceAgentPoolResourceCollection) buildServiceAgentPoolResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bsaprc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsaprc.NextLink))) +} + +// BuildServiceAgentPoolResourceCollectionPage contains a page of BuildServiceAgentPoolResource values. +type BuildServiceAgentPoolResourceCollectionPage struct { + fn func(context.Context, BuildServiceAgentPoolResourceCollection) (BuildServiceAgentPoolResourceCollection, error) + bsaprc BuildServiceAgentPoolResourceCollection +} + +// 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 *BuildServiceAgentPoolResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceAgentPoolResourceCollectionPage.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.bsaprc) + if err != nil { + return err + } + page.bsaprc = 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 *BuildServiceAgentPoolResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildServiceAgentPoolResourceCollectionPage) NotDone() bool { + return !page.bsaprc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildServiceAgentPoolResourceCollectionPage) Response() BuildServiceAgentPoolResourceCollection { + return page.bsaprc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildServiceAgentPoolResourceCollectionPage) Values() []BuildServiceAgentPoolResource { + if page.bsaprc.IsEmpty() { + return nil + } + return *page.bsaprc.Value +} + +// Creates a new instance of the BuildServiceAgentPoolResourceCollectionPage type. +func NewBuildServiceAgentPoolResourceCollectionPage(cur BuildServiceAgentPoolResourceCollection, getNextPage func(context.Context, BuildServiceAgentPoolResourceCollection) (BuildServiceAgentPoolResourceCollection, error)) BuildServiceAgentPoolResourceCollectionPage { + return BuildServiceAgentPoolResourceCollectionPage{ + fn: getNextPage, + bsaprc: cur, + } +} + +// BuildServiceAgentPoolSizeProperties build service agent pool size properties +type BuildServiceAgentPoolSizeProperties struct { + // Name - The name of build service agent pool size + Name *string `json:"name,omitempty"` + // CPU - READ-ONLY; The cpu property of build service agent pool size + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; The memory property of build service agent pool size + Memory *string `json:"memory,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServiceAgentPoolSizeProperties. +func (bsapsp BuildServiceAgentPoolSizeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsapsp.Name != nil { + objectMap["name"] = bsapsp.Name + } + return json.Marshal(objectMap) +} + +// BuildServiceAgentPoolUpdatePutFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BuildServiceAgentPoolUpdatePutFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildServiceAgentPoolClient) (BuildServiceAgentPoolResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildServiceAgentPoolUpdatePutFuture) 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 BuildServiceAgentPoolUpdatePutFuture.Result. +func (future *BuildServiceAgentPoolUpdatePutFuture) result(client BuildServiceAgentPoolClient) (bsapr BuildServiceAgentPoolResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolUpdatePutFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bsapr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildServiceAgentPoolUpdatePutFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bsapr.Response.Response, err = future.GetResult(sender); err == nil && bsapr.Response.Response.StatusCode != http.StatusNoContent { + bsapr, err = client.UpdatePutResponder(bsapr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceAgentPoolUpdatePutFuture", "Result", bsapr.Response.Response, "Failure responding to request") + } + } + return +} + +// BuildServiceBuilderCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BuildServiceBuilderCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildServiceBuilderClient) (BuilderResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildServiceBuilderCreateOrUpdateFuture) 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 BuildServiceBuilderCreateOrUpdateFuture.Result. +func (future *BuildServiceBuilderCreateOrUpdateFuture) result(client BuildServiceBuilderClient) (br BuilderResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + br.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildServiceBuilderCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if br.Response.Response, err = future.GetResult(sender); err == nil && br.Response.Response.StatusCode != http.StatusNoContent { + br, err = client.CreateOrUpdateResponder(br.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderCreateOrUpdateFuture", "Result", br.Response.Response, "Failure responding to request") + } + } + return +} + +// BuildServiceBuilderDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BuildServiceBuilderDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BuildServiceBuilderClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BuildServiceBuilderDeleteFuture) 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 BuildServiceBuilderDeleteFuture.Result. +func (future *BuildServiceBuilderDeleteFuture) result(client BuildServiceBuilderClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.BuildServiceBuilderDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.BuildServiceBuilderDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BuildServiceCollection object that includes an array of Build service resources and a possible link for +// next set +type BuildServiceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Build service resources + Value *[]BuildService `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// BuildServiceCollectionIterator provides access to a complete listing of BuildService values. +type BuildServiceCollectionIterator struct { + i int + page BuildServiceCollectionPage +} + +// 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 *BuildServiceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceCollectionIterator.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 *BuildServiceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BuildServiceCollectionIterator) 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 BuildServiceCollectionIterator) Response() BuildServiceCollection { + 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 BuildServiceCollectionIterator) Value() BuildService { + if !iter.page.NotDone() { + return BuildService{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BuildServiceCollectionIterator type. +func NewBuildServiceCollectionIterator(page BuildServiceCollectionPage) BuildServiceCollectionIterator { + return BuildServiceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsc BuildServiceCollection) IsEmpty() bool { + return bsc.Value == nil || len(*bsc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsc BuildServiceCollection) hasNextLink() bool { + return bsc.NextLink != nil && len(*bsc.NextLink) != 0 +} + +// buildServiceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsc BuildServiceCollection) buildServiceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !bsc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsc.NextLink))) +} + +// BuildServiceCollectionPage contains a page of BuildService values. +type BuildServiceCollectionPage struct { + fn func(context.Context, BuildServiceCollection) (BuildServiceCollection, error) + bsc BuildServiceCollection +} + +// 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 *BuildServiceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BuildServiceCollectionPage.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.bsc) + if err != nil { + return err + } + page.bsc = 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 *BuildServiceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BuildServiceCollectionPage) NotDone() bool { + return !page.bsc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BuildServiceCollectionPage) Response() BuildServiceCollection { + return page.bsc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BuildServiceCollectionPage) Values() []BuildService { + if page.bsc.IsEmpty() { + return nil + } + return *page.bsc.Value +} + +// Creates a new instance of the BuildServiceCollectionPage type. +func NewBuildServiceCollectionPage(cur BuildServiceCollection, getNextPage func(context.Context, BuildServiceCollection) (BuildServiceCollection, error)) BuildServiceCollectionPage { + return BuildServiceCollectionPage{ + fn: getNextPage, + bsc: cur, + } +} + +// BuildServiceProperties build service resource properties payload +type BuildServiceProperties struct { + // KPackVersion - The installed KPack version in this build service. + KPackVersion *string `json:"kPackVersion,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the KPack build result. Possible values include: 'BuildServiceProvisioningStateCreating', 'BuildServiceProvisioningStateUpdating', 'BuildServiceProvisioningStateSucceeded', 'BuildServiceProvisioningStateFailed', 'BuildServiceProvisioningStateDeleting' + ProvisioningState BuildServiceProvisioningState `json:"provisioningState,omitempty"` + // ResourceRequests - The runtime resource configuration of this build service. + ResourceRequests *BuildServicePropertiesResourceRequests `json:"resourceRequests,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServiceProperties. +func (bsp BuildServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsp.KPackVersion != nil { + objectMap["kPackVersion"] = bsp.KPackVersion + } + if bsp.ResourceRequests != nil { + objectMap["resourceRequests"] = bsp.ResourceRequests + } + return json.Marshal(objectMap) +} + +// BuildServicePropertiesResourceRequests the runtime resource configuration of this build service. +type BuildServicePropertiesResourceRequests struct { + // CPU - READ-ONLY; vCPU allocated to the entire build service node pool. + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to the entire build service node pool. + Memory *string `json:"memory,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildServicePropertiesResourceRequests. +func (bspR BuildServicePropertiesResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BuildStageProperties the build stage (init-container and container) resources in build pod. +type BuildStageProperties struct { + // Name - READ-ONLY; The name of this build stage resource. + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; The provisioning state of this build stage resource. Possible values include: 'KPackBuildStageProvisioningStateNotStarted', 'KPackBuildStageProvisioningStateRunning', 'KPackBuildStageProvisioningStateSucceeded', 'KPackBuildStageProvisioningStateFailed' + Status KPackBuildStageProvisioningState `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for BuildStageProperties. +func (bsp BuildStageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BasicCertificateProperties certificate resource payload. +type BasicCertificateProperties interface { + AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) + AsContentCertificateProperties() (*ContentCertificateProperties, bool) + AsCertificateProperties() (*CertificateProperties, bool) +} + +// CertificateProperties certificate resource payload. +type CertificateProperties struct { + // Thumbprint - READ-ONLY; The thumbprint of certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // Issuer - READ-ONLY; The issuer of certificate. + Issuer *string `json:"issuer,omitempty"` + // IssuedDate - READ-ONLY; The issue date of certificate. + IssuedDate *string `json:"issuedDate,omitempty"` + // ExpirationDate - READ-ONLY; The expiration date of certificate. + ExpirationDate *string `json:"expirationDate,omitempty"` + // ActivateDate - READ-ONLY; The activate date of certificate. + ActivateDate *string `json:"activateDate,omitempty"` + // SubjectName - READ-ONLY; The subject name of certificate. + SubjectName *string `json:"subjectName,omitempty"` + // DNSNames - READ-ONLY; The domain list of certificate. + DNSNames *[]string `json:"dnsNames,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Certificate. Possible values include: 'CertificateResourceProvisioningStateCreating', 'CertificateResourceProvisioningStateUpdating', 'CertificateResourceProvisioningStateSucceeded', 'CertificateResourceProvisioningStateFailed', 'CertificateResourceProvisioningStateDeleting' + ProvisioningState CertificateResourceProvisioningState `json:"provisioningState,omitempty"` + // Type - Possible values include: 'TypeCertificateProperties', 'TypeKeyVaultCertificate', 'TypeContentCertificate' + Type TypeBasicCertificateProperties `json:"type,omitempty"` +} + +func unmarshalBasicCertificateProperties(body []byte) (BasicCertificateProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeKeyVaultCertificate): + var kvcp KeyVaultCertificateProperties + err := json.Unmarshal(body, &kvcp) + return kvcp, err + case string(TypeContentCertificate): + var ccp ContentCertificateProperties + err := json.Unmarshal(body, &ccp) + return ccp, err + default: + var cp CertificateProperties + err := json.Unmarshal(body, &cp) + return cp, err + } +} +func unmarshalBasicCertificatePropertiesArray(body []byte) ([]BasicCertificateProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + cpArray := make([]BasicCertificateProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + cp, err := unmarshalBasicCertificateProperties(*rawMessage) + if err != nil { + return nil, err + } + cpArray[index] = cp + } + return cpArray, nil +} + +// MarshalJSON is the custom marshaler for CertificateProperties. +func (cp CertificateProperties) MarshalJSON() ([]byte, error) { + cp.Type = TypeCertificateProperties + objectMap := make(map[string]interface{}) + if cp.Type != "" { + objectMap["type"] = cp.Type + } + return json.Marshal(objectMap) +} + +// AsKeyVaultCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. +func (cp CertificateProperties) AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) { + return nil, false +} + +// AsContentCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. +func (cp CertificateProperties) AsContentCertificateProperties() (*ContentCertificateProperties, bool) { + return nil, false +} + +// AsCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. +func (cp CertificateProperties) AsCertificateProperties() (*CertificateProperties, bool) { + return &cp, true +} + +// AsBasicCertificateProperties is the BasicCertificateProperties implementation for CertificateProperties. +func (cp CertificateProperties) AsBasicCertificateProperties() (BasicCertificateProperties, bool) { + return &cp, true +} + +// CertificateResource certificate resource payload. +type CertificateResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the certificate resource payload. + Properties BasicCertificateProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for CertificateResource. +func (cr CertificateResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = cr.Properties + if cr.SystemData != nil { + objectMap["systemData"] = cr.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CertificateResource struct. +func (cr *CertificateResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + properties, err := unmarshalBasicCertificateProperties(*v) + if err != nil { + return err + } + cr.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cr.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cr.SystemData = &systemData + } + } + } + + return nil +} + +// CertificateResourceCollection collection compose of certificate resources list and a possible link for +// next page. +type CertificateResourceCollection struct { + autorest.Response `json:"-"` + // Value - The certificate resources list. + Value *[]CertificateResource `json:"value,omitempty"` + // NextLink - The link to next page of certificate list. + NextLink *string `json:"nextLink,omitempty"` +} + +// CertificateResourceCollectionIterator provides access to a complete listing of CertificateResource +// values. +type CertificateResourceCollectionIterator struct { + i int + page CertificateResourceCollectionPage +} + +// 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 *CertificateResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateResourceCollectionIterator.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 *CertificateResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CertificateResourceCollectionIterator) 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 CertificateResourceCollectionIterator) Response() CertificateResourceCollection { + 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 CertificateResourceCollectionIterator) Value() CertificateResource { + if !iter.page.NotDone() { + return CertificateResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CertificateResourceCollectionIterator type. +func NewCertificateResourceCollectionIterator(page CertificateResourceCollectionPage) CertificateResourceCollectionIterator { + return CertificateResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (crc CertificateResourceCollection) IsEmpty() bool { + return crc.Value == nil || len(*crc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (crc CertificateResourceCollection) hasNextLink() bool { + return crc.NextLink != nil && len(*crc.NextLink) != 0 +} + +// certificateResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (crc CertificateResourceCollection) certificateResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !crc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(crc.NextLink))) +} + +// CertificateResourceCollectionPage contains a page of CertificateResource values. +type CertificateResourceCollectionPage struct { + fn func(context.Context, CertificateResourceCollection) (CertificateResourceCollection, error) + crc CertificateResourceCollection +} + +// 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 *CertificateResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CertificateResourceCollectionPage.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.crc) + if err != nil { + return err + } + page.crc = 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 *CertificateResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CertificateResourceCollectionPage) NotDone() bool { + return !page.crc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CertificateResourceCollectionPage) Response() CertificateResourceCollection { + return page.crc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CertificateResourceCollectionPage) Values() []CertificateResource { + if page.crc.IsEmpty() { + return nil + } + return *page.crc.Value +} + +// Creates a new instance of the CertificateResourceCollectionPage type. +func NewCertificateResourceCollectionPage(cur CertificateResourceCollection, getNextPage func(context.Context, CertificateResourceCollection) (CertificateResourceCollection, error)) CertificateResourceCollectionPage { + return CertificateResourceCollectionPage{ + fn: getNextPage, + crc: cur, + } +} + +// CertificatesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type CertificatesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CertificatesClient) (CertificateResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CertificatesCreateOrUpdateFuture) 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 CertificatesCreateOrUpdateFuture.Result. +func (future *CertificatesCreateOrUpdateFuture) result(client CertificatesClient) (cr CertificateResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CertificatesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cr.Response.Response, err = future.GetResult(sender); err == nil && cr.Response.Response.StatusCode != http.StatusNoContent { + cr, err = client.CreateOrUpdateResponder(cr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesCreateOrUpdateFuture", "Result", cr.Response.Response, "Failure responding to request") + } + } + return +} + +// CertificatesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CertificatesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CertificatesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CertificatesDeleteFuture) 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 CertificatesDeleteFuture.Result. +func (future *CertificatesDeleteFuture) result(client CertificatesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CertificatesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CertificatesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// CloudError an error response from the service. +type CloudError struct { + // Error - An error response from the service. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the 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"` +} + +// ClusterResourceProperties service properties payload +type ClusterResourceProperties struct { + // ProvisioningState - READ-ONLY; Provisioning state of the Service. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateStarting', 'ProvisioningStateStopping', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateMoving', 'ProvisioningStateMoved', 'ProvisioningStateMoveFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // NetworkProfile - Network profile of the Service + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // VnetAddons - Additional Service settings in vnet injection instance + VnetAddons *ServiceVNetAddons `json:"vnetAddons,omitempty"` + // Version - READ-ONLY; Version of the Service + Version *int32 `json:"version,omitempty"` + // ServiceID - READ-ONLY; ServiceInstanceEntity GUID which uniquely identifies a created resource + ServiceID *string `json:"serviceId,omitempty"` + // PowerState - READ-ONLY; Power state of the Service. Possible values include: 'PowerStateRunning', 'PowerStateStopped' + PowerState PowerState `json:"powerState,omitempty"` + ZoneRedundant *bool `json:"zoneRedundant,omitempty"` + // Fqdn - READ-ONLY; Fully qualified dns name of the service instance + Fqdn *string `json:"fqdn,omitempty"` + // MarketplaceResource - Purchasing 3rd party product of the Service resource. + MarketplaceResource *MarketplaceResource `json:"marketplaceResource,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterResourceProperties. +func (crp ClusterResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if crp.NetworkProfile != nil { + objectMap["networkProfile"] = crp.NetworkProfile + } + if crp.VnetAddons != nil { + objectMap["vnetAddons"] = crp.VnetAddons + } + if crp.ZoneRedundant != nil { + objectMap["zoneRedundant"] = crp.ZoneRedundant + } + if crp.MarketplaceResource != nil { + objectMap["marketplaceResource"] = crp.MarketplaceResource + } + return json.Marshal(objectMap) +} + +// ConfigServerGitProperty property of git. +type ConfigServerGitProperty struct { + // Repositories - Repositories of git. + Repositories *[]GitPatternRepository `json:"repositories,omitempty"` + // URI - URI of the repository + URI *string `json:"uri,omitempty"` + // Label - Label of the repository + Label *string `json:"label,omitempty"` + // SearchPaths - Searching path of the repository + SearchPaths *[]string `json:"searchPaths,omitempty"` + // Username - Username of git repository basic auth. + Username *string `json:"username,omitempty"` + // Password - Password of git repository basic auth. + Password *string `json:"password,omitempty"` + // HostKey - Public sshKey of git repository. + HostKey *string `json:"hostKey,omitempty"` + // HostKeyAlgorithm - SshKey algorithm of git repository. + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + // PrivateKey - Private sshKey algorithm of git repository. + PrivateKey *string `json:"privateKey,omitempty"` + // StrictHostKeyChecking - Strict host key checking or not. + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +} + +// ConfigServerProperties config server git properties payload +type ConfigServerProperties struct { + // ProvisioningState - READ-ONLY; State of the config server. Possible values include: 'ConfigServerStateNotAvailable', 'ConfigServerStateDeleted', 'ConfigServerStateFailed', 'ConfigServerStateSucceeded', 'ConfigServerStateUpdating' + ProvisioningState ConfigServerState `json:"provisioningState,omitempty"` + // Error - Error when apply config server settings. + Error *Error `json:"error,omitempty"` + // ConfigServer - Settings of config server. + ConfigServer *ConfigServerSettings `json:"configServer,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigServerProperties. +func (csp ConfigServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csp.Error != nil { + objectMap["error"] = csp.Error + } + if csp.ConfigServer != nil { + objectMap["configServer"] = csp.ConfigServer + } + return json.Marshal(objectMap) +} + +// ConfigServerResource config Server resource +type ConfigServerResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Config Server resource + Properties *ConfigServerProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigServerResource. +func (csr ConfigServerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csr.Properties != nil { + objectMap["properties"] = csr.Properties + } + if csr.SystemData != nil { + objectMap["systemData"] = csr.SystemData + } + return json.Marshal(objectMap) +} + +// ConfigServerSettings the settings of config server. +type ConfigServerSettings struct { + // GitProperty - Property of git environment. + GitProperty *ConfigServerGitProperty `json:"gitProperty,omitempty"` +} + +// ConfigServerSettingsErrorRecord error record of the config server settings +type ConfigServerSettingsErrorRecord struct { + // Name - The name of the config server settings error record + Name *string `json:"name,omitempty"` + // URI - The uri of the config server settings error record + URI *string `json:"uri,omitempty"` + // Messages - The detail error messages of the record + Messages *[]string `json:"messages,omitempty"` +} + +// ConfigServerSettingsValidateResult validation result for config server settings +type ConfigServerSettingsValidateResult struct { + autorest.Response `json:"-"` + // IsValid - Indicate if the config server settings are valid + IsValid *bool `json:"isValid,omitempty"` + // Details - The detail validation results + Details *[]ConfigServerSettingsErrorRecord `json:"details,omitempty"` +} + +// ConfigServersUpdatePatchFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigServersUpdatePatchFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigServersClient) (ConfigServerResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigServersUpdatePatchFuture) 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 ConfigServersUpdatePatchFuture.Result. +func (future *ConfigServersUpdatePatchFuture) result(client ConfigServersClient) (csr ConfigServerResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePatchFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + csr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigServersUpdatePatchFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if csr.Response.Response, err = future.GetResult(sender); err == nil && csr.Response.Response.StatusCode != http.StatusNoContent { + csr, err = client.UpdatePatchResponder(csr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePatchFuture", "Result", csr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigServersUpdatePutFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConfigServersUpdatePutFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigServersClient) (ConfigServerResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigServersUpdatePutFuture) 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 ConfigServersUpdatePutFuture.Result. +func (future *ConfigServersUpdatePutFuture) result(client ConfigServersClient) (csr ConfigServerResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePutFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + csr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigServersUpdatePutFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if csr.Response.Response, err = future.GetResult(sender); err == nil && csr.Response.Response.StatusCode != http.StatusNoContent { + csr, err = client.UpdatePutResponder(csr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersUpdatePutFuture", "Result", csr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigServersValidateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConfigServersValidateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigServersClient) (ConfigServerSettingsValidateResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigServersValidateFuture) 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 ConfigServersValidateFuture.Result. +func (future *ConfigServersValidateFuture) result(client ConfigServersClient) (cssvr ConfigServerSettingsValidateResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersValidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cssvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigServersValidateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cssvr.Response.Response, err = future.GetResult(sender); err == nil && cssvr.Response.Response.StatusCode != http.StatusNoContent { + cssvr, err = client.ValidateResponder(cssvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigServersValidateFuture", "Result", cssvr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigurationServiceGitProperty property of git environment. +type ConfigurationServiceGitProperty struct { + Repositories *[]ConfigurationServiceGitRepository `json:"repositories,omitempty"` +} + +// ConfigurationServiceGitPropertyValidateResult validation result for configuration service settings +type ConfigurationServiceGitPropertyValidateResult struct { + // IsValid - Indicate if the configuration service settings are valid + IsValid *bool `json:"isValid,omitempty"` + // GitReposValidationResult - The detail validation results + GitReposValidationResult *[]ValidationMessages `json:"gitReposValidationResult,omitempty"` +} + +// ConfigurationServiceGitRepository git repository property payload for Application Configuration Service +type ConfigurationServiceGitRepository struct { + // Name - Name of the repository + Name *string `json:"name,omitempty"` + // Patterns - Collection of patterns of the repository + Patterns *[]string `json:"patterns,omitempty"` + // URI - URI of the repository + URI *string `json:"uri,omitempty"` + // Label - Label of the repository + Label *string `json:"label,omitempty"` + // SearchPaths - Searching path of the repository + SearchPaths *[]string `json:"searchPaths,omitempty"` + // Username - Username of git repository basic auth. + Username *string `json:"username,omitempty"` + // Password - Password of git repository basic auth. + Password *string `json:"password,omitempty"` + // HostKey - Public sshKey of git repository. + HostKey *string `json:"hostKey,omitempty"` + // HostKeyAlgorithm - SshKey algorithm of git repository. + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + // PrivateKey - Private sshKey algorithm of git repository. + PrivateKey *string `json:"privateKey,omitempty"` + // StrictHostKeyChecking - Strict host key checking or not. + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +} + +// ConfigurationServiceInstance collection of instances belong to the Application Configuration Service +type ConfigurationServiceInstance struct { + // Name - READ-ONLY; Name of the Application Configuration Service instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the Application Configuration Service instance + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationServiceInstance. +func (csi ConfigurationServiceInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConfigurationServiceProperties application Configuration Service properties payload +type ConfigurationServiceProperties struct { + // ProvisioningState - READ-ONLY; State of the Application Configuration Service. Possible values include: 'ConfigurationServiceProvisioningStateCreating', 'ConfigurationServiceProvisioningStateUpdating', 'ConfigurationServiceProvisioningStateSucceeded', 'ConfigurationServiceProvisioningStateFailed', 'ConfigurationServiceProvisioningStateDeleting' + ProvisioningState ConfigurationServiceProvisioningState `json:"provisioningState,omitempty"` + // ResourceRequests - The requested resource quantity for required CPU and Memory. + ResourceRequests *ConfigurationServiceResourceRequests `json:"resourceRequests,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to Application Configuration Service. + Instances *[]ConfigurationServiceInstance `json:"instances,omitempty"` + Settings *ConfigurationServiceSettings `json:"settings,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationServiceProperties. +func (csp ConfigurationServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csp.ResourceRequests != nil { + objectMap["resourceRequests"] = csp.ResourceRequests + } + if csp.Settings != nil { + objectMap["settings"] = csp.Settings + } + return json.Marshal(objectMap) +} + +// ConfigurationServiceResource application Configuration Service resource +type ConfigurationServiceResource struct { + autorest.Response `json:"-"` + Properties *ConfigurationServiceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationServiceResource. +func (csr ConfigurationServiceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if csr.Properties != nil { + objectMap["properties"] = csr.Properties + } + if csr.SystemData != nil { + objectMap["systemData"] = csr.SystemData + } + return json.Marshal(objectMap) +} + +// ConfigurationServiceResourceCollection object that includes an array of configuration service resources +// and a possible link for next set +type ConfigurationServiceResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of configuration service resources + Value *[]ConfigurationServiceResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ConfigurationServiceResourceCollectionIterator provides access to a complete listing of +// ConfigurationServiceResource values. +type ConfigurationServiceResourceCollectionIterator struct { + i int + page ConfigurationServiceResourceCollectionPage +} + +// 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 *ConfigurationServiceResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServiceResourceCollectionIterator.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 *ConfigurationServiceResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ConfigurationServiceResourceCollectionIterator) 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 ConfigurationServiceResourceCollectionIterator) Response() ConfigurationServiceResourceCollection { + 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 ConfigurationServiceResourceCollectionIterator) Value() ConfigurationServiceResource { + if !iter.page.NotDone() { + return ConfigurationServiceResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ConfigurationServiceResourceCollectionIterator type. +func NewConfigurationServiceResourceCollectionIterator(page ConfigurationServiceResourceCollectionPage) ConfigurationServiceResourceCollectionIterator { + return ConfigurationServiceResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (csrc ConfigurationServiceResourceCollection) IsEmpty() bool { + return csrc.Value == nil || len(*csrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (csrc ConfigurationServiceResourceCollection) hasNextLink() bool { + return csrc.NextLink != nil && len(*csrc.NextLink) != 0 +} + +// configurationServiceResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (csrc ConfigurationServiceResourceCollection) configurationServiceResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !csrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(csrc.NextLink))) +} + +// ConfigurationServiceResourceCollectionPage contains a page of ConfigurationServiceResource values. +type ConfigurationServiceResourceCollectionPage struct { + fn func(context.Context, ConfigurationServiceResourceCollection) (ConfigurationServiceResourceCollection, error) + csrc ConfigurationServiceResourceCollection +} + +// 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 *ConfigurationServiceResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationServiceResourceCollectionPage.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.csrc) + if err != nil { + return err + } + page.csrc = 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 *ConfigurationServiceResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ConfigurationServiceResourceCollectionPage) NotDone() bool { + return !page.csrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ConfigurationServiceResourceCollectionPage) Response() ConfigurationServiceResourceCollection { + return page.csrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ConfigurationServiceResourceCollectionPage) Values() []ConfigurationServiceResource { + if page.csrc.IsEmpty() { + return nil + } + return *page.csrc.Value +} + +// Creates a new instance of the ConfigurationServiceResourceCollectionPage type. +func NewConfigurationServiceResourceCollectionPage(cur ConfigurationServiceResourceCollection, getNextPage func(context.Context, ConfigurationServiceResourceCollection) (ConfigurationServiceResourceCollection, error)) ConfigurationServiceResourceCollectionPage { + return ConfigurationServiceResourceCollectionPage{ + fn: getNextPage, + csrc: cur, + } +} + +// ConfigurationServiceResourceRequests resource request payload of Application Configuration Service +type ConfigurationServiceResourceRequests struct { + // CPU - READ-ONLY; Cpu allocated to each Application Configuration Service instance + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to each Application Configuration Service instance + Memory *string `json:"memory,omitempty"` + // InstanceCount - READ-ONLY; Instance count of the Application Configuration Service + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationServiceResourceRequests. +func (csrr ConfigurationServiceResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConfigurationServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigurationServicesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationServicesClient) (ConfigurationServiceResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationServicesCreateOrUpdateFuture) 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 ConfigurationServicesCreateOrUpdateFuture.Result. +func (future *ConfigurationServicesCreateOrUpdateFuture) result(client ConfigurationServicesClient) (csr ConfigurationServiceResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + csr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigurationServicesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if csr.Response.Response, err = future.GetResult(sender); err == nil && csr.Response.Response.StatusCode != http.StatusNoContent { + csr, err = client.CreateOrUpdateResponder(csr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesCreateOrUpdateFuture", "Result", csr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigurationServicesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigurationServicesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationServicesDeleteFuture) 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 ConfigurationServicesDeleteFuture.Result. +func (future *ConfigurationServicesDeleteFuture) result(client ConfigurationServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigurationServicesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ConfigurationServiceSettings the settings of Application Configuration Service. +type ConfigurationServiceSettings struct { + GitProperty *ConfigurationServiceGitProperty `json:"gitProperty,omitempty"` +} + +// ConfigurationServiceSettingsValidateResult validation result for configuration service settings +type ConfigurationServiceSettingsValidateResult struct { + autorest.Response `json:"-"` + GitPropertyValidationResult *ConfigurationServiceGitPropertyValidateResult `json:"gitPropertyValidationResult,omitempty"` +} + +// ConfigurationServicesValidateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigurationServicesValidateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationServicesClient) (ConfigurationServiceSettingsValidateResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationServicesValidateFuture) 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 ConfigurationServicesValidateFuture.Result. +func (future *ConfigurationServicesValidateFuture) result(client ConfigurationServicesClient) (cssvr ConfigurationServiceSettingsValidateResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesValidateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cssvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ConfigurationServicesValidateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cssvr.Response.Response, err = future.GetResult(sender); err == nil && cssvr.Response.Response.StatusCode != http.StatusNoContent { + cssvr, err = client.ValidateResponder(cssvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ConfigurationServicesValidateFuture", "Result", cssvr.Response.Response, "Failure responding to request") + } + } + return +} + +// ContainerProbeSettings container liveness and readiness probe settings +type ContainerProbeSettings struct { + // DisableProbe - Indicates whether disable the liveness and readiness probe + DisableProbe *bool `json:"disableProbe,omitempty"` +} + +// ContentCertificateProperties properties of certificate imported from key vault. +type ContentCertificateProperties struct { + // Content - The content of uploaded certificate. + Content *string `json:"content,omitempty"` + // Thumbprint - READ-ONLY; The thumbprint of certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // Issuer - READ-ONLY; The issuer of certificate. + Issuer *string `json:"issuer,omitempty"` + // IssuedDate - READ-ONLY; The issue date of certificate. + IssuedDate *string `json:"issuedDate,omitempty"` + // ExpirationDate - READ-ONLY; The expiration date of certificate. + ExpirationDate *string `json:"expirationDate,omitempty"` + // ActivateDate - READ-ONLY; The activate date of certificate. + ActivateDate *string `json:"activateDate,omitempty"` + // SubjectName - READ-ONLY; The subject name of certificate. + SubjectName *string `json:"subjectName,omitempty"` + // DNSNames - READ-ONLY; The domain list of certificate. + DNSNames *[]string `json:"dnsNames,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Certificate. Possible values include: 'CertificateResourceProvisioningStateCreating', 'CertificateResourceProvisioningStateUpdating', 'CertificateResourceProvisioningStateSucceeded', 'CertificateResourceProvisioningStateFailed', 'CertificateResourceProvisioningStateDeleting' + ProvisioningState CertificateResourceProvisioningState `json:"provisioningState,omitempty"` + // Type - Possible values include: 'TypeCertificateProperties', 'TypeKeyVaultCertificate', 'TypeContentCertificate' + Type TypeBasicCertificateProperties `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContentCertificateProperties. +func (ccp ContentCertificateProperties) MarshalJSON() ([]byte, error) { + ccp.Type = TypeContentCertificate + objectMap := make(map[string]interface{}) + if ccp.Content != nil { + objectMap["content"] = ccp.Content + } + if ccp.Type != "" { + objectMap["type"] = ccp.Type + } + return json.Marshal(objectMap) +} + +// AsKeyVaultCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. +func (ccp ContentCertificateProperties) AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) { + return nil, false +} + +// AsContentCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. +func (ccp ContentCertificateProperties) AsContentCertificateProperties() (*ContentCertificateProperties, bool) { + return &ccp, true +} + +// AsCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. +func (ccp ContentCertificateProperties) AsCertificateProperties() (*CertificateProperties, bool) { + return nil, false +} + +// AsBasicCertificateProperties is the BasicCertificateProperties implementation for ContentCertificateProperties. +func (ccp ContentCertificateProperties) AsBasicCertificateProperties() (BasicCertificateProperties, bool) { + return &ccp, true +} + +// CustomContainer custom container payload +type CustomContainer struct { + // Server - The name of the registry that contains the container image + Server *string `json:"server,omitempty"` + // ContainerImage - Container image of the custom container. This should be in the form of : without the server name of the registry + ContainerImage *string `json:"containerImage,omitempty"` + // Command - Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. + Command *[]string `json:"command,omitempty"` + // Args - Arguments to the entrypoint. The docker image's CMD is used if this is not provided. + Args *[]string `json:"args,omitempty"` + // ImageRegistryCredential - Credential of the image registry + ImageRegistryCredential *ImageRegistryCredential `json:"imageRegistryCredential,omitempty"` + // LanguageFramework - Language framework of the container image uploaded + LanguageFramework *string `json:"languageFramework,omitempty"` +} + +// CustomContainerUserSourceInfo custom container user source info +type CustomContainerUserSourceInfo struct { + CustomContainer *CustomContainer `json:"customContainer,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult', 'TypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) MarshalJSON() ([]byte, error) { + ccusi.Type = TypeContainer + objectMap := make(map[string]interface{}) + if ccusi.CustomContainer != nil { + objectMap["customContainer"] = ccusi.CustomContainer + } + if ccusi.Version != nil { + objectMap["version"] = ccusi.Version + } + if ccusi.Type != "" { + objectMap["type"] = ccusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return &ccusi, true +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for CustomContainerUserSourceInfo. +func (ccusi CustomContainerUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &ccusi, true +} + +// CustomDomainProperties custom domain of app resource payload. +type CustomDomainProperties struct { + // Thumbprint - The thumbprint of bound certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // AppName - READ-ONLY; The app name of domain. + AppName *string `json:"appName,omitempty"` + // CertName - The bound certificate name of domain. + CertName *string `json:"certName,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Domain. Possible values include: 'CustomDomainResourceProvisioningStateCreating', 'CustomDomainResourceProvisioningStateUpdating', 'CustomDomainResourceProvisioningStateSucceeded', 'CustomDomainResourceProvisioningStateFailed', 'CustomDomainResourceProvisioningStateDeleting' + ProvisioningState CustomDomainResourceProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainProperties. +func (cdp CustomDomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdp.Thumbprint != nil { + objectMap["thumbprint"] = cdp.Thumbprint + } + if cdp.CertName != nil { + objectMap["certName"] = cdp.CertName + } + return json.Marshal(objectMap) +} + +// CustomDomainResource custom domain resource payload. +type CustomDomainResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the custom domain resource. + Properties *CustomDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomDomainResource. +func (cdr CustomDomainResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cdr.Properties != nil { + objectMap["properties"] = cdr.Properties + } + if cdr.SystemData != nil { + objectMap["systemData"] = cdr.SystemData + } + return json.Marshal(objectMap) +} + +// CustomDomainResourceCollection collection compose of a custom domain resources list and a possible link +// for next page. +type CustomDomainResourceCollection struct { + autorest.Response `json:"-"` + // Value - The custom domain resources list. + Value *[]CustomDomainResource `json:"value,omitempty"` + // NextLink - The link to next page of custom domain list. + NextLink *string `json:"nextLink,omitempty"` +} + +// CustomDomainResourceCollectionIterator provides access to a complete listing of CustomDomainResource +// values. +type CustomDomainResourceCollectionIterator struct { + i int + page CustomDomainResourceCollectionPage +} + +// 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 *CustomDomainResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainResourceCollectionIterator.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 *CustomDomainResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CustomDomainResourceCollectionIterator) 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 CustomDomainResourceCollectionIterator) Response() CustomDomainResourceCollection { + 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 CustomDomainResourceCollectionIterator) Value() CustomDomainResource { + if !iter.page.NotDone() { + return CustomDomainResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CustomDomainResourceCollectionIterator type. +func NewCustomDomainResourceCollectionIterator(page CustomDomainResourceCollectionPage) CustomDomainResourceCollectionIterator { + return CustomDomainResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cdrc CustomDomainResourceCollection) IsEmpty() bool { + return cdrc.Value == nil || len(*cdrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cdrc CustomDomainResourceCollection) hasNextLink() bool { + return cdrc.NextLink != nil && len(*cdrc.NextLink) != 0 +} + +// customDomainResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cdrc CustomDomainResourceCollection) customDomainResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !cdrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cdrc.NextLink))) +} + +// CustomDomainResourceCollectionPage contains a page of CustomDomainResource values. +type CustomDomainResourceCollectionPage struct { + fn func(context.Context, CustomDomainResourceCollection) (CustomDomainResourceCollection, error) + cdrc CustomDomainResourceCollection +} + +// 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 *CustomDomainResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomDomainResourceCollectionPage.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.cdrc) + if err != nil { + return err + } + page.cdrc = 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 *CustomDomainResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CustomDomainResourceCollectionPage) NotDone() bool { + return !page.cdrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CustomDomainResourceCollectionPage) Response() CustomDomainResourceCollection { + return page.cdrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CustomDomainResourceCollectionPage) Values() []CustomDomainResource { + if page.cdrc.IsEmpty() { + return nil + } + return *page.cdrc.Value +} + +// Creates a new instance of the CustomDomainResourceCollectionPage type. +func NewCustomDomainResourceCollectionPage(cur CustomDomainResourceCollection, getNextPage func(context.Context, CustomDomainResourceCollection) (CustomDomainResourceCollection, error)) CustomDomainResourceCollectionPage { + return CustomDomainResourceCollectionPage{ + fn: getNextPage, + cdrc: cur, + } +} + +// CustomDomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type CustomDomainsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (CustomDomainResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsCreateOrUpdateFuture) 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 CustomDomainsCreateOrUpdateFuture.Result. +func (future *CustomDomainsCreateOrUpdateFuture) result(client CustomDomainsClient) (cdr CustomDomainResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cdr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CustomDomainsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cdr.Response.Response, err = future.GetResult(sender); err == nil && cdr.Response.Response.StatusCode != http.StatusNoContent { + cdr, err = client.CreateOrUpdateResponder(cdr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsCreateOrUpdateFuture", "Result", cdr.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomDomainsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsDeleteFuture) 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 CustomDomainsDeleteFuture.Result. +func (future *CustomDomainsDeleteFuture) result(client CustomDomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CustomDomainsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// CustomDomainsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomDomainsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomDomainsClient) (CustomDomainResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomDomainsUpdateFuture) 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 CustomDomainsUpdateFuture.Result. +func (future *CustomDomainsUpdateFuture) result(client CustomDomainsClient) (cdr CustomDomainResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cdr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.CustomDomainsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cdr.Response.Response, err = future.GetResult(sender); err == nil && cdr.Response.Response.StatusCode != http.StatusNoContent { + cdr, err = client.UpdateResponder(cdr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.CustomDomainsUpdateFuture", "Result", cdr.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomDomainValidatePayload custom domain validate payload. +type CustomDomainValidatePayload struct { + // Name - Name to be validated + Name *string `json:"name,omitempty"` +} + +// CustomDomainValidateResult validation result for custom domain. +type CustomDomainValidateResult struct { + autorest.Response `json:"-"` + // IsValid - Indicates if domain name is valid. + IsValid *bool `json:"isValid,omitempty"` + // Message - Message of why domain name is invalid. + Message *string `json:"message,omitempty"` +} + +// BasicCustomPersistentDiskProperties custom persistent disk resource payload. +type BasicCustomPersistentDiskProperties interface { + AsAzureFileVolume() (*AzureFileVolume, bool) + AsCustomPersistentDiskProperties() (*CustomPersistentDiskProperties, bool) +} + +// CustomPersistentDiskProperties custom persistent disk resource payload. +type CustomPersistentDiskProperties struct { + // MountPath - The mount path of the persistent disk. + MountPath *string `json:"mountPath,omitempty"` + // ReadOnly - Indicates whether the persistent disk is a readOnly one. + ReadOnly *bool `json:"readOnly,omitempty"` + // MountOptions - These are the mount options for a persistent disk. + MountOptions *[]string `json:"mountOptions,omitempty"` + // Type - Possible values include: 'TypeCustomPersistentDiskProperties', 'TypeAzureFileVolume' + Type Type `json:"type,omitempty"` +} + +func unmarshalBasicCustomPersistentDiskProperties(body []byte) (BasicCustomPersistentDiskProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeAzureFileVolume): + var afv AzureFileVolume + err := json.Unmarshal(body, &afv) + return afv, err + default: + var cpdp CustomPersistentDiskProperties + err := json.Unmarshal(body, &cpdp) + return cpdp, err + } +} +func unmarshalBasicCustomPersistentDiskPropertiesArray(body []byte) ([]BasicCustomPersistentDiskProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + cpdpArray := make([]BasicCustomPersistentDiskProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + cpdp, err := unmarshalBasicCustomPersistentDiskProperties(*rawMessage) + if err != nil { + return nil, err + } + cpdpArray[index] = cpdp + } + return cpdpArray, nil +} + +// MarshalJSON is the custom marshaler for CustomPersistentDiskProperties. +func (cpdp CustomPersistentDiskProperties) MarshalJSON() ([]byte, error) { + cpdp.Type = TypeCustomPersistentDiskProperties + objectMap := make(map[string]interface{}) + if cpdp.MountPath != nil { + objectMap["mountPath"] = cpdp.MountPath + } + if cpdp.ReadOnly != nil { + objectMap["readOnly"] = cpdp.ReadOnly + } + if cpdp.MountOptions != nil { + objectMap["mountOptions"] = cpdp.MountOptions + } + if cpdp.Type != "" { + objectMap["type"] = cpdp.Type + } + return json.Marshal(objectMap) +} + +// AsAzureFileVolume is the BasicCustomPersistentDiskProperties implementation for CustomPersistentDiskProperties. +func (cpdp CustomPersistentDiskProperties) AsAzureFileVolume() (*AzureFileVolume, bool) { + return nil, false +} + +// AsCustomPersistentDiskProperties is the BasicCustomPersistentDiskProperties implementation for CustomPersistentDiskProperties. +func (cpdp CustomPersistentDiskProperties) AsCustomPersistentDiskProperties() (*CustomPersistentDiskProperties, bool) { + return &cpdp, true +} + +// AsBasicCustomPersistentDiskProperties is the BasicCustomPersistentDiskProperties implementation for CustomPersistentDiskProperties. +func (cpdp CustomPersistentDiskProperties) AsBasicCustomPersistentDiskProperties() (BasicCustomPersistentDiskProperties, bool) { + return &cpdp, true +} + +// CustomPersistentDiskResource custom persistent disk resource payload. +type CustomPersistentDiskResource struct { + // CustomPersistentDiskProperties - Properties of the custom persistent disk resource payload. + CustomPersistentDiskProperties BasicCustomPersistentDiskProperties `json:"customPersistentDiskProperties,omitempty"` + // StorageID - The resource id of Azure Spring Apps Storage resource. + StorageID *string `json:"storageId,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for CustomPersistentDiskResource struct. +func (cpdr *CustomPersistentDiskResource) 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 "customPersistentDiskProperties": + if v != nil { + customPersistentDiskProperties, err := unmarshalBasicCustomPersistentDiskProperties(*v) + if err != nil { + return err + } + cpdr.CustomPersistentDiskProperties = customPersistentDiskProperties + } + case "storageId": + if v != nil { + var storageID string + err = json.Unmarshal(*v, &storageID) + if err != nil { + return err + } + cpdr.StorageID = &storageID + } + } + } + + return nil +} + +// DeploymentInstance deployment instance payload +type DeploymentInstance struct { + // Name - READ-ONLY; Name of the deployment instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the deployment instance + Status *string `json:"status,omitempty"` + // Reason - READ-ONLY; Failed reason of the deployment instance + Reason *string `json:"reason,omitempty"` + // DiscoveryStatus - READ-ONLY; Discovery status of the deployment instance + DiscoveryStatus *string `json:"discoveryStatus,omitempty"` + // StartTime - READ-ONLY; Start time of the deployment instance + StartTime *string `json:"startTime,omitempty"` + // Zone - READ-ONLY; Availability zone information of the deployment instance + Zone *string `json:"zone,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentInstance. +func (di DeploymentInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DeploymentResource deployment resource payload +type DeploymentResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Deployment resource + Properties *DeploymentResourceProperties `json:"properties,omitempty"` + // Sku - Sku of the Deployment resource + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentResource. +func (dr DeploymentResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dr.Properties != nil { + objectMap["properties"] = dr.Properties + } + if dr.Sku != nil { + objectMap["sku"] = dr.Sku + } + if dr.SystemData != nil { + objectMap["systemData"] = dr.SystemData + } + return json.Marshal(objectMap) +} + +// DeploymentResourceCollection object that includes an array of App resources and a possible link for next +// set +type DeploymentResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Deployment resources + Value *[]DeploymentResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeploymentResourceCollectionIterator provides access to a complete listing of DeploymentResource values. +type DeploymentResourceCollectionIterator struct { + i int + page DeploymentResourceCollectionPage +} + +// 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 *DeploymentResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentResourceCollectionIterator.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 *DeploymentResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeploymentResourceCollectionIterator) 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 DeploymentResourceCollectionIterator) Response() DeploymentResourceCollection { + 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 DeploymentResourceCollectionIterator) Value() DeploymentResource { + if !iter.page.NotDone() { + return DeploymentResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeploymentResourceCollectionIterator type. +func NewDeploymentResourceCollectionIterator(page DeploymentResourceCollectionPage) DeploymentResourceCollectionIterator { + return DeploymentResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (drc DeploymentResourceCollection) IsEmpty() bool { + return drc.Value == nil || len(*drc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (drc DeploymentResourceCollection) hasNextLink() bool { + return drc.NextLink != nil && len(*drc.NextLink) != 0 +} + +// deploymentResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (drc DeploymentResourceCollection) deploymentResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !drc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(drc.NextLink))) +} + +// DeploymentResourceCollectionPage contains a page of DeploymentResource values. +type DeploymentResourceCollectionPage struct { + fn func(context.Context, DeploymentResourceCollection) (DeploymentResourceCollection, error) + drc DeploymentResourceCollection +} + +// 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 *DeploymentResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentResourceCollectionPage.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.drc) + if err != nil { + return err + } + page.drc = 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 *DeploymentResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeploymentResourceCollectionPage) NotDone() bool { + return !page.drc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeploymentResourceCollectionPage) Response() DeploymentResourceCollection { + return page.drc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeploymentResourceCollectionPage) Values() []DeploymentResource { + if page.drc.IsEmpty() { + return nil + } + return *page.drc.Value +} + +// Creates a new instance of the DeploymentResourceCollectionPage type. +func NewDeploymentResourceCollectionPage(cur DeploymentResourceCollection, getNextPage func(context.Context, DeploymentResourceCollection) (DeploymentResourceCollection, error)) DeploymentResourceCollectionPage { + return DeploymentResourceCollectionPage{ + fn: getNextPage, + drc: cur, + } +} + +// DeploymentResourceProperties deployment resource properties payload +type DeploymentResourceProperties struct { + // Source - Uploaded source information of the deployment. + Source BasicUserSourceInfo `json:"source,omitempty"` + // DeploymentSettings - Deployment settings of the Deployment + DeploymentSettings *DeploymentSettings `json:"deploymentSettings,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Deployment. Possible values include: 'DeploymentResourceProvisioningStateCreating', 'DeploymentResourceProvisioningStateUpdating', 'DeploymentResourceProvisioningStateSucceeded', 'DeploymentResourceProvisioningStateFailed' + ProvisioningState DeploymentResourceProvisioningState `json:"provisioningState,omitempty"` + // Status - READ-ONLY; Status of the Deployment. Possible values include: 'Stopped', 'Running' + Status DeploymentResourceStatus `json:"status,omitempty"` + // Active - Indicates whether the Deployment is active + Active *bool `json:"active,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to the Deployment + Instances *[]DeploymentInstance `json:"instances,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentResourceProperties. +func (drp DeploymentResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["source"] = drp.Source + if drp.DeploymentSettings != nil { + objectMap["deploymentSettings"] = drp.DeploymentSettings + } + if drp.Active != nil { + objectMap["active"] = drp.Active + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DeploymentResourceProperties struct. +func (drp *DeploymentResourceProperties) 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 := unmarshalBasicUserSourceInfo(*v) + if err != nil { + return err + } + drp.Source = source + } + case "deploymentSettings": + if v != nil { + var deploymentSettings DeploymentSettings + err = json.Unmarshal(*v, &deploymentSettings) + if err != nil { + return err + } + drp.DeploymentSettings = &deploymentSettings + } + case "provisioningState": + if v != nil { + var provisioningState DeploymentResourceProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + drp.ProvisioningState = provisioningState + } + case "status": + if v != nil { + var status DeploymentResourceStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + drp.Status = status + } + case "active": + if v != nil { + var active bool + err = json.Unmarshal(*v, &active) + if err != nil { + return err + } + drp.Active = &active + } + case "instances": + if v != nil { + var instances []DeploymentInstance + err = json.Unmarshal(*v, &instances) + if err != nil { + return err + } + drp.Instances = &instances + } + } + } + + return nil +} + +// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsCreateOrUpdateFuture) 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 DeploymentsCreateOrUpdateFuture.Result. +func (future *DeploymentsCreateOrUpdateFuture) result(client DeploymentsClient) (dr DeploymentResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dr.Response.Response, err = future.GetResult(sender); err == nil && dr.Response.Response.StatusCode != http.StatusNoContent { + dr, err = client.CreateOrUpdateResponder(dr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsCreateOrUpdateFuture", "Result", dr.Response.Response, "Failure responding to request") + } + } + return +} + +// DeploymentsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsDeleteFuture) 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 DeploymentsDeleteFuture.Result. +func (future *DeploymentsDeleteFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentSettings deployment settings payload +type DeploymentSettings struct { + // ResourceRequests - The requested resource quantity for required CPU and Memory. It is recommended that using this field to represent the required CPU and Memory, the old field cpu and memoryInGB will be deprecated later. + ResourceRequests *ResourceRequests `json:"resourceRequests,omitempty"` + // EnvironmentVariables - Collection of environment variables + EnvironmentVariables map[string]*string `json:"environmentVariables"` + // AddonConfigs - Collection of addons + AddonConfigs map[string]map[string]interface{} `json:"addonConfigs"` + // LivenessProbe - Periodic probe of App Instance liveness. App Instance will be restarted if the probe fails. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + LivenessProbe *Probe `json:"livenessProbe,omitempty"` + // ReadinessProbe - Periodic probe of App Instance service readiness. App Instance will be removed from service endpoints if the probe fails. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + ReadinessProbe *Probe `json:"readinessProbe,omitempty"` + // StartupProbe - StartupProbe indicates that the App Instance has successfully initialized. If specified, no other probes are executed until this completes successfully. If this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to provide different probe parameters at the beginning of a App Instance's lifecycle, when it might take a long time to load data or warm a cache, than during steady-state operation. This cannot be updated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + StartupProbe *Probe `json:"startupProbe,omitempty"` + // TerminationGracePeriodSeconds - Optional duration in seconds the App Instance needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the App Instance are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 90 seconds. + TerminationGracePeriodSeconds *int32 `json:"terminationGracePeriodSeconds,omitempty"` + ContainerProbeSettings *ContainerProbeSettings `json:"containerProbeSettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeploymentSettings. +func (ds DeploymentSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ds.ResourceRequests != nil { + objectMap["resourceRequests"] = ds.ResourceRequests + } + if ds.EnvironmentVariables != nil { + objectMap["environmentVariables"] = ds.EnvironmentVariables + } + if ds.AddonConfigs != nil { + objectMap["addonConfigs"] = ds.AddonConfigs + } + if ds.LivenessProbe != nil { + objectMap["livenessProbe"] = ds.LivenessProbe + } + if ds.ReadinessProbe != nil { + objectMap["readinessProbe"] = ds.ReadinessProbe + } + if ds.StartupProbe != nil { + objectMap["startupProbe"] = ds.StartupProbe + } + if ds.TerminationGracePeriodSeconds != nil { + objectMap["terminationGracePeriodSeconds"] = ds.TerminationGracePeriodSeconds + } + if ds.ContainerProbeSettings != nil { + objectMap["containerProbeSettings"] = ds.ContainerProbeSettings + } + return json.Marshal(objectMap) +} + +// DeploymentsGenerateHeapDumpFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsGenerateHeapDumpFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsGenerateHeapDumpFuture) 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 DeploymentsGenerateHeapDumpFuture.Result. +func (future *DeploymentsGenerateHeapDumpFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsGenerateHeapDumpFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsGenerateHeapDumpFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsGenerateThreadDumpFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeploymentsGenerateThreadDumpFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsGenerateThreadDumpFuture) 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 DeploymentsGenerateThreadDumpFuture.Result. +func (future *DeploymentsGenerateThreadDumpFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsGenerateThreadDumpFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsGenerateThreadDumpFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsRestartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsRestartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsRestartFuture) 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 DeploymentsRestartFuture.Result. +func (future *DeploymentsRestartFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsRestartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsRestartFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsStartFuture) 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 DeploymentsStartFuture.Result. +func (future *DeploymentsStartFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStartFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsStartJFRFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsStartJFRFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsStartJFRFuture) 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 DeploymentsStartJFRFuture.Result. +func (future *DeploymentsStartJFRFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStartJFRFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStartJFRFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsStopFuture) 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 DeploymentsStopFuture.Result. +func (future *DeploymentsStopFuture) result(client DeploymentsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsStopFuture") + return + } + ar.Response = future.Response() + return +} + +// DeploymentsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DeploymentsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DeploymentsClient) (DeploymentResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeploymentsUpdateFuture) 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 DeploymentsUpdateFuture.Result. +func (future *DeploymentsUpdateFuture) result(client DeploymentsClient) (dr DeploymentResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.DeploymentsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dr.Response.Response, err = future.GetResult(sender); err == nil && dr.Response.Response.StatusCode != http.StatusNoContent { + dr, err = client.UpdateResponder(dr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.DeploymentsUpdateFuture", "Result", dr.Response.Response, "Failure responding to request") + } + } + return +} + +// DiagnosticParameters diagnostic parameters of diagnostic operations +type DiagnosticParameters struct { + // AppInstance - App instance name + AppInstance *string `json:"appInstance,omitempty"` + // FilePath - Your target file path in your own BYOS + FilePath *string `json:"filePath,omitempty"` + // Duration - Duration of your JFR. 1 min can be represented by 1m or 60s. + Duration *string `json:"duration,omitempty"` +} + +// Error the error code compose of code and message. +type Error struct { + // Code - The code of error. + Code *string `json:"code,omitempty"` + // Message - The message of error. + Message *string `json:"message,omitempty"` +} + +// ExecAction execAction describes a "run in container" action. +type ExecAction struct { + // Command - Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy. + Command *[]string `json:"command,omitempty"` + // Type - Possible values include: 'TypeProbeAction', 'TypeHTTPGetAction', 'TypeExecAction', 'TypeTCPSocketAction' + Type TypeBasicProbeAction `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExecAction. +func (ea ExecAction) MarshalJSON() ([]byte, error) { + ea.Type = TypeExecAction + objectMap := make(map[string]interface{}) + if ea.Command != nil { + objectMap["command"] = ea.Command + } + if ea.Type != "" { + objectMap["type"] = ea.Type + } + return json.Marshal(objectMap) +} + +// AsHTTPGetAction is the BasicProbeAction implementation for ExecAction. +func (ea ExecAction) AsHTTPGetAction() (*HTTPGetAction, bool) { + return nil, false +} + +// AsExecAction is the BasicProbeAction implementation for ExecAction. +func (ea ExecAction) AsExecAction() (*ExecAction, bool) { + return &ea, true +} + +// AsTCPSocketAction is the BasicProbeAction implementation for ExecAction. +func (ea ExecAction) AsTCPSocketAction() (*TCPSocketAction, bool) { + return nil, false +} + +// AsProbeAction is the BasicProbeAction implementation for ExecAction. +func (ea ExecAction) AsProbeAction() (*ProbeAction, bool) { + return nil, false +} + +// AsBasicProbeAction is the BasicProbeAction implementation for ExecAction. +func (ea ExecAction) AsBasicProbeAction() (BasicProbeAction, bool) { + return &ea, true +} + +// GatewayAPIMetadataProperties API metadata property for Spring Cloud Gateway +type GatewayAPIMetadataProperties struct { + // Title - Title describing the context of the APIs available on the Gateway instance (default: `Spring Cloud Gateway for K8S`) + Title *string `json:"title,omitempty"` + // Description - Detailed description of the APIs available on the Gateway instance (default: `Generated OpenAPI 3 document that describes the API routes configured.`) + Description *string `json:"description,omitempty"` + // Documentation - Location of additional documentation for the APIs available on the Gateway instance + Documentation *string `json:"documentation,omitempty"` + // Version - Version of APIs available on this Gateway instance (default: `unspecified`). + Version *string `json:"version,omitempty"` + // ServerURL - Base URL that API consumers will use to access APIs on the Gateway instance. + ServerURL *string `json:"serverUrl,omitempty"` +} + +// GatewayAPIRoute API route config of the Spring Cloud Gateway +type GatewayAPIRoute struct { + // Title - A title, will be applied to methods in the generated OpenAPI documentation. + Title *string `json:"title,omitempty"` + // Description - A description, will be applied to methods in the generated OpenAPI documentation. + Description *string `json:"description,omitempty"` + // URI - Full uri, will override `appName`. + URI *string `json:"uri,omitempty"` + // SsoEnabled - Enable sso validation. + SsoEnabled *bool `json:"ssoEnabled,omitempty"` + // TokenRelay - Pass currently-authenticated user's identity token to application service, default is 'false' + TokenRelay *bool `json:"tokenRelay,omitempty"` + // Predicates - A number of conditions to evaluate a route for each request. Each predicate may be evaluated against request headers and parameter values. All of the predicates associated with a route must evaluate to true for the route to be matched to the request. + Predicates *[]string `json:"predicates,omitempty"` + // Filters - To modify the request before sending it to the target endpoint, or the received response. + Filters *[]string `json:"filters,omitempty"` + // Order - Route processing order. + Order *int32 `json:"order,omitempty"` + // Tags - Classification tags, will be applied to methods in the generated OpenAPI documentation. + Tags *[]string `json:"tags,omitempty"` +} + +// GatewayCorsProperties cross-Origin Resource Sharing property +type GatewayCorsProperties struct { + // AllowedOrigins - Allowed origins to make cross-site requests. The special value `*` allows all domains. + AllowedOrigins *[]string `json:"allowedOrigins,omitempty"` + // AllowedMethods - Allowed HTTP methods on cross-site requests. The special value `*` allows all methods. If not set, `GET` and `HEAD` are allowed by default. + AllowedMethods *[]string `json:"allowedMethods,omitempty"` + // AllowedHeaders - Allowed headers in cross-site requests. The special value `*` allows actual requests to send any header. + AllowedHeaders *[]string `json:"allowedHeaders,omitempty"` + // MaxAge - How long, in seconds, the response from a pre-flight request can be cached by clients. + MaxAge *int32 `json:"maxAge,omitempty"` + // AllowCredentials - Whether user credentials are supported on cross-site requests. Valid values: `true`, `false`. + AllowCredentials *bool `json:"allowCredentials,omitempty"` + // ExposedHeaders - HTTP response headers to expose for cross-site requests. + ExposedHeaders *[]string `json:"exposedHeaders,omitempty"` +} + +// GatewayCustomDomainProperties the properties of custom domain for Spring Cloud Gateway +type GatewayCustomDomainProperties struct { + // Thumbprint - The thumbprint of bound certificate. + Thumbprint *string `json:"thumbprint,omitempty"` +} + +// GatewayCustomDomainResource custom domain of the Spring Cloud Gateway +type GatewayCustomDomainResource struct { + autorest.Response `json:"-"` + Properties *GatewayCustomDomainProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayCustomDomainResource. +func (gcdr GatewayCustomDomainResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gcdr.Properties != nil { + objectMap["properties"] = gcdr.Properties + } + if gcdr.SystemData != nil { + objectMap["systemData"] = gcdr.SystemData + } + return json.Marshal(objectMap) +} + +// GatewayCustomDomainResourceCollection object that includes an array of Spring Cloud Gateway custom +// domain resources and a possible link for next set +type GatewayCustomDomainResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Spring Cloud Gateway custom domain resources + Value *[]GatewayCustomDomainResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// GatewayCustomDomainResourceCollectionIterator provides access to a complete listing of +// GatewayCustomDomainResource values. +type GatewayCustomDomainResourceCollectionIterator struct { + i int + page GatewayCustomDomainResourceCollectionPage +} + +// 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 *GatewayCustomDomainResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCustomDomainResourceCollectionIterator.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 *GatewayCustomDomainResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter GatewayCustomDomainResourceCollectionIterator) 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 GatewayCustomDomainResourceCollectionIterator) Response() GatewayCustomDomainResourceCollection { + 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 GatewayCustomDomainResourceCollectionIterator) Value() GatewayCustomDomainResource { + if !iter.page.NotDone() { + return GatewayCustomDomainResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the GatewayCustomDomainResourceCollectionIterator type. +func NewGatewayCustomDomainResourceCollectionIterator(page GatewayCustomDomainResourceCollectionPage) GatewayCustomDomainResourceCollectionIterator { + return GatewayCustomDomainResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (gcdrc GatewayCustomDomainResourceCollection) IsEmpty() bool { + return gcdrc.Value == nil || len(*gcdrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (gcdrc GatewayCustomDomainResourceCollection) hasNextLink() bool { + return gcdrc.NextLink != nil && len(*gcdrc.NextLink) != 0 +} + +// gatewayCustomDomainResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (gcdrc GatewayCustomDomainResourceCollection) gatewayCustomDomainResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !gcdrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(gcdrc.NextLink))) +} + +// GatewayCustomDomainResourceCollectionPage contains a page of GatewayCustomDomainResource values. +type GatewayCustomDomainResourceCollectionPage struct { + fn func(context.Context, GatewayCustomDomainResourceCollection) (GatewayCustomDomainResourceCollection, error) + gcdrc GatewayCustomDomainResourceCollection +} + +// 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 *GatewayCustomDomainResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayCustomDomainResourceCollectionPage.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.gcdrc) + if err != nil { + return err + } + page.gcdrc = 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 *GatewayCustomDomainResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page GatewayCustomDomainResourceCollectionPage) NotDone() bool { + return !page.gcdrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page GatewayCustomDomainResourceCollectionPage) Response() GatewayCustomDomainResourceCollection { + return page.gcdrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page GatewayCustomDomainResourceCollectionPage) Values() []GatewayCustomDomainResource { + if page.gcdrc.IsEmpty() { + return nil + } + return *page.gcdrc.Value +} + +// Creates a new instance of the GatewayCustomDomainResourceCollectionPage type. +func NewGatewayCustomDomainResourceCollectionPage(cur GatewayCustomDomainResourceCollection, getNextPage func(context.Context, GatewayCustomDomainResourceCollection) (GatewayCustomDomainResourceCollection, error)) GatewayCustomDomainResourceCollectionPage { + return GatewayCustomDomainResourceCollectionPage{ + fn: getNextPage, + gcdrc: cur, + } +} + +// GatewayCustomDomainsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GatewayCustomDomainsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GatewayCustomDomainsClient) (GatewayCustomDomainResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GatewayCustomDomainsCreateOrUpdateFuture) 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 GatewayCustomDomainsCreateOrUpdateFuture.Result. +func (future *GatewayCustomDomainsCreateOrUpdateFuture) result(client GatewayCustomDomainsClient) (gcdr GatewayCustomDomainResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + gcdr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.GatewayCustomDomainsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gcdr.Response.Response, err = future.GetResult(sender); err == nil && gcdr.Response.Response.StatusCode != http.StatusNoContent { + gcdr, err = client.CreateOrUpdateResponder(gcdr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsCreateOrUpdateFuture", "Result", gcdr.Response.Response, "Failure responding to request") + } + } + return +} + +// GatewayCustomDomainsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GatewayCustomDomainsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GatewayCustomDomainsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GatewayCustomDomainsDeleteFuture) 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 GatewayCustomDomainsDeleteFuture.Result. +func (future *GatewayCustomDomainsDeleteFuture) result(client GatewayCustomDomainsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayCustomDomainsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.GatewayCustomDomainsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// GatewayInstance collection of instances belong to the Spring Cloud Gateway +type GatewayInstance struct { + // Name - READ-ONLY; Name of the Spring Cloud Gateway instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the Spring Cloud Gateway instance + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayInstance. +func (gi GatewayInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// GatewayOperatorProperties properties of the Spring Cloud Gateway Operator. +type GatewayOperatorProperties struct { + // ResourceRequests - The requested resource quantity for required CPU and Memory. + ResourceRequests *GatewayOperatorResourceRequests `json:"resourceRequests,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to Spring Cloud Gateway operator. + Instances *[]GatewayInstance `json:"instances,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayOperatorProperties. +func (gop GatewayOperatorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gop.ResourceRequests != nil { + objectMap["resourceRequests"] = gop.ResourceRequests + } + return json.Marshal(objectMap) +} + +// GatewayOperatorResourceRequests properties of the Spring Cloud Gateway Operator. +type GatewayOperatorResourceRequests struct { + // CPU - READ-ONLY; Cpu allocated to each Spring Cloud Gateway Operator instance. + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to each Spring Cloud Gateway Operator instance. + Memory *string `json:"memory,omitempty"` + // InstanceCount - READ-ONLY; Instance count of the Spring Cloud Gateway Operator. + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayOperatorResourceRequests. +func (gorr GatewayOperatorResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// GatewayProperties spring Cloud Gateway properties payload +type GatewayProperties struct { + // ProvisioningState - READ-ONLY; State of the Spring Cloud Gateway. Possible values include: 'GatewayProvisioningStateCreating', 'GatewayProvisioningStateUpdating', 'GatewayProvisioningStateSucceeded', 'GatewayProvisioningStateFailed', 'GatewayProvisioningStateDeleting' + ProvisioningState GatewayProvisioningState `json:"provisioningState,omitempty"` + // Public - Indicates whether the Spring Cloud Gateway exposes endpoint. + Public *bool `json:"public,omitempty"` + // URL - READ-ONLY; URL of the Spring Cloud Gateway, exposed when 'public' is true. + URL *string `json:"url,omitempty"` + // HTTPSOnly - Indicate if only https is allowed. + HTTPSOnly *bool `json:"httpsOnly,omitempty"` + SsoProperties *SsoProperties `json:"ssoProperties,omitempty"` + APIMetadataProperties *GatewayAPIMetadataProperties `json:"apiMetadataProperties,omitempty"` + CorsProperties *GatewayCorsProperties `json:"corsProperties,omitempty"` + // ResourceRequests - The requested resource quantity for required CPU and Memory. + ResourceRequests *GatewayResourceRequests `json:"resourceRequests,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to Spring Cloud Gateway. + Instances *[]GatewayInstance `json:"instances,omitempty"` + // OperatorProperties - READ-ONLY + OperatorProperties *GatewayOperatorProperties `json:"operatorProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayProperties. +func (gp GatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gp.Public != nil { + objectMap["public"] = gp.Public + } + if gp.HTTPSOnly != nil { + objectMap["httpsOnly"] = gp.HTTPSOnly + } + if gp.SsoProperties != nil { + objectMap["ssoProperties"] = gp.SsoProperties + } + if gp.APIMetadataProperties != nil { + objectMap["apiMetadataProperties"] = gp.APIMetadataProperties + } + if gp.CorsProperties != nil { + objectMap["corsProperties"] = gp.CorsProperties + } + if gp.ResourceRequests != nil { + objectMap["resourceRequests"] = gp.ResourceRequests + } + return json.Marshal(objectMap) +} + +// GatewayResource spring Cloud Gateway resource +type GatewayResource struct { + autorest.Response `json:"-"` + Properties *GatewayProperties `json:"properties,omitempty"` + // Sku - Sku of the Spring Cloud Gateway resource + Sku *Sku `json:"sku,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayResource. +func (gr GatewayResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gr.Properties != nil { + objectMap["properties"] = gr.Properties + } + if gr.Sku != nil { + objectMap["sku"] = gr.Sku + } + if gr.SystemData != nil { + objectMap["systemData"] = gr.SystemData + } + return json.Marshal(objectMap) +} + +// GatewayResourceCollection object that includes an array of gateway resources and a possible link for +// next set +type GatewayResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of gateway resources + Value *[]GatewayResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// GatewayResourceCollectionIterator provides access to a complete listing of GatewayResource values. +type GatewayResourceCollectionIterator struct { + i int + page GatewayResourceCollectionPage +} + +// 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 *GatewayResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayResourceCollectionIterator.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 *GatewayResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter GatewayResourceCollectionIterator) 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 GatewayResourceCollectionIterator) Response() GatewayResourceCollection { + 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 GatewayResourceCollectionIterator) Value() GatewayResource { + if !iter.page.NotDone() { + return GatewayResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the GatewayResourceCollectionIterator type. +func NewGatewayResourceCollectionIterator(page GatewayResourceCollectionPage) GatewayResourceCollectionIterator { + return GatewayResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (grc GatewayResourceCollection) IsEmpty() bool { + return grc.Value == nil || len(*grc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (grc GatewayResourceCollection) hasNextLink() bool { + return grc.NextLink != nil && len(*grc.NextLink) != 0 +} + +// gatewayResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (grc GatewayResourceCollection) gatewayResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !grc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(grc.NextLink))) +} + +// GatewayResourceCollectionPage contains a page of GatewayResource values. +type GatewayResourceCollectionPage struct { + fn func(context.Context, GatewayResourceCollection) (GatewayResourceCollection, error) + grc GatewayResourceCollection +} + +// 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 *GatewayResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayResourceCollectionPage.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.grc) + if err != nil { + return err + } + page.grc = 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 *GatewayResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page GatewayResourceCollectionPage) NotDone() bool { + return !page.grc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page GatewayResourceCollectionPage) Response() GatewayResourceCollection { + return page.grc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page GatewayResourceCollectionPage) Values() []GatewayResource { + if page.grc.IsEmpty() { + return nil + } + return *page.grc.Value +} + +// Creates a new instance of the GatewayResourceCollectionPage type. +func NewGatewayResourceCollectionPage(cur GatewayResourceCollection, getNextPage func(context.Context, GatewayResourceCollection) (GatewayResourceCollection, error)) GatewayResourceCollectionPage { + return GatewayResourceCollectionPage{ + fn: getNextPage, + grc: cur, + } +} + +// GatewayResourceRequests resource request payload of Spring Cloud Gateway. +type GatewayResourceRequests struct { + // CPU - Cpu allocated to each Spring Cloud Gateway instance. + CPU *string `json:"cpu,omitempty"` + // Memory - Memory allocated to each Spring Cloud Gateway instance. + Memory *string `json:"memory,omitempty"` +} + +// GatewayRouteConfigOpenAPIProperties openAPI properties of Spring Cloud Gateway route config. +type GatewayRouteConfigOpenAPIProperties struct { + // URI - The URI of OpenAPI specification. + URI *string `json:"uri,omitempty"` +} + +// GatewayRouteConfigProperties API route config of the Spring Cloud Gateway +type GatewayRouteConfigProperties struct { + // ProvisioningState - READ-ONLY; State of the Spring Cloud Gateway route config. Possible values include: 'GatewayProvisioningStateCreating', 'GatewayProvisioningStateUpdating', 'GatewayProvisioningStateSucceeded', 'GatewayProvisioningStateFailed', 'GatewayProvisioningStateDeleting' + ProvisioningState GatewayProvisioningState `json:"provisioningState,omitempty"` + // AppResourceID - The resource Id of the Azure Spring Apps app, required unless route defines `uri`. + AppResourceID *string `json:"appResourceId,omitempty"` + OpenAPI *GatewayRouteConfigOpenAPIProperties `json:"openApi,omitempty"` + // Routes - Array of API routes, each route contains properties such as `title`, `uri`, `ssoEnabled`, `predicates`, `filters`. + Routes *[]GatewayAPIRoute `json:"routes,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayRouteConfigProperties. +func (grcp GatewayRouteConfigProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if grcp.AppResourceID != nil { + objectMap["appResourceId"] = grcp.AppResourceID + } + if grcp.OpenAPI != nil { + objectMap["openApi"] = grcp.OpenAPI + } + if grcp.Routes != nil { + objectMap["routes"] = grcp.Routes + } + return json.Marshal(objectMap) +} + +// GatewayRouteConfigResource spring Cloud Gateway route config resource +type GatewayRouteConfigResource struct { + autorest.Response `json:"-"` + Properties *GatewayRouteConfigProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayRouteConfigResource. +func (grcr GatewayRouteConfigResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if grcr.Properties != nil { + objectMap["properties"] = grcr.Properties + } + if grcr.SystemData != nil { + objectMap["systemData"] = grcr.SystemData + } + return json.Marshal(objectMap) +} + +// GatewayRouteConfigResourceCollection object that includes an array of Spring Cloud Gateway route config +// resources and a possible link for next set +type GatewayRouteConfigResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Spring Cloud Gateway route config resources + Value *[]GatewayRouteConfigResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// GatewayRouteConfigResourceCollectionIterator provides access to a complete listing of +// GatewayRouteConfigResource values. +type GatewayRouteConfigResourceCollectionIterator struct { + i int + page GatewayRouteConfigResourceCollectionPage +} + +// 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 *GatewayRouteConfigResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayRouteConfigResourceCollectionIterator.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 *GatewayRouteConfigResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter GatewayRouteConfigResourceCollectionIterator) 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 GatewayRouteConfigResourceCollectionIterator) Response() GatewayRouteConfigResourceCollection { + 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 GatewayRouteConfigResourceCollectionIterator) Value() GatewayRouteConfigResource { + if !iter.page.NotDone() { + return GatewayRouteConfigResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the GatewayRouteConfigResourceCollectionIterator type. +func NewGatewayRouteConfigResourceCollectionIterator(page GatewayRouteConfigResourceCollectionPage) GatewayRouteConfigResourceCollectionIterator { + return GatewayRouteConfigResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (grcrc GatewayRouteConfigResourceCollection) IsEmpty() bool { + return grcrc.Value == nil || len(*grcrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (grcrc GatewayRouteConfigResourceCollection) hasNextLink() bool { + return grcrc.NextLink != nil && len(*grcrc.NextLink) != 0 +} + +// gatewayRouteConfigResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (grcrc GatewayRouteConfigResourceCollection) gatewayRouteConfigResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !grcrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(grcrc.NextLink))) +} + +// GatewayRouteConfigResourceCollectionPage contains a page of GatewayRouteConfigResource values. +type GatewayRouteConfigResourceCollectionPage struct { + fn func(context.Context, GatewayRouteConfigResourceCollection) (GatewayRouteConfigResourceCollection, error) + grcrc GatewayRouteConfigResourceCollection +} + +// 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 *GatewayRouteConfigResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/GatewayRouteConfigResourceCollectionPage.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.grcrc) + if err != nil { + return err + } + page.grcrc = 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 *GatewayRouteConfigResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page GatewayRouteConfigResourceCollectionPage) NotDone() bool { + return !page.grcrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page GatewayRouteConfigResourceCollectionPage) Response() GatewayRouteConfigResourceCollection { + return page.grcrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page GatewayRouteConfigResourceCollectionPage) Values() []GatewayRouteConfigResource { + if page.grcrc.IsEmpty() { + return nil + } + return *page.grcrc.Value +} + +// Creates a new instance of the GatewayRouteConfigResourceCollectionPage type. +func NewGatewayRouteConfigResourceCollectionPage(cur GatewayRouteConfigResourceCollection, getNextPage func(context.Context, GatewayRouteConfigResourceCollection) (GatewayRouteConfigResourceCollection, error)) GatewayRouteConfigResourceCollectionPage { + return GatewayRouteConfigResourceCollectionPage{ + fn: getNextPage, + grcrc: cur, + } +} + +// GatewayRouteConfigsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GatewayRouteConfigsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GatewayRouteConfigsClient) (GatewayRouteConfigResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GatewayRouteConfigsCreateOrUpdateFuture) 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 GatewayRouteConfigsCreateOrUpdateFuture.Result. +func (future *GatewayRouteConfigsCreateOrUpdateFuture) result(client GatewayRouteConfigsClient) (grcr GatewayRouteConfigResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + grcr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.GatewayRouteConfigsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if grcr.Response.Response, err = future.GetResult(sender); err == nil && grcr.Response.Response.StatusCode != http.StatusNoContent { + grcr, err = client.CreateOrUpdateResponder(grcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsCreateOrUpdateFuture", "Result", grcr.Response.Response, "Failure responding to request") + } + } + return +} + +// GatewayRouteConfigsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type GatewayRouteConfigsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GatewayRouteConfigsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GatewayRouteConfigsDeleteFuture) 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 GatewayRouteConfigsDeleteFuture.Result. +func (future *GatewayRouteConfigsDeleteFuture) result(client GatewayRouteConfigsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewayRouteConfigsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.GatewayRouteConfigsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// GatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GatewaysClient) (GatewayResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GatewaysCreateOrUpdateFuture) 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 GatewaysCreateOrUpdateFuture.Result. +func (future *GatewaysCreateOrUpdateFuture) result(client GatewaysClient) (gr GatewayResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + gr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.GatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if gr.Response.Response, err = future.GetResult(sender); err == nil && gr.Response.Response.StatusCode != http.StatusNoContent { + gr, err = client.CreateOrUpdateResponder(gr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysCreateOrUpdateFuture", "Result", gr.Response.Response, "Failure responding to request") + } + } + return +} + +// GatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(GatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GatewaysDeleteFuture) 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 GatewaysDeleteFuture.Result. +func (future *GatewaysDeleteFuture) result(client GatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.GatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.GatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// GitPatternRepository git repository property payload for config server +type GitPatternRepository struct { + // Name - Name of the repository + Name *string `json:"name,omitempty"` + // Pattern - Collection of pattern of the repository + Pattern *[]string `json:"pattern,omitempty"` + // URI - URI of the repository + URI *string `json:"uri,omitempty"` + // Label - Label of the repository + Label *string `json:"label,omitempty"` + // SearchPaths - Searching path of the repository + SearchPaths *[]string `json:"searchPaths,omitempty"` + // Username - Username of git repository basic auth. + Username *string `json:"username,omitempty"` + // Password - Password of git repository basic auth. + Password *string `json:"password,omitempty"` + // HostKey - Public sshKey of git repository. + HostKey *string `json:"hostKey,omitempty"` + // HostKeyAlgorithm - SshKey algorithm of git repository. + HostKeyAlgorithm *string `json:"hostKeyAlgorithm,omitempty"` + // PrivateKey - Private sshKey algorithm of git repository. + PrivateKey *string `json:"privateKey,omitempty"` + // StrictHostKeyChecking - Strict host key checking or not. + StrictHostKeyChecking *bool `json:"strictHostKeyChecking,omitempty"` +} + +// HTTPGetAction hTTPGetAction describes an action based on HTTP Get requests. +type HTTPGetAction struct { + // Path - Path to access on the HTTP server. + Path *string `json:"path,omitempty"` + // Scheme - Scheme to use for connecting to the host. Defaults to HTTP. + // Possible enum values: + // - `"HTTP"` means that the scheme used will be http:// + // - `"HTTPS"` means that the scheme used will be https://. Possible values include: 'HTTP', 'HTTPS' + Scheme HTTPSchemeType `json:"scheme,omitempty"` + // Type - Possible values include: 'TypeProbeAction', 'TypeHTTPGetAction', 'TypeExecAction', 'TypeTCPSocketAction' + Type TypeBasicProbeAction `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for HTTPGetAction. +func (hga HTTPGetAction) MarshalJSON() ([]byte, error) { + hga.Type = TypeHTTPGetAction + objectMap := make(map[string]interface{}) + if hga.Path != nil { + objectMap["path"] = hga.Path + } + if hga.Scheme != "" { + objectMap["scheme"] = hga.Scheme + } + if hga.Type != "" { + objectMap["type"] = hga.Type + } + return json.Marshal(objectMap) +} + +// AsHTTPGetAction is the BasicProbeAction implementation for HTTPGetAction. +func (hga HTTPGetAction) AsHTTPGetAction() (*HTTPGetAction, bool) { + return &hga, true +} + +// AsExecAction is the BasicProbeAction implementation for HTTPGetAction. +func (hga HTTPGetAction) AsExecAction() (*ExecAction, bool) { + return nil, false +} + +// AsTCPSocketAction is the BasicProbeAction implementation for HTTPGetAction. +func (hga HTTPGetAction) AsTCPSocketAction() (*TCPSocketAction, bool) { + return nil, false +} + +// AsProbeAction is the BasicProbeAction implementation for HTTPGetAction. +func (hga HTTPGetAction) AsProbeAction() (*ProbeAction, bool) { + return nil, false +} + +// AsBasicProbeAction is the BasicProbeAction implementation for HTTPGetAction. +func (hga HTTPGetAction) AsBasicProbeAction() (BasicProbeAction, bool) { + return &hga, true +} + +// ImageRegistryCredential credential of the image registry +type ImageRegistryCredential struct { + // Username - The username of the image registry credential + Username *string `json:"username,omitempty"` + // Password - The password of the image registry credential + Password *string `json:"password,omitempty"` +} + +// IngressConfig ingress configuration payload for Azure Spring Apps resource. +type IngressConfig struct { + // ReadTimeoutInSeconds - Ingress read time out in seconds. + ReadTimeoutInSeconds *int32 `json:"readTimeoutInSeconds,omitempty"` +} + +// JarUploadedUserSourceInfo uploaded Jar binary for a deployment +type JarUploadedUserSourceInfo struct { + // RuntimeVersion - Runtime version of the Jar file + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // JvmOptions - JVM parameter + JvmOptions *string `json:"jvmOptions,omitempty"` + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult', 'TypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + juusi.Type = TypeJar + objectMap := make(map[string]interface{}) + if juusi.RuntimeVersion != nil { + objectMap["runtimeVersion"] = juusi.RuntimeVersion + } + if juusi.JvmOptions != nil { + objectMap["jvmOptions"] = juusi.JvmOptions + } + if juusi.RelativePath != nil { + objectMap["relativePath"] = juusi.RelativePath + } + if juusi.Version != nil { + objectMap["version"] = juusi.Version + } + if juusi.Type != "" { + objectMap["type"] = juusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return &juusi, true +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return &juusi, true +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for JarUploadedUserSourceInfo. +func (juusi JarUploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &juusi, true +} + +// KeyVaultCertificateProperties properties of certificate imported from key vault. +type KeyVaultCertificateProperties struct { + // VaultURI - The vault uri of user key vault. + VaultURI *string `json:"vaultUri,omitempty"` + // KeyVaultCertName - The certificate name of key vault. + KeyVaultCertName *string `json:"keyVaultCertName,omitempty"` + // CertVersion - The certificate version of key vault. + CertVersion *string `json:"certVersion,omitempty"` + // ExcludePrivateKey - Optional. If set to true, it will not import private key from key vault. + ExcludePrivateKey *bool `json:"excludePrivateKey,omitempty"` + // Thumbprint - READ-ONLY; The thumbprint of certificate. + Thumbprint *string `json:"thumbprint,omitempty"` + // Issuer - READ-ONLY; The issuer of certificate. + Issuer *string `json:"issuer,omitempty"` + // IssuedDate - READ-ONLY; The issue date of certificate. + IssuedDate *string `json:"issuedDate,omitempty"` + // ExpirationDate - READ-ONLY; The expiration date of certificate. + ExpirationDate *string `json:"expirationDate,omitempty"` + // ActivateDate - READ-ONLY; The activate date of certificate. + ActivateDate *string `json:"activateDate,omitempty"` + // SubjectName - READ-ONLY; The subject name of certificate. + SubjectName *string `json:"subjectName,omitempty"` + // DNSNames - READ-ONLY; The domain list of certificate. + DNSNames *[]string `json:"dnsNames,omitempty"` + // ProvisioningState - READ-ONLY; Provisioning state of the Certificate. Possible values include: 'CertificateResourceProvisioningStateCreating', 'CertificateResourceProvisioningStateUpdating', 'CertificateResourceProvisioningStateSucceeded', 'CertificateResourceProvisioningStateFailed', 'CertificateResourceProvisioningStateDeleting' + ProvisioningState CertificateResourceProvisioningState `json:"provisioningState,omitempty"` + // Type - Possible values include: 'TypeCertificateProperties', 'TypeKeyVaultCertificate', 'TypeContentCertificate' + Type TypeBasicCertificateProperties `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) MarshalJSON() ([]byte, error) { + kvcp.Type = TypeKeyVaultCertificate + objectMap := make(map[string]interface{}) + if kvcp.VaultURI != nil { + objectMap["vaultUri"] = kvcp.VaultURI + } + if kvcp.KeyVaultCertName != nil { + objectMap["keyVaultCertName"] = kvcp.KeyVaultCertName + } + if kvcp.CertVersion != nil { + objectMap["certVersion"] = kvcp.CertVersion + } + if kvcp.ExcludePrivateKey != nil { + objectMap["excludePrivateKey"] = kvcp.ExcludePrivateKey + } + if kvcp.Type != "" { + objectMap["type"] = kvcp.Type + } + return json.Marshal(objectMap) +} + +// AsKeyVaultCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) AsKeyVaultCertificateProperties() (*KeyVaultCertificateProperties, bool) { + return &kvcp, true +} + +// AsContentCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) AsContentCertificateProperties() (*ContentCertificateProperties, bool) { + return nil, false +} + +// AsCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) AsCertificateProperties() (*CertificateProperties, bool) { + return nil, false +} + +// AsBasicCertificateProperties is the BasicCertificateProperties implementation for KeyVaultCertificateProperties. +func (kvcp KeyVaultCertificateProperties) AsBasicCertificateProperties() (BasicCertificateProperties, bool) { + return &kvcp, true +} + +// LoadedCertificate loaded certificate payload +type LoadedCertificate struct { + // ResourceID - Resource Id of loaded certificate + ResourceID *string `json:"resourceId,omitempty"` + // LoadTrustStore - Indicate whether the certificate will be loaded into default trust store, only work for Java runtime. + LoadTrustStore *bool `json:"loadTrustStore,omitempty"` +} + +// LogFileURLResponse log file URL payload +type LogFileURLResponse struct { + autorest.Response `json:"-"` + // URL - URL of the log file + URL *string `json:"url,omitempty"` +} + +// LogSpecification specifications of the Log for Azure Monitoring +type LogSpecification struct { + // Name - Name of the log + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the log + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Blob duration of the log + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// ManagedIdentityProperties managed identity properties retrieved from ARM request headers. +type ManagedIdentityProperties struct { + // Type - Type of the managed identity. Possible values include: 'None', 'SystemAssigned', 'UserAssigned', 'SystemAssignedUserAssigned' + Type ManagedIdentityType `json:"type,omitempty"` + // PrincipalID - Principal Id of system-assigned managed identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - Tenant Id of system-assigned managed identity. + TenantID *string `json:"tenantId,omitempty"` + // UserAssignedIdentities - Properties of user-assigned managed identities + UserAssignedIdentities map[string]*UserAssignedManagedIdentity `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ManagedIdentityProperties. +func (mip ManagedIdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mip.Type != "" { + objectMap["type"] = mip.Type + } + if mip.PrincipalID != nil { + objectMap["principalId"] = mip.PrincipalID + } + if mip.TenantID != nil { + objectMap["tenantId"] = mip.TenantID + } + if mip.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = mip.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// MarketplaceResource purchasing 3rd Party product for one Azure Spring Apps instance +type MarketplaceResource struct { + // Plan - The plan id of the 3rd Party Artifact that is being procured. + Plan *string `json:"plan,omitempty"` + // Publisher - The publisher id of the 3rd Party Artifact that is being bought. + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. + Product *string `json:"product,omitempty"` +} + +// MetricDimension specifications of the Dimension of metrics +type MetricDimension struct { + // Name - Name of the dimension + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the dimension + DisplayName *string `json:"displayName,omitempty"` + // ToBeExportedForShoebox - Whether this dimension should be included for the Shoebox export scenario + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` +} + +// MetricSpecification specifications of the Metrics for Azure Monitoring +type MetricSpecification struct { + // Name - Name of the metric + Name *string `json:"name,omitempty"` + // DisplayName - Localized friendly display name of the metric + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Localized friendly description of the metric + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - Unit that makes sense for the metric + Unit *string `json:"unit,omitempty"` + // Category - Name of the metric category that the metric belongs to. A metric can only belong to a single category. + Category *string `json:"category,omitempty"` + // AggregationType - Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. + AggregationType *string `json:"aggregationType,omitempty"` + // SupportedAggregationTypes - Supported aggregation types + SupportedAggregationTypes *[]string `json:"supportedAggregationTypes,omitempty"` + // SupportedTimeGrainTypes - Supported time grain types + SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` + // FillGapWithZero - Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // Dimensions - Dimensions of the metric + Dimensions *[]MetricDimension `json:"dimensions,omitempty"` + // SourceMdmNamespace - Name of the MDM namespace. Optional. + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` +} + +// MonitoringSettingProperties monitoring Setting properties payload +type MonitoringSettingProperties struct { + // ProvisioningState - READ-ONLY; State of the Monitoring Setting. Possible values include: 'MonitoringSettingStateNotAvailable', 'MonitoringSettingStateFailed', 'MonitoringSettingStateSucceeded', 'MonitoringSettingStateUpdating' + ProvisioningState MonitoringSettingState `json:"provisioningState,omitempty"` + // Error - Error when apply Monitoring Setting changes. + Error *Error `json:"error,omitempty"` + // TraceEnabled - Indicates whether enable the trace functionality, which will be deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate if monitoringSettings enabled or not + TraceEnabled *bool `json:"traceEnabled,omitempty"` + // AppInsightsInstrumentationKey - Target application insight instrumentation key, null or whitespace include empty will disable monitoringSettings + AppInsightsInstrumentationKey *string `json:"appInsightsInstrumentationKey,omitempty"` + // AppInsightsSamplingRate - Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0] + AppInsightsSamplingRate *float64 `json:"appInsightsSamplingRate,omitempty"` + // AppInsightsAgentVersions - Indicates the versions of application insight agent + AppInsightsAgentVersions *ApplicationInsightsAgentVersions `json:"appInsightsAgentVersions,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitoringSettingProperties. +func (msp MonitoringSettingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msp.Error != nil { + objectMap["error"] = msp.Error + } + if msp.TraceEnabled != nil { + objectMap["traceEnabled"] = msp.TraceEnabled + } + if msp.AppInsightsInstrumentationKey != nil { + objectMap["appInsightsInstrumentationKey"] = msp.AppInsightsInstrumentationKey + } + if msp.AppInsightsSamplingRate != nil { + objectMap["appInsightsSamplingRate"] = msp.AppInsightsSamplingRate + } + if msp.AppInsightsAgentVersions != nil { + objectMap["appInsightsAgentVersions"] = msp.AppInsightsAgentVersions + } + return json.Marshal(objectMap) +} + +// MonitoringSettingResource monitoring Setting resource +type MonitoringSettingResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Monitoring Setting resource + Properties *MonitoringSettingProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitoringSettingResource. +func (msr MonitoringSettingResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msr.Properties != nil { + objectMap["properties"] = msr.Properties + } + if msr.SystemData != nil { + objectMap["systemData"] = msr.SystemData + } + return json.Marshal(objectMap) +} + +// MonitoringSettingsUpdatePatchFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type MonitoringSettingsUpdatePatchFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitoringSettingsClient) (MonitoringSettingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitoringSettingsUpdatePatchFuture) 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 MonitoringSettingsUpdatePatchFuture.Result. +func (future *MonitoringSettingsUpdatePatchFuture) result(client MonitoringSettingsClient) (msr MonitoringSettingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePatchFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + msr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.MonitoringSettingsUpdatePatchFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if msr.Response.Response, err = future.GetResult(sender); err == nil && msr.Response.Response.StatusCode != http.StatusNoContent { + msr, err = client.UpdatePatchResponder(msr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePatchFuture", "Result", msr.Response.Response, "Failure responding to request") + } + } + return +} + +// MonitoringSettingsUpdatePutFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type MonitoringSettingsUpdatePutFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitoringSettingsClient) (MonitoringSettingResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitoringSettingsUpdatePutFuture) 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 MonitoringSettingsUpdatePutFuture.Result. +func (future *MonitoringSettingsUpdatePutFuture) result(client MonitoringSettingsClient) (msr MonitoringSettingResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePutFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + msr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.MonitoringSettingsUpdatePutFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if msr.Response.Response, err = future.GetResult(sender); err == nil && msr.Response.Response.StatusCode != http.StatusNoContent { + msr, err = client.UpdatePutResponder(msr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsUpdatePutFuture", "Result", msr.Response.Response, "Failure responding to request") + } + } + return +} + +// NameAvailability name availability result payload +type NameAvailability struct { + autorest.Response `json:"-"` + // NameAvailable - Indicates whether the name is available + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - Reason why the name is not available + Reason *string `json:"reason,omitempty"` + // Message - Message why the name is not available + Message *string `json:"message,omitempty"` +} + +// NameAvailabilityParameters name availability parameters payload +type NameAvailabilityParameters struct { + // Type - Type of the resource to check name availability + Type *string `json:"type,omitempty"` + // Name - Name to be checked + Name *string `json:"name,omitempty"` +} + +// NetCoreZipUploadedUserSourceInfo uploaded Jar binary for a deployment +type NetCoreZipUploadedUserSourceInfo struct { + // NetCoreMainEntryPath - The path to the .NET executable relative to zip root + NetCoreMainEntryPath *string `json:"netCoreMainEntryPath,omitempty"` + // RuntimeVersion - Runtime version of the .Net file + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult', 'TypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + nczuusi.Type = TypeNetCoreZip + objectMap := make(map[string]interface{}) + if nczuusi.NetCoreMainEntryPath != nil { + objectMap["netCoreMainEntryPath"] = nczuusi.NetCoreMainEntryPath + } + if nczuusi.RuntimeVersion != nil { + objectMap["runtimeVersion"] = nczuusi.RuntimeVersion + } + if nczuusi.RelativePath != nil { + objectMap["relativePath"] = nczuusi.RelativePath + } + if nczuusi.Version != nil { + objectMap["version"] = nczuusi.Version + } + if nczuusi.Type != "" { + objectMap["type"] = nczuusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return &nczuusi, true +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return &nczuusi, true +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for NetCoreZipUploadedUserSourceInfo. +func (nczuusi NetCoreZipUploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &nczuusi, true +} + +// NetworkProfile service network profile payload +type NetworkProfile struct { + // ServiceRuntimeSubnetID - Fully qualified resource Id of the subnet to host Azure Spring Apps Service Runtime + ServiceRuntimeSubnetID *string `json:"serviceRuntimeSubnetId,omitempty"` + // AppSubnetID - Fully qualified resource Id of the subnet to host customer apps in Azure Spring Apps + AppSubnetID *string `json:"appSubnetId,omitempty"` + // ServiceCidr - Azure Spring Apps service reserved CIDR + ServiceCidr *string `json:"serviceCidr,omitempty"` + // ServiceRuntimeNetworkResourceGroup - Name of the resource group containing network resources of Azure Spring Apps Service Runtime + ServiceRuntimeNetworkResourceGroup *string `json:"serviceRuntimeNetworkResourceGroup,omitempty"` + // AppNetworkResourceGroup - Name of the resource group containing network resources for customer apps in Azure Spring Apps + AppNetworkResourceGroup *string `json:"appNetworkResourceGroup,omitempty"` + // OutboundIPs - READ-ONLY; Desired outbound IP resources for Azure Spring Apps resource. + OutboundIPs *NetworkProfileOutboundIPs `json:"outboundIPs,omitempty"` + // RequiredTraffics - READ-ONLY; Required inbound or outbound traffics for Azure Spring Apps resource. + RequiredTraffics *[]RequiredTraffic `json:"requiredTraffics,omitempty"` + // IngressConfig - Ingress configuration payload for Azure Spring Apps resource. + IngressConfig *IngressConfig `json:"ingressConfig,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkProfile. +func (np NetworkProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if np.ServiceRuntimeSubnetID != nil { + objectMap["serviceRuntimeSubnetId"] = np.ServiceRuntimeSubnetID + } + if np.AppSubnetID != nil { + objectMap["appSubnetId"] = np.AppSubnetID + } + if np.ServiceCidr != nil { + objectMap["serviceCidr"] = np.ServiceCidr + } + if np.ServiceRuntimeNetworkResourceGroup != nil { + objectMap["serviceRuntimeNetworkResourceGroup"] = np.ServiceRuntimeNetworkResourceGroup + } + if np.AppNetworkResourceGroup != nil { + objectMap["appNetworkResourceGroup"] = np.AppNetworkResourceGroup + } + if np.IngressConfig != nil { + objectMap["ingressConfig"] = np.IngressConfig + } + return json.Marshal(objectMap) +} + +// NetworkProfileOutboundIPs desired outbound IP resources for Azure Spring Apps resource. +type NetworkProfileOutboundIPs struct { + // PublicIPs - READ-ONLY; A list of public IP addresses. + PublicIPs *[]string `json:"publicIPs,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkProfileOutboundIPs. +func (npP NetworkProfileOutboundIPs) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationDetail operation detail payload +type OperationDetail struct { + // Name - Name of the operation + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - Display of the operation + Display *OperationDisplay `json:"display,omitempty"` + // ActionType - READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: 'Internal' + ActionType ActionType `json:"actionType,omitempty"` + // Origin - Origin of the operation + Origin *string `json:"origin,omitempty"` + // Properties - Properties of the operation + Properties *OperationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDetail. +func (od OperationDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if od.Name != nil { + objectMap["name"] = od.Name + } + if od.IsDataAction != nil { + objectMap["isDataAction"] = od.IsDataAction + } + if od.Display != nil { + objectMap["display"] = od.Display + } + if od.Origin != nil { + objectMap["origin"] = od.Origin + } + if od.Properties != nil { + objectMap["properties"] = od.Properties + } + return json.Marshal(objectMap) +} + +// OperationDisplay operation display payload +type OperationDisplay struct { + // Provider - Resource provider of the operation + Provider *string `json:"provider,omitempty"` + // Resource - Resource of the operation + Resource *string `json:"resource,omitempty"` + // Operation - Localized friendly name for the operation + Operation *string `json:"operation,omitempty"` + // Description - Localized friendly description for the operation + Description *string `json:"description,omitempty"` +} + +// OperationProperties extra Operation properties +type OperationProperties struct { + // ServiceSpecification - Service specifications of the operation + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// PersistentDisk persistent disk payload +type PersistentDisk struct { + // SizeInGB - Size of the persistent disk in GB + SizeInGB *int32 `json:"sizeInGB,omitempty"` + // UsedInGB - READ-ONLY; Size of the used persistent disk in GB + UsedInGB *int32 `json:"usedInGB,omitempty"` + // MountPath - Mount path of the persistent disk + MountPath *string `json:"mountPath,omitempty"` +} + +// MarshalJSON is the custom marshaler for PersistentDisk. +func (pd PersistentDisk) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pd.SizeInGB != nil { + objectMap["sizeInGB"] = pd.SizeInGB + } + if pd.MountPath != nil { + objectMap["mountPath"] = pd.MountPath + } + return json.Marshal(objectMap) +} + +// Probe probe describes a health check to be performed against an App Instance to determine whether it is +// alive or ready to receive traffic. +type Probe struct { + // ProbeAction - The action of the probe. + ProbeAction BasicProbeAction `json:"probeAction,omitempty"` + // DisableProbe - Indicate whether the probe is disabled. + DisableProbe *bool `json:"disableProbe,omitempty"` + // InitialDelaySeconds - Number of seconds after the App Instance has started before probes are initiated. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"` + // PeriodSeconds - How often (in seconds) to perform the probe. Minimum value is 1. + PeriodSeconds *int32 `json:"periodSeconds,omitempty"` + // TimeoutSeconds - Number of seconds after which the probe times out. Minimum value is 1. + TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` + // FailureThreshold - Minimum consecutive failures for the probe to be considered failed after having succeeded. Minimum value is 1. + FailureThreshold *int32 `json:"failureThreshold,omitempty"` + // SuccessThreshold - Minimum consecutive successes for the probe to be considered successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. + SuccessThreshold *int32 `json:"successThreshold,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for Probe struct. +func (p *Probe) 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 "probeAction": + if v != nil { + probeAction, err := unmarshalBasicProbeAction(*v) + if err != nil { + return err + } + p.ProbeAction = probeAction + } + case "disableProbe": + if v != nil { + var disableProbe bool + err = json.Unmarshal(*v, &disableProbe) + if err != nil { + return err + } + p.DisableProbe = &disableProbe + } + case "initialDelaySeconds": + if v != nil { + var initialDelaySeconds int32 + err = json.Unmarshal(*v, &initialDelaySeconds) + if err != nil { + return err + } + p.InitialDelaySeconds = &initialDelaySeconds + } + case "periodSeconds": + if v != nil { + var periodSeconds int32 + err = json.Unmarshal(*v, &periodSeconds) + if err != nil { + return err + } + p.PeriodSeconds = &periodSeconds + } + case "timeoutSeconds": + if v != nil { + var timeoutSeconds int32 + err = json.Unmarshal(*v, &timeoutSeconds) + if err != nil { + return err + } + p.TimeoutSeconds = &timeoutSeconds + } + case "failureThreshold": + if v != nil { + var failureThreshold int32 + err = json.Unmarshal(*v, &failureThreshold) + if err != nil { + return err + } + p.FailureThreshold = &failureThreshold + } + case "successThreshold": + if v != nil { + var successThreshold int32 + err = json.Unmarshal(*v, &successThreshold) + if err != nil { + return err + } + p.SuccessThreshold = &successThreshold + } + } + } + + return nil +} + +// BasicProbeAction the action of the probe. +type BasicProbeAction interface { + AsHTTPGetAction() (*HTTPGetAction, bool) + AsExecAction() (*ExecAction, bool) + AsTCPSocketAction() (*TCPSocketAction, bool) + AsProbeAction() (*ProbeAction, bool) +} + +// ProbeAction the action of the probe. +type ProbeAction struct { + // Type - Possible values include: 'TypeProbeAction', 'TypeHTTPGetAction', 'TypeExecAction', 'TypeTCPSocketAction' + Type TypeBasicProbeAction `json:"type,omitempty"` +} + +func unmarshalBasicProbeAction(body []byte) (BasicProbeAction, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeHTTPGetAction): + var hga HTTPGetAction + err := json.Unmarshal(body, &hga) + return hga, err + case string(TypeExecAction): + var ea ExecAction + err := json.Unmarshal(body, &ea) + return ea, err + case string(TypeTCPSocketAction): + var tsa TCPSocketAction + err := json.Unmarshal(body, &tsa) + return tsa, err + default: + var pa ProbeAction + err := json.Unmarshal(body, &pa) + return pa, err + } +} +func unmarshalBasicProbeActionArray(body []byte) ([]BasicProbeAction, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + paArray := make([]BasicProbeAction, len(rawMessages)) + + for index, rawMessage := range rawMessages { + pa, err := unmarshalBasicProbeAction(*rawMessage) + if err != nil { + return nil, err + } + paArray[index] = pa + } + return paArray, nil +} + +// MarshalJSON is the custom marshaler for ProbeAction. +func (pa ProbeAction) MarshalJSON() ([]byte, error) { + pa.Type = TypeProbeAction + objectMap := make(map[string]interface{}) + if pa.Type != "" { + objectMap["type"] = pa.Type + } + return json.Marshal(objectMap) +} + +// AsHTTPGetAction is the BasicProbeAction implementation for ProbeAction. +func (pa ProbeAction) AsHTTPGetAction() (*HTTPGetAction, bool) { + return nil, false +} + +// AsExecAction is the BasicProbeAction implementation for ProbeAction. +func (pa ProbeAction) AsExecAction() (*ExecAction, bool) { + return nil, false +} + +// AsTCPSocketAction is the BasicProbeAction implementation for ProbeAction. +func (pa ProbeAction) AsTCPSocketAction() (*TCPSocketAction, bool) { + return nil, false +} + +// AsProbeAction is the BasicProbeAction implementation for ProbeAction. +func (pa ProbeAction) AsProbeAction() (*ProbeAction, bool) { + return &pa, true +} + +// AsBasicProbeAction is the BasicProbeAction implementation for ProbeAction. +func (pa ProbeAction) AsBasicProbeAction() (BasicProbeAction, bool) { + return &pa, true +} + +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags. +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pr.SystemData != nil { + objectMap["systemData"] = pr.SystemData + } + return json.Marshal(objectMap) +} + +// RegenerateTestKeyRequestPayload regenerate test key request payload +type RegenerateTestKeyRequestPayload struct { + // KeyType - Type of the test key. Possible values include: 'Primary', 'Secondary' + KeyType TestKeyType `json:"keyType,omitempty"` +} + +// RequiredTraffic required inbound or outbound traffic for Azure Spring Apps resource. +type RequiredTraffic struct { + // Protocol - READ-ONLY; The protocol of required traffic + Protocol *string `json:"protocol,omitempty"` + // Port - READ-ONLY; The port of required traffic + Port *int32 `json:"port,omitempty"` + // Ips - READ-ONLY; The ip list of required traffic + Ips *[]string `json:"ips,omitempty"` + // Fqdns - READ-ONLY; The FQDN list of required traffic + Fqdns *[]string `json:"fqdns,omitempty"` + // Direction - READ-ONLY; The direction of required traffic. Possible values include: 'Inbound', 'Outbound' + Direction TrafficDirection `json:"direction,omitempty"` +} + +// MarshalJSON is the custom marshaler for RequiredTraffic. +func (rt RequiredTraffic) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource the core properties of ARM resources. +type Resource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.SystemData != nil { + objectMap["systemData"] = r.SystemData + } + return json.Marshal(objectMap) +} + +// ResourceRequests deployment resource request payload +type ResourceRequests struct { + // CPU - Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. + CPU *string `json:"cpu,omitempty"` + // Memory - Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + Memory *string `json:"memory,omitempty"` +} + +// ResourceSku describes an available Azure Spring Apps SKU. +type ResourceSku struct { + // ResourceType - Gets the type of resource the SKU applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Name - Gets the name of SKU. + Name *string `json:"name,omitempty"` + // Tier - Gets the tier of SKU. + Tier *string `json:"tier,omitempty"` + // Capacity - Gets the capacity of SKU. + Capacity *SkuCapacity `json:"capacity,omitempty"` + // Locations - Gets the set of locations that the SKU is available. + Locations *[]string `json:"locations,omitempty"` + // LocationInfo - Gets a list of locations and availability zones in those locations where the SKU is available. + LocationInfo *[]ResourceSkuLocationInfo `json:"locationInfo,omitempty"` + // Restrictions - Gets the restrictions because of which SKU cannot be used. This is + // empty if there are no restrictions. + Restrictions *[]ResourceSkuRestrictions `json:"restrictions,omitempty"` +} + +// ResourceSkuCapabilities ... +type ResourceSkuCapabilities struct { + // Name - Gets an invariant to describe the feature. + Name *string `json:"name,omitempty"` + // Value - Gets an invariant if the feature is measured by quantity. + Value *string `json:"value,omitempty"` +} + +// ResourceSkuCollection object that includes an array of Azure Spring Apps SKU and a possible link for +// next set +type ResourceSkuCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resource SKU + Value *[]ResourceSku `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceSkuCollectionIterator provides access to a complete listing of ResourceSku values. +type ResourceSkuCollectionIterator struct { + i int + page ResourceSkuCollectionPage +} + +// 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 *ResourceSkuCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuCollectionIterator.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 *ResourceSkuCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceSkuCollectionIterator) 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 ResourceSkuCollectionIterator) Response() ResourceSkuCollection { + 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 ResourceSkuCollectionIterator) Value() ResourceSku { + if !iter.page.NotDone() { + return ResourceSku{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceSkuCollectionIterator type. +func NewResourceSkuCollectionIterator(page ResourceSkuCollectionPage) ResourceSkuCollectionIterator { + return ResourceSkuCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rsc ResourceSkuCollection) IsEmpty() bool { + return rsc.Value == nil || len(*rsc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rsc ResourceSkuCollection) hasNextLink() bool { + return rsc.NextLink != nil && len(*rsc.NextLink) != 0 +} + +// resourceSkuCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rsc ResourceSkuCollection) resourceSkuCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !rsc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rsc.NextLink))) +} + +// ResourceSkuCollectionPage contains a page of ResourceSku values. +type ResourceSkuCollectionPage struct { + fn func(context.Context, ResourceSkuCollection) (ResourceSkuCollection, error) + rsc ResourceSkuCollection +} + +// 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 *ResourceSkuCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceSkuCollectionPage.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.rsc) + if err != nil { + return err + } + page.rsc = 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 *ResourceSkuCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceSkuCollectionPage) NotDone() bool { + return !page.rsc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceSkuCollectionPage) Response() ResourceSkuCollection { + return page.rsc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceSkuCollectionPage) Values() []ResourceSku { + if page.rsc.IsEmpty() { + return nil + } + return *page.rsc.Value +} + +// Creates a new instance of the ResourceSkuCollectionPage type. +func NewResourceSkuCollectionPage(cur ResourceSkuCollection, getNextPage func(context.Context, ResourceSkuCollection) (ResourceSkuCollection, error)) ResourceSkuCollectionPage { + return ResourceSkuCollectionPage{ + fn: getNextPage, + rsc: cur, + } +} + +// ResourceSkuLocationInfo locations and availability zones where the SKU is available +type ResourceSkuLocationInfo struct { + // Location - Gets location of the SKU + Location *string `json:"location,omitempty"` + // Zones - Gets list of availability zones where the SKU is supported. + Zones *[]string `json:"zones,omitempty"` + // ZoneDetails - Gets details of capabilities available to a SKU in specific zones. + ZoneDetails *[]ResourceSkuZoneDetails `json:"zoneDetails,omitempty"` +} + +// ResourceSkuRestrictionInfo information about the restriction where the SKU cannot be used +type ResourceSkuRestrictionInfo struct { + // Locations - Gets locations where the SKU is restricted + Locations *[]string `json:"locations,omitempty"` + // Zones - Gets list of availability zones where the SKU is restricted. + Zones *[]string `json:"zones,omitempty"` +} + +// ResourceSkuRestrictions restrictions where the SKU cannot be used +type ResourceSkuRestrictions struct { + // Type - Gets the type of restrictions. Possible values include: 'Location', 'Zone' + Type ResourceSkuRestrictionsType `json:"type,omitempty"` + // Values - Gets the value of restrictions. If the restriction type is set to + // location. This would be different locations where the SKU is restricted. + Values *[]string `json:"values,omitempty"` + // RestrictionInfo - Gets the information about the restriction where the SKU cannot be used. + RestrictionInfo *ResourceSkuRestrictionInfo `json:"restrictionInfo,omitempty"` + // ReasonCode - Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: 'QuotaID', 'NotAvailableForSubscription' + ReasonCode ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"` +} + +// ResourceSkuZoneDetails details of capabilities available to a SKU in specific zones +type ResourceSkuZoneDetails struct { + // Name - Gets the set of zones that the SKU is available in with the + // specified capabilities. + Name *[]string `json:"name,omitempty"` + // Capabilities - Gets a list of capabilities that are available for the SKU in the + // specified list of zones. + Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"` +} + +// ResourceUploadDefinition resource upload definition payload +type ResourceUploadDefinition struct { + autorest.Response `json:"-"` + // RelativePath - Source relative path + RelativePath *string `json:"relativePath,omitempty"` + // UploadURL - Upload URL + UploadURL *string `json:"uploadUrl,omitempty"` +} + +// ServiceRegistriesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ServiceRegistriesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceRegistriesClient) (ServiceRegistryResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceRegistriesCreateOrUpdateFuture) 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 ServiceRegistriesCreateOrUpdateFuture.Result. +func (future *ServiceRegistriesCreateOrUpdateFuture) result(client ServiceRegistriesClient) (srr ServiceRegistryResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + srr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServiceRegistriesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if srr.Response.Response, err = future.GetResult(sender); err == nil && srr.Response.Response.StatusCode != http.StatusNoContent { + srr, err = client.CreateOrUpdateResponder(srr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesCreateOrUpdateFuture", "Result", srr.Response.Response, "Failure responding to request") + } + } + return +} + +// ServiceRegistriesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServiceRegistriesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceRegistriesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceRegistriesDeleteFuture) 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 ServiceRegistriesDeleteFuture.Result. +func (future *ServiceRegistriesDeleteFuture) result(client ServiceRegistriesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServiceRegistriesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServiceRegistryInstance collection of instances belong to the Service Registry +type ServiceRegistryInstance struct { + // Name - READ-ONLY; Name of the Service Registry instance + Name *string `json:"name,omitempty"` + // Status - READ-ONLY; Status of the Service Registry instance + Status *string `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceRegistryInstance. +func (sri ServiceRegistryInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServiceRegistryProperties service Registry properties payload +type ServiceRegistryProperties struct { + // ProvisioningState - READ-ONLY; State of the Service Registry. Possible values include: 'ServiceRegistryProvisioningStateCreating', 'ServiceRegistryProvisioningStateUpdating', 'ServiceRegistryProvisioningStateSucceeded', 'ServiceRegistryProvisioningStateFailed', 'ServiceRegistryProvisioningStateDeleting' + ProvisioningState ServiceRegistryProvisioningState `json:"provisioningState,omitempty"` + // ResourceRequests - The requested resource quantity for required CPU and Memory. + ResourceRequests *ServiceRegistryResourceRequests `json:"resourceRequests,omitempty"` + // Instances - READ-ONLY; Collection of instances belong to Service Registry. + Instances *[]ServiceRegistryInstance `json:"instances,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceRegistryProperties. +func (srp ServiceRegistryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srp.ResourceRequests != nil { + objectMap["resourceRequests"] = srp.ResourceRequests + } + return json.Marshal(objectMap) +} + +// ServiceRegistryResource service Registry resource +type ServiceRegistryResource struct { + autorest.Response `json:"-"` + Properties *ServiceRegistryProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceRegistryResource. +func (srr ServiceRegistryResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srr.Properties != nil { + objectMap["properties"] = srr.Properties + } + if srr.SystemData != nil { + objectMap["systemData"] = srr.SystemData + } + return json.Marshal(objectMap) +} + +// ServiceRegistryResourceCollection object that includes an array of Service Registry resources and a +// possible link for next set +type ServiceRegistryResourceCollection struct { + autorest.Response `json:"-"` + // Value - Collection of Service Registry resources + Value *[]ServiceRegistryResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceRegistryResourceCollectionIterator provides access to a complete listing of +// ServiceRegistryResource values. +type ServiceRegistryResourceCollectionIterator struct { + i int + page ServiceRegistryResourceCollectionPage +} + +// 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 *ServiceRegistryResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistryResourceCollectionIterator.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 *ServiceRegistryResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceRegistryResourceCollectionIterator) 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 ServiceRegistryResourceCollectionIterator) Response() ServiceRegistryResourceCollection { + 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 ServiceRegistryResourceCollectionIterator) Value() ServiceRegistryResource { + if !iter.page.NotDone() { + return ServiceRegistryResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceRegistryResourceCollectionIterator type. +func NewServiceRegistryResourceCollectionIterator(page ServiceRegistryResourceCollectionPage) ServiceRegistryResourceCollectionIterator { + return ServiceRegistryResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srrc ServiceRegistryResourceCollection) IsEmpty() bool { + return srrc.Value == nil || len(*srrc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (srrc ServiceRegistryResourceCollection) hasNextLink() bool { + return srrc.NextLink != nil && len(*srrc.NextLink) != 0 +} + +// serviceRegistryResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srrc ServiceRegistryResourceCollection) serviceRegistryResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !srrc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srrc.NextLink))) +} + +// ServiceRegistryResourceCollectionPage contains a page of ServiceRegistryResource values. +type ServiceRegistryResourceCollectionPage struct { + fn func(context.Context, ServiceRegistryResourceCollection) (ServiceRegistryResourceCollection, error) + srrc ServiceRegistryResourceCollection +} + +// 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 *ServiceRegistryResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistryResourceCollectionPage.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.srrc) + if err != nil { + return err + } + page.srrc = 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 *ServiceRegistryResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceRegistryResourceCollectionPage) NotDone() bool { + return !page.srrc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceRegistryResourceCollectionPage) Response() ServiceRegistryResourceCollection { + return page.srrc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceRegistryResourceCollectionPage) Values() []ServiceRegistryResource { + if page.srrc.IsEmpty() { + return nil + } + return *page.srrc.Value +} + +// Creates a new instance of the ServiceRegistryResourceCollectionPage type. +func NewServiceRegistryResourceCollectionPage(cur ServiceRegistryResourceCollection, getNextPage func(context.Context, ServiceRegistryResourceCollection) (ServiceRegistryResourceCollection, error)) ServiceRegistryResourceCollectionPage { + return ServiceRegistryResourceCollectionPage{ + fn: getNextPage, + srrc: cur, + } +} + +// ServiceRegistryResourceRequests resource request payload of Service Registry +type ServiceRegistryResourceRequests struct { + // CPU - READ-ONLY; Cpu allocated to each Service Registry instance + CPU *string `json:"cpu,omitempty"` + // Memory - READ-ONLY; Memory allocated to each Service Registry instance + Memory *string `json:"memory,omitempty"` + // InstanceCount - READ-ONLY; Instance count of the Service Registry + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceRegistryResourceRequests. +func (srrr ServiceRegistryResourceRequests) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServiceResource service resource +type ServiceResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the Service resource + Properties *ClusterResourceProperties `json:"properties,omitempty"` + // Sku - Sku of the Service resource + Sku *Sku `json:"sku,omitempty"` + // Location - The GEO location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the service which is a list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceResource. +func (sr ServiceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Properties != nil { + objectMap["properties"] = sr.Properties + } + if sr.Sku != nil { + objectMap["sku"] = sr.Sku + } + if sr.Location != nil { + objectMap["location"] = sr.Location + } + if sr.Tags != nil { + objectMap["tags"] = sr.Tags + } + if sr.SystemData != nil { + objectMap["systemData"] = sr.SystemData + } + return json.Marshal(objectMap) +} + +// ServiceResourceList object that includes an array of Service resources and a possible link for next set +type ServiceResourceList struct { + autorest.Response `json:"-"` + // Value - Collection of Service resources + Value *[]ServiceResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceResourceListIterator provides access to a complete listing of ServiceResource values. +type ServiceResourceListIterator struct { + i int + page ServiceResourceListPage +} + +// 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 *ServiceResourceListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListIterator.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 *ServiceResourceListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceResourceListIterator) 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 ServiceResourceListIterator) Response() ServiceResourceList { + 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 ServiceResourceListIterator) Value() ServiceResource { + if !iter.page.NotDone() { + return ServiceResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceResourceListIterator type. +func NewServiceResourceListIterator(page ServiceResourceListPage) ServiceResourceListIterator { + return ServiceResourceListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srl ServiceResourceList) IsEmpty() bool { + return srl.Value == nil || len(*srl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (srl ServiceResourceList) hasNextLink() bool { + return srl.NextLink != nil && len(*srl.NextLink) != 0 +} + +// serviceResourceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srl ServiceResourceList) serviceResourceListPreparer(ctx context.Context) (*http.Request, error) { + if !srl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srl.NextLink))) +} + +// ServiceResourceListPage contains a page of ServiceResource values. +type ServiceResourceListPage struct { + fn func(context.Context, ServiceResourceList) (ServiceResourceList, error) + srl ServiceResourceList +} + +// 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 *ServiceResourceListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceResourceListPage.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.srl) + if err != nil { + return err + } + page.srl = 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 *ServiceResourceListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceResourceListPage) NotDone() bool { + return !page.srl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceResourceListPage) Response() ServiceResourceList { + return page.srl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceResourceListPage) Values() []ServiceResource { + if page.srl.IsEmpty() { + return nil + } + return *page.srl.Value +} + +// Creates a new instance of the ServiceResourceListPage type. +func NewServiceResourceListPage(cur ServiceResourceList, getNextPage func(context.Context, ServiceResourceList) (ServiceResourceList, error)) ServiceResourceListPage { + return ServiceResourceListPage{ + fn: getNextPage, + srl: cur, + } +} + +// ServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (ServiceResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesCreateOrUpdateFuture) 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 ServicesCreateOrUpdateFuture.Result. +func (future *ServicesCreateOrUpdateFuture) result(client ServicesClient) (sr ServiceResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.CreateOrUpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// ServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesDeleteFuture) 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 ServicesDeleteFuture.Result. +func (future *ServicesDeleteFuture) result(client ServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServiceSpecification service specification payload +type ServiceSpecification struct { + // LogSpecifications - Specifications of the Log for Azure Monitoring + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` + // MetricSpecifications - Specifications of the Metrics for Azure Monitoring + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` +} + +// ServicesStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesStartFuture) 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 ServicesStartFuture.Result. +func (future *ServicesStartFuture) result(client ServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ServicesStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ServicesStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesStopFuture) 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 ServicesStopFuture.Result. +func (future *ServicesStopFuture) result(client ServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesStopFuture") + return + } + ar.Response = future.Response() + return +} + +// ServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServicesClient) (ServiceResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServicesUpdateFuture) 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 ServicesUpdateFuture.Result. +func (future *ServicesUpdateFuture) result(client ServicesClient) (sr ServiceResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.ServicesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.UpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// ServiceVNetAddons additional Service settings in vnet injection instance +type ServiceVNetAddons struct { + // LogStreamPublicEndpoint - Indicates whether the log stream in vnet injection instance could be accessed from internet. + LogStreamPublicEndpoint *bool `json:"logStreamPublicEndpoint,omitempty"` +} + +// Sku sku of Azure Spring Apps +type Sku struct { + // Name - Name of the Sku + Name *string `json:"name,omitempty"` + // Tier - Tier of the Sku + Tier *string `json:"tier,omitempty"` + // Capacity - Current capacity of the target resource + Capacity *int32 `json:"capacity,omitempty"` +} + +// SkuCapacity the SKU capacity +type SkuCapacity struct { + // Minimum - Gets or sets the minimum. + Minimum *int32 `json:"minimum,omitempty"` + // Maximum - Gets or sets the maximum. + Maximum *int32 `json:"maximum,omitempty"` + // Default - Gets or sets the default. + Default *int32 `json:"default,omitempty"` + // ScaleType - Gets or sets the type of the scale. Possible values include: 'SkuScaleTypeNone', 'SkuScaleTypeManual', 'SkuScaleTypeAutomatic' + ScaleType SkuScaleType `json:"scaleType,omitempty"` +} + +// SourceUploadedUserSourceInfo uploaded Java source code binary for a deployment +type SourceUploadedUserSourceInfo struct { + // ArtifactSelector - Selector for the artifact to be used for the deployment for multi-module projects. This should be + // the relative path to the target module/project. + ArtifactSelector *string `json:"artifactSelector,omitempty"` + // RuntimeVersion - Runtime version of the source file + RuntimeVersion *string `json:"runtimeVersion,omitempty"` + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult', 'TypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + suusi.Type = TypeSource + objectMap := make(map[string]interface{}) + if suusi.ArtifactSelector != nil { + objectMap["artifactSelector"] = suusi.ArtifactSelector + } + if suusi.RuntimeVersion != nil { + objectMap["runtimeVersion"] = suusi.RuntimeVersion + } + if suusi.RelativePath != nil { + objectMap["relativePath"] = suusi.RelativePath + } + if suusi.Version != nil { + objectMap["version"] = suusi.Version + } + if suusi.Type != "" { + objectMap["type"] = suusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return &suusi, true +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return &suusi, true +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for SourceUploadedUserSourceInfo. +func (suusi SourceUploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &suusi, true +} + +// SsoProperties single sign-on related configuration +type SsoProperties struct { + // Scope - It defines the specific actions applications can be allowed to do on a user's behalf + Scope *[]string `json:"scope,omitempty"` + // ClientID - The public identifier for the application + ClientID *string `json:"clientId,omitempty"` + // ClientSecret - The secret known only to the application and the authorization server + ClientSecret *string `json:"clientSecret,omitempty"` + // IssuerURI - The URI of Issuer Identifier + IssuerURI *string `json:"issuerUri,omitempty"` +} + +// StackProperties kPack ClusterStack properties payload +type StackProperties struct { + // ID - Id of the ClusterStack. + ID *string `json:"id,omitempty"` + // Version - Version of the ClusterStack + Version *string `json:"version,omitempty"` +} + +// StorageAccount storage resource of type Azure Storage Account. +type StorageAccount struct { + // AccountName - The account name of the Azure Storage Account. + AccountName *string `json:"accountName,omitempty"` + // AccountKey - The account key of the Azure Storage Account. + AccountKey *string `json:"accountKey,omitempty"` + // StorageType - Possible values include: 'StorageTypeStorageProperties', 'StorageTypeStorageAccount' + StorageType StorageType `json:"storageType,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageAccount. +func (sa StorageAccount) MarshalJSON() ([]byte, error) { + sa.StorageType = StorageTypeStorageAccount + objectMap := make(map[string]interface{}) + if sa.AccountName != nil { + objectMap["accountName"] = sa.AccountName + } + if sa.AccountKey != nil { + objectMap["accountKey"] = sa.AccountKey + } + if sa.StorageType != "" { + objectMap["storageType"] = sa.StorageType + } + return json.Marshal(objectMap) +} + +// AsStorageAccount is the BasicStorageProperties implementation for StorageAccount. +func (sa StorageAccount) AsStorageAccount() (*StorageAccount, bool) { + return &sa, true +} + +// AsStorageProperties is the BasicStorageProperties implementation for StorageAccount. +func (sa StorageAccount) AsStorageProperties() (*StorageProperties, bool) { + return nil, false +} + +// AsBasicStorageProperties is the BasicStorageProperties implementation for StorageAccount. +func (sa StorageAccount) AsBasicStorageProperties() (BasicStorageProperties, bool) { + return &sa, true +} + +// BasicStorageProperties storage resource payload. +type BasicStorageProperties interface { + AsStorageAccount() (*StorageAccount, bool) + AsStorageProperties() (*StorageProperties, bool) +} + +// StorageProperties storage resource payload. +type StorageProperties struct { + // StorageType - Possible values include: 'StorageTypeStorageProperties', 'StorageTypeStorageAccount' + StorageType StorageType `json:"storageType,omitempty"` +} + +func unmarshalBasicStorageProperties(body []byte) (BasicStorageProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["storageType"] { + case string(StorageTypeStorageAccount): + var sa StorageAccount + err := json.Unmarshal(body, &sa) + return sa, err + default: + var sp StorageProperties + err := json.Unmarshal(body, &sp) + return sp, err + } +} +func unmarshalBasicStoragePropertiesArray(body []byte) ([]BasicStorageProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + spArray := make([]BasicStorageProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + sp, err := unmarshalBasicStorageProperties(*rawMessage) + if err != nil { + return nil, err + } + spArray[index] = sp + } + return spArray, nil +} + +// MarshalJSON is the custom marshaler for StorageProperties. +func (sp StorageProperties) MarshalJSON() ([]byte, error) { + sp.StorageType = StorageTypeStorageProperties + objectMap := make(map[string]interface{}) + if sp.StorageType != "" { + objectMap["storageType"] = sp.StorageType + } + return json.Marshal(objectMap) +} + +// AsStorageAccount is the BasicStorageProperties implementation for StorageProperties. +func (sp StorageProperties) AsStorageAccount() (*StorageAccount, bool) { + return nil, false +} + +// AsStorageProperties is the BasicStorageProperties implementation for StorageProperties. +func (sp StorageProperties) AsStorageProperties() (*StorageProperties, bool) { + return &sp, true +} + +// AsBasicStorageProperties is the BasicStorageProperties implementation for StorageProperties. +func (sp StorageProperties) AsBasicStorageProperties() (BasicStorageProperties, bool) { + return &sp, true +} + +// StorageResource storage resource payload. +type StorageResource struct { + autorest.Response `json:"-"` + // Properties - Properties of the storage resource payload. + Properties BasicStorageProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageResource. +func (sr StorageResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = sr.Properties + if sr.SystemData != nil { + objectMap["systemData"] = sr.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StorageResource struct. +func (sr *StorageResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + properties, err := unmarshalBasicStorageProperties(*v) + if err != nil { + return err + } + sr.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sr.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sr.SystemData = &systemData + } + } + } + + return nil +} + +// StorageResourceCollection collection compose of storage resources list and a possible link for next +// page. +type StorageResourceCollection struct { + autorest.Response `json:"-"` + // Value - The storage resources list. + Value *[]StorageResource `json:"value,omitempty"` + // NextLink - The link to next page of storage list. + NextLink *string `json:"nextLink,omitempty"` +} + +// StorageResourceCollectionIterator provides access to a complete listing of StorageResource values. +type StorageResourceCollectionIterator struct { + i int + page StorageResourceCollectionPage +} + +// 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 *StorageResourceCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageResourceCollectionIterator.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 *StorageResourceCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StorageResourceCollectionIterator) 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 StorageResourceCollectionIterator) Response() StorageResourceCollection { + 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 StorageResourceCollectionIterator) Value() StorageResource { + if !iter.page.NotDone() { + return StorageResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StorageResourceCollectionIterator type. +func NewStorageResourceCollectionIterator(page StorageResourceCollectionPage) StorageResourceCollectionIterator { + return StorageResourceCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (src StorageResourceCollection) IsEmpty() bool { + return src.Value == nil || len(*src.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (src StorageResourceCollection) hasNextLink() bool { + return src.NextLink != nil && len(*src.NextLink) != 0 +} + +// storageResourceCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (src StorageResourceCollection) storageResourceCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !src.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(src.NextLink))) +} + +// StorageResourceCollectionPage contains a page of StorageResource values. +type StorageResourceCollectionPage struct { + fn func(context.Context, StorageResourceCollection) (StorageResourceCollection, error) + src StorageResourceCollection +} + +// 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 *StorageResourceCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageResourceCollectionPage.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.src) + if err != nil { + return err + } + page.src = 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 *StorageResourceCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StorageResourceCollectionPage) NotDone() bool { + return !page.src.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StorageResourceCollectionPage) Response() StorageResourceCollection { + return page.src +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StorageResourceCollectionPage) Values() []StorageResource { + if page.src.IsEmpty() { + return nil + } + return *page.src.Value +} + +// Creates a new instance of the StorageResourceCollectionPage type. +func NewStorageResourceCollectionPage(cur StorageResourceCollection, getNextPage func(context.Context, StorageResourceCollection) (StorageResourceCollection, error)) StorageResourceCollectionPage { + return StorageResourceCollectionPage{ + fn: getNextPage, + src: cur, + } +} + +// StoragesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StoragesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StoragesClient) (StorageResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StoragesCreateOrUpdateFuture) 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 StoragesCreateOrUpdateFuture.Result. +func (future *StoragesCreateOrUpdateFuture) result(client StoragesClient) (sr StorageResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.StoragesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.CreateOrUpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// StoragesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StoragesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StoragesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *StoragesDeleteFuture) 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 StoragesDeleteFuture.Result. +func (future *StoragesDeleteFuture) result(client StoragesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("appplatform.StoragesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SupportedBuildpackResource supported buildpack resource payload +type SupportedBuildpackResource struct { + autorest.Response `json:"-"` + Properties *SupportedBuildpackResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SupportedBuildpackResource. +func (sbr SupportedBuildpackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sbr.Properties != nil { + objectMap["properties"] = sbr.Properties + } + if sbr.SystemData != nil { + objectMap["systemData"] = sbr.SystemData + } + return json.Marshal(objectMap) +} + +// SupportedBuildpackResourceProperties supported buildpack resource properties +type SupportedBuildpackResourceProperties struct { + // BuildpackID - The id of supported buildpack + BuildpackID *string `json:"buildpackId,omitempty"` +} + +// SupportedBuildpacksCollection object that includes an array of supported buildpacks resources and a +// possible link for next set +type SupportedBuildpacksCollection struct { + autorest.Response `json:"-"` + // Value - Collection of supported buildpacks resources + Value *[]SupportedBuildpackResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// SupportedRuntimeVersion supported deployment runtime version descriptor. +type SupportedRuntimeVersion struct { + // Value - The raw value which could be passed to deployment CRUD operations. Possible values include: 'Java8', 'Java11', 'Java17', 'NetCore31' + Value SupportedRuntimeValue `json:"value,omitempty"` + // Platform - The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: 'Java', 'NETCore' + Platform SupportedRuntimePlatform `json:"platform,omitempty"` + // Version - The detailed version (major.minor) of the platform. + Version *string `json:"version,omitempty"` +} + +// SupportedStackResource supported stack resource payload +type SupportedStackResource struct { + autorest.Response `json:"-"` + Properties *SupportedStackResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SupportedStackResource. +func (ssr SupportedStackResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssr.Properties != nil { + objectMap["properties"] = ssr.Properties + } + if ssr.SystemData != nil { + objectMap["systemData"] = ssr.SystemData + } + return json.Marshal(objectMap) +} + +// SupportedStackResourceProperties supported stack resource properties +type SupportedStackResourceProperties struct { + // StackID - The id of supported stack + StackID *string `json:"stackId,omitempty"` + // Version - The version of supported stack + Version *string `json:"version,omitempty"` +} + +// SupportedStacksCollection object that includes an array of supported stacks resources and a possible +// link for next set +type SupportedStacksCollection struct { + autorest.Response `json:"-"` + // Value - Collection of supported stacks resources + Value *[]SupportedStackResource `json:"value,omitempty"` + // NextLink - URL client should use to fetch the next page (per server side paging). + // It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'LastModifiedByTypeUser', 'LastModifiedByTypeApplication', 'LastModifiedByTypeManagedIdentity', 'LastModifiedByTypeKey' + LastModifiedByType LastModifiedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource modification (UTC). + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TCPSocketAction tCPSocketAction describes an action based on opening a socket +type TCPSocketAction struct { + // Type - Possible values include: 'TypeProbeAction', 'TypeHTTPGetAction', 'TypeExecAction', 'TypeTCPSocketAction' + Type TypeBasicProbeAction `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TCPSocketAction. +func (tsa TCPSocketAction) MarshalJSON() ([]byte, error) { + tsa.Type = TypeTCPSocketAction + objectMap := make(map[string]interface{}) + if tsa.Type != "" { + objectMap["type"] = tsa.Type + } + return json.Marshal(objectMap) +} + +// AsHTTPGetAction is the BasicProbeAction implementation for TCPSocketAction. +func (tsa TCPSocketAction) AsHTTPGetAction() (*HTTPGetAction, bool) { + return nil, false +} + +// AsExecAction is the BasicProbeAction implementation for TCPSocketAction. +func (tsa TCPSocketAction) AsExecAction() (*ExecAction, bool) { + return nil, false +} + +// AsTCPSocketAction is the BasicProbeAction implementation for TCPSocketAction. +func (tsa TCPSocketAction) AsTCPSocketAction() (*TCPSocketAction, bool) { + return &tsa, true +} + +// AsProbeAction is the BasicProbeAction implementation for TCPSocketAction. +func (tsa TCPSocketAction) AsProbeAction() (*ProbeAction, bool) { + return nil, false +} + +// AsBasicProbeAction is the BasicProbeAction implementation for TCPSocketAction. +func (tsa TCPSocketAction) AsBasicProbeAction() (BasicProbeAction, bool) { + return &tsa, true +} + +// TemporaryDisk temporary disk payload +type TemporaryDisk struct { + // SizeInGB - Size of the temporary disk in GB + SizeInGB *int32 `json:"sizeInGB,omitempty"` + // MountPath - Mount path of the temporary disk + MountPath *string `json:"mountPath,omitempty"` +} + +// TestKeys test keys payload +type TestKeys struct { + autorest.Response `json:"-"` + // PrimaryKey - Primary key + PrimaryKey *string `json:"primaryKey,omitempty"` + // SecondaryKey - Secondary key + SecondaryKey *string `json:"secondaryKey,omitempty"` + // PrimaryTestEndpoint - Primary test endpoint + PrimaryTestEndpoint *string `json:"primaryTestEndpoint,omitempty"` + // SecondaryTestEndpoint - Secondary test endpoint + SecondaryTestEndpoint *string `json:"secondaryTestEndpoint,omitempty"` + // Enabled - Indicates whether the test endpoint feature enabled or not + Enabled *bool `json:"enabled,omitempty"` +} + +// TrackedResource the resource model definition for a ARM tracked top level resource. +type TrackedResource struct { + // Location - The GEO location of the resource. + Location *string `json:"location,omitempty"` + // Tags - Tags of the service which is a list of key value pairs that describe the resource. + Tags map[string]*string `json:"tags"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Location != nil { + objectMap["location"] = tr.Location + } + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.SystemData != nil { + objectMap["systemData"] = tr.SystemData + } + return json.Marshal(objectMap) +} + +// TriggeredBuildResult the build result triggered by a build +type TriggeredBuildResult struct { + // ID - The unique build id of this build result + ID *string `json:"id,omitempty"` +} + +// BasicUploadedUserSourceInfo source with uploaded location +type BasicUploadedUserSourceInfo interface { + AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) + AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) + AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) + AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) +} + +// UploadedUserSourceInfo source with uploaded location +type UploadedUserSourceInfo struct { + // RelativePath - Relative path of the storage which stores the source + RelativePath *string `json:"relativePath,omitempty"` + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult', 'TypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +func unmarshalBasicUploadedUserSourceInfo(body []byte) (BasicUploadedUserSourceInfo, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeJar): + var juusi JarUploadedUserSourceInfo + err := json.Unmarshal(body, &juusi) + return juusi, err + case string(TypeSource): + var suusi SourceUploadedUserSourceInfo + err := json.Unmarshal(body, &suusi) + return suusi, err + case string(TypeNetCoreZip): + var nczuusi NetCoreZipUploadedUserSourceInfo + err := json.Unmarshal(body, &nczuusi) + return nczuusi, err + default: + var uusi UploadedUserSourceInfo + err := json.Unmarshal(body, &uusi) + return uusi, err + } +} +func unmarshalBasicUploadedUserSourceInfoArray(body []byte) ([]BasicUploadedUserSourceInfo, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + uusiArray := make([]BasicUploadedUserSourceInfo, len(rawMessages)) + + for index, rawMessage := range rawMessages { + uusi, err := unmarshalBasicUploadedUserSourceInfo(*rawMessage) + if err != nil { + return nil, err + } + uusiArray[index] = uusi + } + return uusiArray, nil +} + +// MarshalJSON is the custom marshaler for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) MarshalJSON() ([]byte, error) { + uusi.Type = TypeUploadedUserSourceInfo + objectMap := make(map[string]interface{}) + if uusi.RelativePath != nil { + objectMap["relativePath"] = uusi.RelativePath + } + if uusi.Version != nil { + objectMap["version"] = uusi.Version + } + if uusi.Type != "" { + objectMap["type"] = uusi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return &uusi, true +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return &uusi, true +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return nil, false +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for UploadedUserSourceInfo. +func (uusi UploadedUserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &uusi, true +} + +// UserAssignedManagedIdentity the details of the user-assigned managed identity assigned to an App. +type UserAssignedManagedIdentity struct { + // PrincipalID - READ-ONLY; Principal Id of user-assigned managed identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; Client Id of user-assigned managed identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserAssignedManagedIdentity. +func (uami UserAssignedManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BasicUserSourceInfo source information for a deployment +type BasicUserSourceInfo interface { + AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) + AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) + AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) + AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) + AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) + AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) + AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) + AsUserSourceInfo() (*UserSourceInfo, bool) +} + +// UserSourceInfo source information for a deployment +type UserSourceInfo struct { + // Version - Version of the source + Version *string `json:"version,omitempty"` + // Type - Possible values include: 'TypeUserSourceInfo', 'TypeUploadedUserSourceInfo', 'TypeJar', 'TypeSource', 'TypeNetCoreZip', 'TypeBuildResult', 'TypeContainer' + Type TypeBasicUserSourceInfo `json:"type,omitempty"` +} + +func unmarshalBasicUserSourceInfo(body []byte) (BasicUserSourceInfo, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeUploadedUserSourceInfo): + var uusi UploadedUserSourceInfo + err := json.Unmarshal(body, &uusi) + return uusi, err + case string(TypeJar): + var juusi JarUploadedUserSourceInfo + err := json.Unmarshal(body, &juusi) + return juusi, err + case string(TypeSource): + var suusi SourceUploadedUserSourceInfo + err := json.Unmarshal(body, &suusi) + return suusi, err + case string(TypeNetCoreZip): + var nczuusi NetCoreZipUploadedUserSourceInfo + err := json.Unmarshal(body, &nczuusi) + return nczuusi, err + case string(TypeBuildResult): + var brusi BuildResultUserSourceInfo + err := json.Unmarshal(body, &brusi) + return brusi, err + case string(TypeContainer): + var ccusi CustomContainerUserSourceInfo + err := json.Unmarshal(body, &ccusi) + return ccusi, err + default: + var usi UserSourceInfo + err := json.Unmarshal(body, &usi) + return usi, err + } +} +func unmarshalBasicUserSourceInfoArray(body []byte) ([]BasicUserSourceInfo, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + usiArray := make([]BasicUserSourceInfo, len(rawMessages)) + + for index, rawMessage := range rawMessages { + usi, err := unmarshalBasicUserSourceInfo(*rawMessage) + if err != nil { + return nil, err + } + usiArray[index] = usi + } + return usiArray, nil +} + +// MarshalJSON is the custom marshaler for UserSourceInfo. +func (usi UserSourceInfo) MarshalJSON() ([]byte, error) { + usi.Type = TypeUserSourceInfo + objectMap := make(map[string]interface{}) + if usi.Version != nil { + objectMap["version"] = usi.Version + } + if usi.Type != "" { + objectMap["type"] = usi.Type + } + return json.Marshal(objectMap) +} + +// AsUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsUploadedUserSourceInfo() (*UploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBasicUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsBasicUploadedUserSourceInfo() (BasicUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsJarUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsJarUploadedUserSourceInfo() (*JarUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsSourceUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsSourceUploadedUserSourceInfo() (*SourceUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsNetCoreZipUploadedUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsNetCoreZipUploadedUserSourceInfo() (*NetCoreZipUploadedUserSourceInfo, bool) { + return nil, false +} + +// AsBuildResultUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsBuildResultUserSourceInfo() (*BuildResultUserSourceInfo, bool) { + return nil, false +} + +// AsCustomContainerUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsCustomContainerUserSourceInfo() (*CustomContainerUserSourceInfo, bool) { + return nil, false +} + +// AsUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsUserSourceInfo() (*UserSourceInfo, bool) { + return &usi, true +} + +// AsBasicUserSourceInfo is the BasicUserSourceInfo implementation for UserSourceInfo. +func (usi UserSourceInfo) AsBasicUserSourceInfo() (BasicUserSourceInfo, bool) { + return &usi, true +} + +// ValidationMessages validate messages of the configuration service git repositories +type ValidationMessages struct { + // Name - The name of the configuration service git repository. + Name *string `json:"name,omitempty"` + // Messages - Detailed validation messages. + Messages *[]string `json:"messages,omitempty"` +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/monitoringsettings.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/monitoringsettings.go new file mode 100644 index 000000000000..aaa5cd07ce58 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/monitoringsettings.go @@ -0,0 +1,287 @@ +package appplatform + +// 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" +) + +// MonitoringSettingsClient is the REST API for Azure Spring Apps +type MonitoringSettingsClient struct { + BaseClient +} + +// NewMonitoringSettingsClient creates an instance of the MonitoringSettingsClient client. +func NewMonitoringSettingsClient(subscriptionID string) MonitoringSettingsClient { + return NewMonitoringSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMonitoringSettingsClientWithBaseURI creates an instance of the MonitoringSettingsClient 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 NewMonitoringSettingsClientWithBaseURI(baseURI string, subscriptionID string) MonitoringSettingsClient { + return MonitoringSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the Monitoring Setting and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client MonitoringSettingsClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result MonitoringSettingResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringSettingsClient.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, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MonitoringSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MonitoringSettingsClient) 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 MonitoringSettingsClient) GetResponder(resp *http.Response) (result MonitoringSettingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePatch update the Monitoring Setting. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// monitoringSettingResource - parameters for the update operation +func (client MonitoringSettingsClient) UpdatePatch(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource MonitoringSettingResource) (result MonitoringSettingsUpdatePatchFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringSettingsClient.UpdatePatch") + 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.UpdatePatchPreparer(ctx, resourceGroupName, serviceName, monitoringSettingResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "UpdatePatch", nil, "Failure preparing request") + return + } + + result, err = client.UpdatePatchSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "UpdatePatch", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePatchPreparer prepares the UpdatePatch request. +func (client MonitoringSettingsClient) UpdatePatchPreparer(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource MonitoringSettingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", pathParameters), + autorest.WithJSON(monitoringSettingResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePatchSender sends the UpdatePatch request. The method will close the +// http.Response Body if it receives an error. +func (client MonitoringSettingsClient) UpdatePatchSender(req *http.Request) (future MonitoringSettingsUpdatePatchFuture, 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 +} + +// UpdatePatchResponder handles the response to the UpdatePatch request. The method always +// closes the http.Response Body. +func (client MonitoringSettingsClient) UpdatePatchResponder(resp *http.Response) (result MonitoringSettingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdatePut update the Monitoring Setting. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// monitoringSettingResource - parameters for the update operation +func (client MonitoringSettingsClient) UpdatePut(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource MonitoringSettingResource) (result MonitoringSettingsUpdatePutFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringSettingsClient.UpdatePut") + 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: monitoringSettingResource, + Constraints: []validation.Constraint{{Target: "monitoringSettingResource.Properties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "monitoringSettingResource.Properties.AppInsightsSamplingRate", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "monitoringSettingResource.Properties.AppInsightsSamplingRate", Name: validation.InclusiveMaximum, Rule: float64(100), Chain: nil}, + {Target: "monitoringSettingResource.Properties.AppInsightsSamplingRate", Name: validation.InclusiveMinimum, Rule: float64(0), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("appplatform.MonitoringSettingsClient", "UpdatePut", err.Error()) + } + + req, err := client.UpdatePutPreparer(ctx, resourceGroupName, serviceName, monitoringSettingResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "UpdatePut", nil, "Failure preparing request") + return + } + + result, err = client.UpdatePutSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.MonitoringSettingsClient", "UpdatePut", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePutPreparer prepares the UpdatePut request. +func (client MonitoringSettingsClient) UpdatePutPreparer(ctx context.Context, resourceGroupName string, serviceName string, monitoringSettingResource MonitoringSettingResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default", pathParameters), + autorest.WithJSON(monitoringSettingResource), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePutSender sends the UpdatePut request. The method will close the +// http.Response Body if it receives an error. +func (client MonitoringSettingsClient) UpdatePutSender(req *http.Request) (future MonitoringSettingsUpdatePutFuture, 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 +} + +// UpdatePutResponder handles the response to the UpdatePut request. The method always +// closes the http.Response Body. +func (client MonitoringSettingsClient) UpdatePutResponder(resp *http.Response) (result MonitoringSettingResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/operations.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/operations.go new file mode 100644 index 000000000000..83707cfec137 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/operations.go @@ -0,0 +1,140 @@ +package appplatform + +// 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 REST API for Azure Spring Apps +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available REST API operations of the Microsoft.AppPlatform provider. +func (client OperationsClient) List(ctx context.Context) (result AvailableOperationsPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.ao.Response.Response != nil { + sc = result.ao.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ao.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.ao, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.ao.hasNextLink() && result.ao.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.AppPlatform/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 AvailableOperations, 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 AvailableOperations) (result AvailableOperations, err error) { + req, err := lastResults.availableOperationsPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.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, "appplatform.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.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 AvailableOperationsIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/runtimeversions.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/runtimeversions.go new file mode 100644 index 000000000000..a4e59680f208 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/runtimeversions.go @@ -0,0 +1,98 @@ +package appplatform + +// 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" +) + +// RuntimeVersionsClient is the REST API for Azure Spring Apps +type RuntimeVersionsClient struct { + BaseClient +} + +// NewRuntimeVersionsClient creates an instance of the RuntimeVersionsClient client. +func NewRuntimeVersionsClient(subscriptionID string) RuntimeVersionsClient { + return NewRuntimeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRuntimeVersionsClientWithBaseURI creates an instance of the RuntimeVersionsClient 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 NewRuntimeVersionsClientWithBaseURI(baseURI string, subscriptionID string) RuntimeVersionsClient { + return RuntimeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListRuntimeVersions lists all of the available runtime versions supported by Microsoft.AppPlatform provider. +func (client RuntimeVersionsClient) ListRuntimeVersions(ctx context.Context) (result AvailableRuntimeVersions, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RuntimeVersionsClient.ListRuntimeVersions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListRuntimeVersionsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.RuntimeVersionsClient", "ListRuntimeVersions", nil, "Failure preparing request") + return + } + + resp, err := client.ListRuntimeVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.RuntimeVersionsClient", "ListRuntimeVersions", resp, "Failure sending request") + return + } + + result, err = client.ListRuntimeVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.RuntimeVersionsClient", "ListRuntimeVersions", resp, "Failure responding to request") + return + } + + return +} + +// ListRuntimeVersionsPreparer prepares the ListRuntimeVersions request. +func (client RuntimeVersionsClient) ListRuntimeVersionsPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.AppPlatform/runtimeVersions"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRuntimeVersionsSender sends the ListRuntimeVersions request. The method will close the +// http.Response Body if it receives an error. +func (client RuntimeVersionsClient) ListRuntimeVersionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListRuntimeVersionsResponder handles the response to the ListRuntimeVersions request. The method always +// closes the http.Response Body. +func (client RuntimeVersionsClient) ListRuntimeVersionsResponder(resp *http.Response) (result AvailableRuntimeVersions, 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/appplatform/mgmt/2022-05-01-preview/appplatform/serviceregistries.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/serviceregistries.go new file mode 100644 index 000000000000..ca0ad3e92377 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/serviceregistries.go @@ -0,0 +1,393 @@ +package appplatform + +// 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" +) + +// ServiceRegistriesClient is the REST API for Azure Spring Apps +type ServiceRegistriesClient struct { + BaseClient +} + +// NewServiceRegistriesClient creates an instance of the ServiceRegistriesClient client. +func NewServiceRegistriesClient(subscriptionID string) ServiceRegistriesClient { + return NewServiceRegistriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServiceRegistriesClientWithBaseURI creates an instance of the ServiceRegistriesClient 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 NewServiceRegistriesClientWithBaseURI(baseURI string, subscriptionID string) ServiceRegistriesClient { + return ServiceRegistriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the default Service Registry or update the existing Service Registry. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// serviceRegistryName - the name of Service Registry. +func (client ServiceRegistriesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (result ServiceRegistriesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistriesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, serviceRegistryName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServiceRegistriesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "serviceRegistryName": autorest.Encode("path", serviceRegistryName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceRegistriesClient) CreateOrUpdateSender(req *http.Request) (future ServiceRegistriesCreateOrUpdateFuture, 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 ServiceRegistriesClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceRegistryResource, 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 disable the default Service Registry. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// serviceRegistryName - the name of Service Registry. +func (client ServiceRegistriesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (result ServiceRegistriesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistriesClient.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, serviceName, serviceRegistryName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServiceRegistriesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "serviceRegistryName": autorest.Encode("path", serviceRegistryName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", 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 ServiceRegistriesClient) DeleteSender(req *http.Request) (future ServiceRegistriesDeleteFuture, 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 ServiceRegistriesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the Service Registry and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// serviceRegistryName - the name of Service Registry. +func (client ServiceRegistriesClient) Get(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (result ServiceRegistryResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistriesClient.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, serviceName, serviceRegistryName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServiceRegistriesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, serviceRegistryName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "serviceRegistryName": autorest.Encode("path", serviceRegistryName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}", 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 ServiceRegistriesClient) 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 ServiceRegistriesClient) GetResponder(resp *http.Response) (result ServiceRegistryResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServiceRegistriesClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceRegistryResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistriesClient.List") + defer func() { + sc := -1 + if result.srrc.Response.Response != nil { + sc = result.srrc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.srrc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "List", resp, "Failure sending request") + return + } + + result.srrc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "List", resp, "Failure responding to request") + return + } + if result.srrc.hasNextLink() && result.srrc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ServiceRegistriesClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries", 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 ServiceRegistriesClient) 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 ServiceRegistriesClient) ListResponder(resp *http.Response) (result ServiceRegistryResourceCollection, 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 ServiceRegistriesClient) listNextResults(ctx context.Context, lastResults ServiceRegistryResourceCollection) (result ServiceRegistryResourceCollection, err error) { + req, err := lastResults.serviceRegistryResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "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, "appplatform.ServiceRegistriesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServiceRegistriesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServiceRegistriesClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceRegistryResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceRegistriesClient.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, serviceName) + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/services.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/services.go new file mode 100644 index 000000000000..e96ba204297a --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/services.go @@ -0,0 +1,1136 @@ +package appplatform + +// 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" +) + +// ServicesClient is the REST API for Azure Spring Apps +type ServicesClient struct { + BaseClient +} + +// NewServicesClient creates an instance of the ServicesClient client. +func NewServicesClient(subscriptionID string) ServicesClient { + return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServicesClientWithBaseURI creates an instance of the ServicesClient 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 NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient { + return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability checks that the resource name is valid and is not already in use. +// Parameters: +// location - the region +// availabilityParameters - parameters supplied to the operation. +func (client ServicesClient) CheckNameAvailability(ctx context.Context, location string, availabilityParameters NameAvailabilityParameters) (result NameAvailability, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CheckNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: availabilityParameters, + Constraints: []validation.Constraint{{Target: "availabilityParameters.Type", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "availabilityParameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("appplatform.ServicesClient", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, location, availabilityParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ServicesClient) CheckNameAvailabilityPreparer(ctx context.Context, location string, availabilityParameters NameAvailabilityParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability", pathParameters), + autorest.WithJSON(availabilityParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result NameAvailability, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create a new Service or update an exiting Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// resource - parameters for the create or update operation +func (client ServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource) (result ServicesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, resource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", pathParameters), + autorest.WithJSON(resource), + 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 ServicesClient) CreateOrUpdateSender(req *http.Request) (future ServicesCreateOrUpdateFuture, 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 ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete operation to delete a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string) (result ServicesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.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, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", 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 ServicesClient) DeleteSender(req *http.Request) (future ServicesDeleteFuture, 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 ServicesClient) 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 +} + +// DisableTestEndpoint disable test endpoint functionality for a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) DisableTestEndpoint(ctx context.Context, resourceGroupName string, serviceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.DisableTestEndpoint") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DisableTestEndpointPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "DisableTestEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.DisableTestEndpointSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "DisableTestEndpoint", resp, "Failure sending request") + return + } + + result, err = client.DisableTestEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "DisableTestEndpoint", resp, "Failure responding to request") + return + } + + return +} + +// DisableTestEndpointPreparer prepares the DisableTestEndpoint request. +func (client ServicesClient) DisableTestEndpointPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisableTestEndpointSender sends the DisableTestEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) DisableTestEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisableTestEndpointResponder handles the response to the DisableTestEndpoint request. The method always +// closes the http.Response Body. +func (client ServicesClient) DisableTestEndpointResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// EnableTestEndpoint enable test endpoint functionality for a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) EnableTestEndpoint(ctx context.Context, resourceGroupName string, serviceName string) (result TestKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.EnableTestEndpoint") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.EnableTestEndpointPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "EnableTestEndpoint", nil, "Failure preparing request") + return + } + + resp, err := client.EnableTestEndpointSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "EnableTestEndpoint", resp, "Failure sending request") + return + } + + result, err = client.EnableTestEndpointResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "EnableTestEndpoint", resp, "Failure responding to request") + return + } + + return +} + +// EnableTestEndpointPreparer prepares the EnableTestEndpoint request. +func (client ServicesClient) EnableTestEndpointPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// EnableTestEndpointSender sends the EnableTestEndpoint request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) EnableTestEndpointSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// EnableTestEndpointResponder handles the response to the EnableTestEndpoint request. The method always +// closes the http.Response Body. +func (client ServicesClient) EnableTestEndpointResponder(resp *http.Response) (result TestKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get a Service and its properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) Get(ctx context.Context, resourceGroupName string, serviceName string) (result ServiceResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.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, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", 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 ServicesClient) 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 ServicesClient) GetResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List handles requests to list all resources in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +func (client ServicesClient) List(ctx context.Context, resourceGroupName string) (result ServiceResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.List") + defer func() { + sc := -1 + if result.srl.Response.Response != nil { + sc = result.srl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.srl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "List", resp, "Failure sending request") + return + } + + result.srl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "List", resp, "Failure responding to request") + return + } + if result.srl.hasNextLink() && result.srl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ServicesClient) ListPreparer(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 = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring", 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 ServicesClient) 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 ServicesClient) ListResponder(resp *http.Response) (result ServiceResourceList, 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 ServicesClient) listNextResults(ctx context.Context, lastResults ServiceResourceList) (result ServiceResourceList, err error) { + req, err := lastResults.serviceResourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.ServicesClient", "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, "appplatform.ServicesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServicesClient) ListComplete(ctx context.Context, resourceGroupName string) (result ServiceResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.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) + return +} + +// ListBySubscription handles requests to list all resources in a subscription. +func (client ServicesClient) ListBySubscription(ctx context.Context) (result ServiceResourceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListBySubscription") + defer func() { + sc := -1 + if result.srl.Response.Response != nil { + sc = result.srl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.srl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.srl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.srl.hasNextLink() && result.srl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ServicesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListBySubscriptionResponder(resp *http.Response) (result ServiceResourceList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client ServicesClient) listBySubscriptionNextResults(ctx context.Context, lastResults ServiceResourceList) (result ServiceResourceList, err error) { + req, err := lastResults.serviceResourceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServicesClient) ListBySubscriptionComplete(ctx context.Context) (result ServiceResourceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// ListTestKeys list test keys for a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) ListTestKeys(ctx context.Context, resourceGroupName string, serviceName string) (result TestKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.ListTestKeys") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListTestKeysPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListTestKeys", nil, "Failure preparing request") + return + } + + resp, err := client.ListTestKeysSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListTestKeys", resp, "Failure sending request") + return + } + + result, err = client.ListTestKeysResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "ListTestKeys", resp, "Failure responding to request") + return + } + + return +} + +// ListTestKeysPreparer prepares the ListTestKeys request. +func (client ServicesClient) ListTestKeysPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListTestKeysSender sends the ListTestKeys request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListTestKeysSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListTestKeysResponder handles the response to the ListTestKeys request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListTestKeysResponder(resp *http.Response) (result TestKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// RegenerateTestKey regenerate a test key for a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// regenerateTestKeyRequest - parameters for the operation +func (client ServicesClient) RegenerateTestKey(ctx context.Context, resourceGroupName string, serviceName string, regenerateTestKeyRequest RegenerateTestKeyRequestPayload) (result TestKeys, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.RegenerateTestKey") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RegenerateTestKeyPreparer(ctx, resourceGroupName, serviceName, regenerateTestKeyRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "RegenerateTestKey", nil, "Failure preparing request") + return + } + + resp, err := client.RegenerateTestKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "RegenerateTestKey", resp, "Failure sending request") + return + } + + result, err = client.RegenerateTestKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "RegenerateTestKey", resp, "Failure responding to request") + return + } + + return +} + +// RegenerateTestKeyPreparer prepares the RegenerateTestKey request. +func (client ServicesClient) RegenerateTestKeyPreparer(ctx context.Context, resourceGroupName string, serviceName string, regenerateTestKeyRequest RegenerateTestKeyRequestPayload) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey", pathParameters), + autorest.WithJSON(regenerateTestKeyRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RegenerateTestKeySender sends the RegenerateTestKey request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) RegenerateTestKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RegenerateTestKeyResponder handles the response to the RegenerateTestKey request. The method always +// closes the http.Response Body. +func (client ServicesClient) RegenerateTestKeyResponder(resp *http.Response) (result TestKeys, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start start a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) Start(ctx context.Context, resourceGroupName string, serviceName string) (result ServicesStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Start") + 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.StartPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client ServicesClient) StartPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) StartSender(req *http.Request) (future ServicesStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client ServicesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stop a Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client ServicesClient) Stop(ctx context.Context, resourceGroupName string, serviceName string) (result ServicesStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Stop") + 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.StopPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client ServicesClient) StopPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) StopSender(req *http.Request) (future ServicesStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client ServicesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update operation to update an exiting Service. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// resource - parameters for the update operation +func (client ServicesClient) Update(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource) (result ServicesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, resource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.ServicesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ServicesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}", pathParameters), + autorest.WithJSON(resource), + 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 ServicesClient) UpdateSender(req *http.Request) (future ServicesUpdateFuture, 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 ServicesClient) UpdateResponder(resp *http.Response) (result ServiceResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/skus.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/skus.go new file mode 100644 index 000000000000..949a9a06d917 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/skus.go @@ -0,0 +1,144 @@ +package appplatform + +// 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" +) + +// SkusClient is the REST API for Azure Spring Apps +type SkusClient struct { + BaseClient +} + +// NewSkusClient creates an instance of the SkusClient client. +func NewSkusClient(subscriptionID string) SkusClient { + return NewSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSkusClientWithBaseURI creates an instance of the SkusClient 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 NewSkusClientWithBaseURI(baseURI string, subscriptionID string) SkusClient { + return SkusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available skus of the Microsoft.AppPlatform provider. +func (client SkusClient) List(ctx context.Context) (result ResourceSkuCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") + defer func() { + sc := -1 + if result.rsc.Response.Response != nil { + sc = result.rsc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rsc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "List", resp, "Failure sending request") + return + } + + result.rsc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "List", resp, "Failure responding to request") + return + } + if result.rsc.hasNextLink() && result.rsc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus", 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 SkusClient) 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 SkusClient) ListResponder(resp *http.Response) (result ResourceSkuCollection, 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 SkusClient) listNextResults(ctx context.Context, lastResults ResourceSkuCollection) (result ResourceSkuCollection, err error) { + req, err := lastResults.resourceSkuCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.SkusClient", "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, "appplatform.SkusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.SkusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SkusClient) ListComplete(ctx context.Context) (result ResourceSkuCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkusClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/storages.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/storages.go new file mode 100644 index 000000000000..86805955513e --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/storages.go @@ -0,0 +1,395 @@ +package appplatform + +// 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" +) + +// StoragesClient is the REST API for Azure Spring Apps +type StoragesClient struct { + BaseClient +} + +// NewStoragesClient creates an instance of the StoragesClient client. +func NewStoragesClient(subscriptionID string) StoragesClient { + return NewStoragesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewStoragesClientWithBaseURI creates an instance of the StoragesClient 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 NewStoragesClientWithBaseURI(baseURI string, subscriptionID string) StoragesClient { + return StoragesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update storage resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// storageName - the name of the storage resource. +// storageResource - parameters for the create or update operation +func (client StoragesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, storageName string, storageResource StorageResource) (result StoragesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StoragesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, storageName, storageResource) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client StoragesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, storageName string, storageResource StorageResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "storageName": autorest.Encode("path", storageName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", pathParameters), + autorest.WithJSON(storageResource), + 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 StoragesClient) CreateOrUpdateSender(req *http.Request) (future StoragesCreateOrUpdateFuture, 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 StoragesClient) CreateOrUpdateResponder(resp *http.Response) (result StorageResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the storage resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// storageName - the name of the storage resource. +func (client StoragesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, storageName string) (result StoragesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StoragesClient.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, serviceName, storageName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client StoragesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, storageName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "storageName": autorest.Encode("path", storageName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", 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 StoragesClient) DeleteSender(req *http.Request) (future StoragesDeleteFuture, 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 StoragesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the storage resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +// storageName - the name of the storage resource. +func (client StoragesClient) Get(ctx context.Context, resourceGroupName string, serviceName string, storageName string) (result StorageResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StoragesClient.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, serviceName, storageName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.StoragesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client StoragesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, storageName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "storageName": autorest.Encode("path", storageName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}", 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 StoragesClient) 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 StoragesClient) GetResponder(resp *http.Response) (result StorageResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all the storages of one Azure Spring Apps resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the resource. You can obtain this value +// from the Azure Resource Manager API or the portal. +// serviceName - the name of the Service resource. +func (client StoragesClient) List(ctx context.Context, resourceGroupName string, serviceName string) (result StorageResourceCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StoragesClient.List") + defer func() { + sc := -1 + if result.src.Response.Response != nil { + sc = result.src.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.src.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "appplatform.StoragesClient", "List", resp, "Failure sending request") + return + } + + result.src, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesClient", "List", resp, "Failure responding to request") + return + } + if result.src.hasNextLink() && result.src.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client StoragesClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages", 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 StoragesClient) 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 StoragesClient) ListResponder(resp *http.Response) (result StorageResourceCollection, 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 StoragesClient) listNextResults(ctx context.Context, lastResults StorageResourceCollection) (result StorageResourceCollection, err error) { + req, err := lastResults.storageResourceCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "appplatform.StoragesClient", "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, "appplatform.StoragesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "appplatform.StoragesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client StoragesClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string) (result StorageResourceCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StoragesClient.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, serviceName) + return +} diff --git a/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/version.go b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/version.go new file mode 100644 index 000000000000..7ab799fb5ab4 --- /dev/null +++ b/services/preview/appplatform/mgmt/2022-05-01-preview/appplatform/version.go @@ -0,0 +1,19 @@ +package appplatform + +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() + " appplatform/2022-05-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}