diff --git a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/CHANGELOG.md b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/CHANGELOG.md +++ b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/_meta.json b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/_meta.json index 9193f38b394c..a0d6bd31759b 100644 --- a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/_meta.json +++ b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "92ab22b49bd085116af0c61fada2c6c360702e9e", + "commit": "62dc7865a18791290f282ed54bcb1d4b1517af16", "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", "tag": "package-2021-03", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/client.go b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/client.go index cb77012e286d..f7503b28aefb 100644 --- a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/client.go +++ b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/client.go @@ -1,6 +1,6 @@ // Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version 2021-03-01. // -// Use these APIs to create Source Control Configuration resources through ARM, for Kubernetes Clusters. +// KubernetesConfiguration Client package kubernetesconfiguration // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/operations.go b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/operations.go index 3cfe20c6f942..45d561c39010 100644 --- a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/operations.go +++ b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/operations.go @@ -14,8 +14,7 @@ import ( "net/http" ) -// OperationsClient is the use these APIs to create Source Control Configuration resources through ARM, for Kubernetes -// Clusters. +// OperationsClient is the kubernetesConfiguration Client type OperationsClient struct { BaseClient } diff --git a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/sourcecontrolconfigurations.go index 0ea1a556f7b9..54ac3d16fc38 100644 --- a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/sourcecontrolconfigurations.go +++ b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -14,8 +14,7 @@ import ( "net/http" ) -// SourceControlConfigurationsClient is the use these APIs to create Source Control Configuration resources through -// ARM, for Kubernetes Clusters. +// SourceControlConfigurationsClient is the kubernetesConfiguration Client type SourceControlConfigurationsClient struct { BaseClient } diff --git a/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/CHANGELOG.md b/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/CHANGELOG.md +++ b/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/_meta.json b/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/_meta.json index 4ce5f7bc5cf9..cac24e8c45aa 100644 --- a/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/_meta.json +++ b/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c5135f8325eaf79be7b137cae363bdcba028c17", + "commit": "62dc7865a18791290f282ed54bcb1d4b1517af16", "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", "tag": "package-2021-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/CHANGELOG.md b/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/CHANGELOG.md +++ b/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/_meta.json b/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/_meta.json index 815367175194..089bd90d48e6 100644 --- a/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/_meta.json +++ b/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "61218420e95ad3435a029144877b110b56418958", + "commit": "62dc7865a18791290f282ed54bcb1d4b1517af16", "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", "tag": "package-2022-03", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/CHANGELOG.md +++ b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/_meta.json index 454ed4df5d49..7ba05af02719 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/_meta.json +++ b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "62dc7865a18791290f282ed54bcb1d4b1517af16", "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", "tag": "package-2019-11-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/client.go b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/client.go index 67ffe199a4a8..1b9075c20555 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/client.go +++ b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/client.go @@ -1,7 +1,7 @@ // Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version // 2019-11-01-preview. // -// Use these APIs to create Source Control Configuration resources through ARM, for Kubernetes Clusters. +// KubernetesConfiguration Client package kubernetesconfiguration // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/operations.go b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/operations.go index 2717fc694f27..e28168692d6b 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/operations.go +++ b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/operations.go @@ -14,8 +14,7 @@ import ( "net/http" ) -// OperationsClient is the use these APIs to create Source Control Configuration resources through ARM, for Kubernetes -// Clusters. +// OperationsClient is the kubernetesConfiguration Client type OperationsClient struct { BaseClient } diff --git a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go index 13377cf1fac7..6d2a58188aab 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go +++ b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -14,8 +14,7 @@ import ( "net/http" ) -// SourceControlConfigurationsClient is the use these APIs to create Source Control Configuration resources through -// ARM, for Kubernetes Clusters. +// SourceControlConfigurationsClient is the kubernetesConfiguration Client type SourceControlConfigurationsClient struct { BaseClient } diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/CHANGELOG.md +++ b/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/_meta.json index f21af5121c6a..c2d04f05d414 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/_meta.json +++ b/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "d9506558e6389e62926ae385f1d625a1376a0f9d", + "commit": "62dc7865a18791290f282ed54bcb1d4b1517af16", "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", "tag": "package-2020-07-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/_meta.json new file mode 100644 index 000000000000..2d9bd913a22e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "62dc7865a18791290f282ed54bcb1d4b1517af16", + "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "tag": "package-preview-2020-10", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2020-10 --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/kubernetesconfiguration/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/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/client.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/client.go new file mode 100644 index 000000000000..bf42eecdfec8 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/client.go @@ -0,0 +1,42 @@ +// Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version +// 2020-10-01-preview. +// +// KubernetesConfiguration Client +package kubernetesconfiguration + +// 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 Kubernetesconfiguration + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Kubernetesconfiguration. +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/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/enums.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/enums.go new file mode 100644 index 000000000000..1e9816106447 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/enums.go @@ -0,0 +1,94 @@ +package kubernetesconfiguration + +// 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. + +// ComplianceStateType enumerates the values for compliance state type. +type ComplianceStateType string + +const ( + // Compliant ... + Compliant ComplianceStateType = "Compliant" + // Failed ... + Failed ComplianceStateType = "Failed" + // Installed ... + Installed ComplianceStateType = "Installed" + // Noncompliant ... + Noncompliant ComplianceStateType = "Noncompliant" + // Pending ... + Pending ComplianceStateType = "Pending" +) + +// PossibleComplianceStateTypeValues returns an array of possible values for the ComplianceStateType const type. +func PossibleComplianceStateTypeValues() []ComplianceStateType { + return []ComplianceStateType{Compliant, Failed, Installed, Noncompliant, Pending} +} + +// MessageLevelType enumerates the values for message level type. +type MessageLevelType string + +const ( + // Error ... + Error MessageLevelType = "Error" + // Information ... + Information MessageLevelType = "Information" + // Warning ... + Warning MessageLevelType = "Warning" +) + +// PossibleMessageLevelTypeValues returns an array of possible values for the MessageLevelType const type. +func PossibleMessageLevelTypeValues() []MessageLevelType { + return []MessageLevelType{Error, Information, Warning} +} + +// OperatorScopeType enumerates the values for operator scope type. +type OperatorScopeType string + +const ( + // Cluster ... + Cluster OperatorScopeType = "cluster" + // Namespace ... + Namespace OperatorScopeType = "namespace" +) + +// PossibleOperatorScopeTypeValues returns an array of possible values for the OperatorScopeType const type. +func PossibleOperatorScopeTypeValues() []OperatorScopeType { + return []OperatorScopeType{Cluster, Namespace} +} + +// OperatorType enumerates the values for operator type. +type OperatorType string + +const ( + // Flux ... + Flux OperatorType = "Flux" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{Flux} +} + +// ProvisioningStateType enumerates the values for provisioning state type. +type ProvisioningStateType string + +const ( + // ProvisioningStateTypeAccepted ... + ProvisioningStateTypeAccepted ProvisioningStateType = "Accepted" + // ProvisioningStateTypeDeleting ... + ProvisioningStateTypeDeleting ProvisioningStateType = "Deleting" + // ProvisioningStateTypeFailed ... + ProvisioningStateTypeFailed ProvisioningStateType = "Failed" + // ProvisioningStateTypeRunning ... + ProvisioningStateTypeRunning ProvisioningStateType = "Running" + // ProvisioningStateTypeSucceeded ... + ProvisioningStateTypeSucceeded ProvisioningStateType = "Succeeded" +) + +// PossibleProvisioningStateTypeValues returns an array of possible values for the ProvisioningStateType const type. +func PossibleProvisioningStateTypeValues() []ProvisioningStateType { + return []ProvisioningStateType{ProvisioningStateTypeAccepted, ProvisioningStateTypeDeleting, ProvisioningStateTypeFailed, ProvisioningStateTypeRunning, ProvisioningStateTypeSucceeded} +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go new file mode 100644 index 000000000000..93496fe42c29 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go @@ -0,0 +1,31 @@ +package kubernetesconfigurationapi + +// 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/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration" +) + +// SourceControlConfigurationsClientAPI contains the set of methods on the SourceControlConfigurationsClient type. +type SourceControlConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration kubernetesconfiguration.SourceControlConfiguration) (result kubernetesconfiguration.SourceControlConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListIterator, err error) +} + +var _ SourceControlConfigurationsClientAPI = (*kubernetesconfiguration.SourceControlConfigurationsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListPage, err error) + ListComplete(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListIterator, err error) +} + +var _ OperationsClientAPI = (*kubernetesconfiguration.OperationsClient)(nil) diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/models.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/models.go new file mode 100644 index 000000000000..b2d341120b58 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/models.go @@ -0,0 +1,701 @@ +package kubernetesconfiguration + +// 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/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration" + +// ComplianceStatus compliance Status details +type ComplianceStatus struct { + // ComplianceState - READ-ONLY; The compliance state of the configuration. Possible values include: 'Pending', 'Compliant', 'Noncompliant', 'Installed', 'Failed' + ComplianceState ComplianceStateType `json:"complianceState,omitempty"` + // LastConfigApplied - Datetime the configuration was last applied. + LastConfigApplied *date.Time `json:"lastConfigApplied,omitempty"` + // Message - Message from when the configuration was applied. + Message *string `json:"message,omitempty"` + // MessageLevel - Level of the message. Possible values include: 'Error', 'Warning', 'Information' + MessageLevel MessageLevelType `json:"messageLevel,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComplianceStatus. +func (cs ComplianceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.LastConfigApplied != nil { + objectMap["lastConfigApplied"] = cs.LastConfigApplied + } + if cs.Message != nil { + objectMap["message"] = cs.Message + } + if cs.MessageLevel != "" { + objectMap["messageLevel"] = cs.MessageLevel + } + return json.Marshal(objectMap) +} + +// ErrorDefinition error definition. +type ErrorDefinition struct { + // Code - Service specific error code which serves as the substatus for the HTTP error code. + Code *string `json:"code,omitempty"` + // Message - Description of the error. + Message *string `json:"message,omitempty"` +} + +// ErrorResponse error response. +type ErrorResponse struct { + // Error - Error definition. + Error *ErrorDefinition `json:"error,omitempty"` +} + +// HelmOperatorProperties properties for Helm operator. +type HelmOperatorProperties struct { + // ChartVersion - Version of the operator Helm chart. + ChartVersion *string `json:"chartVersion,omitempty"` + // ChartValues - Values override for the operator Helm chart. + ChartValues *string `json:"chartValues,omitempty"` +} + +// ProxyResource ARM proxy resource. +type ProxyResource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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) +} + +// Resource the Resource model definition. +type Resource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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) +} + +// ResourceProviderOperation supported operation of this resource provider. +type ResourceProviderOperation struct { + // Name - Operation name, in format of {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *ResourceProviderOperationDisplay `json:"display,omitempty"` + // IsDataAction - READ-ONLY; The flag that indicates whether the operation applies to data plane. + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperation. +func (rpo ResourceProviderOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpo.Name != nil { + objectMap["name"] = rpo.Name + } + if rpo.Display != nil { + objectMap["display"] = rpo.Display + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationDisplay display metadata associated with the operation. +type ResourceProviderOperationDisplay struct { + // Provider - Resource provider: Microsoft KubernetesConfiguration. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of this operation. + Description *string `json:"description,omitempty"` +} + +// ResourceProviderOperationList result of the request to list operations. +type ResourceProviderOperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by this resource provider. + Value *[]ResourceProviderOperation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperationList. +func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpol.Value != nil { + objectMap["value"] = rpol.Value + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation +// values. +type ResourceProviderOperationListIterator struct { + i int + page ResourceProviderOperationListPage +} + +// 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 *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.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 *ResourceProviderOperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceProviderOperationListIterator) 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 ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { + 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 ResourceProviderOperationListIterator) Value() ResourceProviderOperation { + if !iter.page.NotDone() { + return ResourceProviderOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceProviderOperationListIterator type. +func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { + return ResourceProviderOperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rpol ResourceProviderOperationList) IsEmpty() bool { + return rpol.Value == nil || len(*rpol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rpol ResourceProviderOperationList) hasNextLink() bool { + return rpol.NextLink != nil && len(*rpol.NextLink) != 0 +} + +// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { + if !rpol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rpol.NextLink))) +} + +// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. +type ResourceProviderOperationListPage struct { + fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) + rpol ResourceProviderOperationList +} + +// 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 *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.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.rpol) + if err != nil { + return err + } + page.rpol = 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 *ResourceProviderOperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceProviderOperationListPage) NotDone() bool { + return !page.rpol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { + return page.rpol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { + if page.rpol.IsEmpty() { + return nil + } + return *page.rpol.Value +} + +// Creates a new instance of the ResourceProviderOperationListPage type. +func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { + return ResourceProviderOperationListPage{ + fn: getNextPage, + rpol: cur, + } +} + +// Result sample result definition +type Result struct { + // SampleProperty - Sample property of type string + SampleProperty *string `json:"sampleProperty,omitempty"` +} + +// SourceControlConfiguration the SourceControl Configuration object returned in Get & Put response. +type SourceControlConfiguration struct { + autorest.Response `json:"-"` + // SourceControlConfigurationProperties - Properties to create a Source Control Configuration resource + *SourceControlConfigurationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfiguration. +func (scc SourceControlConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.SourceControlConfigurationProperties != nil { + objectMap["properties"] = scc.SourceControlConfigurationProperties + } + if scc.SystemData != nil { + objectMap["systemData"] = scc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SourceControlConfiguration struct. +func (scc *SourceControlConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sourceControlConfigurationProperties SourceControlConfigurationProperties + err = json.Unmarshal(*v, &sourceControlConfigurationProperties) + if err != nil { + return err + } + scc.SourceControlConfigurationProperties = &sourceControlConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + scc.SystemData = &systemData + } + } + } + + return nil +} + +// SourceControlConfigurationList result of the request to list Source Control Configurations. It contains +// a list of SourceControlConfiguration objects and a URL link to get the next set of results. +type SourceControlConfigurationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Source Control Configurations within a Kubernetes cluster. + Value *[]SourceControlConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationList. +func (sccl SourceControlConfigurationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SourceControlConfigurationListIterator provides access to a complete listing of +// SourceControlConfiguration values. +type SourceControlConfigurationListIterator struct { + i int + page SourceControlConfigurationListPage +} + +// 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 *SourceControlConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListIterator.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 *SourceControlConfigurationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SourceControlConfigurationListIterator) 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 SourceControlConfigurationListIterator) Response() SourceControlConfigurationList { + 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 SourceControlConfigurationListIterator) Value() SourceControlConfiguration { + if !iter.page.NotDone() { + return SourceControlConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SourceControlConfigurationListIterator type. +func NewSourceControlConfigurationListIterator(page SourceControlConfigurationListPage) SourceControlConfigurationListIterator { + return SourceControlConfigurationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sccl SourceControlConfigurationList) IsEmpty() bool { + return sccl.Value == nil || len(*sccl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sccl SourceControlConfigurationList) hasNextLink() bool { + return sccl.NextLink != nil && len(*sccl.NextLink) != 0 +} + +// sourceControlConfigurationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sccl SourceControlConfigurationList) sourceControlConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if !sccl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sccl.NextLink))) +} + +// SourceControlConfigurationListPage contains a page of SourceControlConfiguration values. +type SourceControlConfigurationListPage struct { + fn func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error) + sccl SourceControlConfigurationList +} + +// 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 *SourceControlConfigurationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListPage.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.sccl) + if err != nil { + return err + } + page.sccl = 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 *SourceControlConfigurationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SourceControlConfigurationListPage) NotDone() bool { + return !page.sccl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SourceControlConfigurationListPage) Response() SourceControlConfigurationList { + return page.sccl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SourceControlConfigurationListPage) Values() []SourceControlConfiguration { + if page.sccl.IsEmpty() { + return nil + } + return *page.sccl.Value +} + +// Creates a new instance of the SourceControlConfigurationListPage type. +func NewSourceControlConfigurationListPage(cur SourceControlConfigurationList, getNextPage func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error)) SourceControlConfigurationListPage { + return SourceControlConfigurationListPage{ + fn: getNextPage, + sccl: cur, + } +} + +// SourceControlConfigurationProperties properties to create a Source Control Configuration resource +type SourceControlConfigurationProperties struct { + // RepositoryURL - Url of the SourceControl Repository. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // OperatorNamespace - The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + OperatorNamespace *string `json:"operatorNamespace,omitempty"` + // OperatorInstanceName - Instance name of the operator - identifying the specific configuration. + OperatorInstanceName *string `json:"operatorInstanceName,omitempty"` + // OperatorType - Type of the operator. Possible values include: 'Flux' + OperatorType OperatorType `json:"operatorType,omitempty"` + // OperatorParams - Any Parameters for the Operator instance in string format. + OperatorParams *string `json:"operatorParams,omitempty"` + // ConfigurationProtectedSettings - Name-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // OperatorScope - Scope at which the operator will be installed. Possible values include: 'Cluster', 'Namespace' + OperatorScope OperatorScopeType `json:"operatorScope,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // SSHKnownHostsContents - Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances + SSHKnownHostsContents *string `json:"sshKnownHostsContents,omitempty"` + // EnableHelmOperator - Option to enable Helm Operator for this git configuration. + EnableHelmOperator *bool `json:"enableHelmOperator,omitempty"` + // HelmOperatorProperties - Properties for Helm operator. + HelmOperatorProperties *HelmOperatorProperties `json:"helmOperatorProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource provider. Possible values include: 'ProvisioningStateTypeAccepted', 'ProvisioningStateTypeDeleting', 'ProvisioningStateTypeRunning', 'ProvisioningStateTypeSucceeded', 'ProvisioningStateTypeFailed' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // ComplianceStatus - READ-ONLY; Compliance Status of the Configuration + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationProperties. +func (scc SourceControlConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.RepositoryURL != nil { + objectMap["repositoryUrl"] = scc.RepositoryURL + } + if scc.OperatorNamespace != nil { + objectMap["operatorNamespace"] = scc.OperatorNamespace + } + if scc.OperatorInstanceName != nil { + objectMap["operatorInstanceName"] = scc.OperatorInstanceName + } + if scc.OperatorType != "" { + objectMap["operatorType"] = scc.OperatorType + } + if scc.OperatorParams != nil { + objectMap["operatorParams"] = scc.OperatorParams + } + if scc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = scc.ConfigurationProtectedSettings + } + if scc.OperatorScope != "" { + objectMap["operatorScope"] = scc.OperatorScope + } + if scc.SSHKnownHostsContents != nil { + objectMap["sshKnownHostsContents"] = scc.SSHKnownHostsContents + } + if scc.EnableHelmOperator != nil { + objectMap["enableHelmOperator"] = scc.EnableHelmOperator + } + if scc.HelmOperatorProperties != nil { + objectMap["helmOperatorProperties"] = scc.HelmOperatorProperties + } + return json.Marshal(objectMap) +} + +// SourceControlConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SourceControlConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SourceControlConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SourceControlConfigurationsDeleteFuture) 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 SourceControlConfigurationsDeleteFuture.Result. +func (future *SourceControlConfigurationsDeleteFuture) result(client SourceControlConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.SourceControlConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SystemData top level metadata +// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources +type SystemData struct { + // CreatedBy - READ-ONLY; A string identifier for the identity that created the resource + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - READ-ONLY; The type of identity that created the resource: user, application, managedIdentity, key + CreatedByType *string `json:"createdByType,omitempty"` + // CreatedAt - READ-ONLY; The timestamp of resource creation (UTC) + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - READ-ONLY; A string identifier for the identity that last modified the resource + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - READ-ONLY; The type of identity that last modified the resource: user, application, managedIdentity, key + LastModifiedByType *string `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - READ-ONLY; The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// MarshalJSON is the custom marshaler for SystemData. +func (sd SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/operations.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/operations.go new file mode 100644 index 000000000000..92db3fd0b55f --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/operations.go @@ -0,0 +1,140 @@ +package kubernetesconfiguration + +// 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 kubernetesConfiguration Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all the available operations the KubernetesConfiguration resource provider supports. +func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.rpol.Response.Response != nil { + sc = result.rpol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rpol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.rpol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.rpol.hasNextLink() && result.rpol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.KubernetesConfiguration/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 ResourceProviderOperationList, 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 ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { + req, err := lastResults.resourceProviderOperationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.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, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.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 ResourceProviderOperationListIterator, 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/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go new file mode 100644 index 000000000000..11793064b890 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -0,0 +1,414 @@ +package kubernetesconfiguration + +// 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" +) + +// SourceControlConfigurationsClient is the kubernetesConfiguration Client +type SourceControlConfigurationsClient struct { + BaseClient +} + +// NewSourceControlConfigurationsClient creates an instance of the SourceControlConfigurationsClient client. +func NewSourceControlConfigurationsClient(subscriptionID string) SourceControlConfigurationsClient { + return NewSourceControlConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSourceControlConfigurationsClientWithBaseURI creates an instance of the SourceControlConfigurationsClient 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 NewSourceControlConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlConfigurationsClient { + return SourceControlConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +// sourceControlConfiguration - properties necessary to Create KubernetesConfiguration. +func (client SourceControlConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, sourceControlConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SourceControlConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", pathParameters), + autorest.WithJSON(sourceControlConfiguration), + 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 SourceControlConfigurationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result SourceControlConfiguration, 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 this will delete the YAML file used to set up the Source control configuration, thus stopping future sync +// from the source repo. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result SourceControlConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SourceControlConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) DeleteSender(req *http.Request) (future SourceControlConfigurationsDeleteFuture, 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 SourceControlConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details of the Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SourceControlConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) GetResponder(resp *http.Response) (result SourceControlConfiguration, 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 Source Control Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client SourceControlConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result SourceControlConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.sccl.Response.Response != nil { + sc = result.sccl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sccl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.sccl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.sccl.hasNextLink() && result.sccl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SourceControlConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) ListResponder(resp *http.Response) (result SourceControlConfigurationList, 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 SourceControlConfigurationsClient) listNextResults(ctx context.Context, lastResults SourceControlConfigurationList) (result SourceControlConfigurationList, err error) { + req, err := lastResults.sourceControlConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "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, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SourceControlConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result SourceControlConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/version.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/version.go new file mode 100644 index 000000000000..82b0cc263f5e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/version.go @@ -0,0 +1,19 @@ +package kubernetesconfiguration + +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() + " kubernetesconfiguration/2020-10-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/_meta.json new file mode 100644 index 000000000000..fcea2bb20607 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "62dc7865a18791290f282ed54bcb1d4b1517af16", + "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "tag": "package-preview-2021-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-2021-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/kubernetesconfiguration/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/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/client.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/client.go new file mode 100644 index 000000000000..6483862b143a --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/client.go @@ -0,0 +1,42 @@ +// Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version +// 2021-05-01-preview. +// +// KubernetesConfiguration Client +package kubernetesconfiguration + +// 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 Kubernetesconfiguration + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Kubernetesconfiguration. +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/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/clusterextensiontype.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/clusterextensiontype.go new file mode 100644 index 000000000000..9fdb1420d397 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/clusterextensiontype.go @@ -0,0 +1,126 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypeClient is the kubernetesConfiguration Client +type ClusterExtensionTypeClient struct { + BaseClient +} + +// NewClusterExtensionTypeClient creates an instance of the ClusterExtensionTypeClient client. +func NewClusterExtensionTypeClient(subscriptionID string) ClusterExtensionTypeClient { + return NewClusterExtensionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypeClientWithBaseURI creates an instance of the ClusterExtensionTypeClient 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 NewClusterExtensionTypeClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypeClient { + return ClusterExtensionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Extension Type details +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterType - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionTypeName - extension type name +func (client ClusterExtensionTypeClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterType string, clusterName string, extensionTypeName string) (result ExtensionType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypeClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ClusterExtensionTypeClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterType, clusterName, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClusterExtensionTypeClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterType string, clusterName string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterRp": autorest.Encode("path", clusterRp), + "clusterType": autorest.Encode("path", clusterType), + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterType}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}", 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 ClusterExtensionTypeClient) 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 ClusterExtensionTypeClient) GetResponder(resp *http.Response) (result ExtensionType, 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/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/clusterextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/clusterextensiontypes.go new file mode 100644 index 000000000000..20f92d95dd7a --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/clusterextensiontypes.go @@ -0,0 +1,163 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypesClient is the kubernetesConfiguration Client +type ClusterExtensionTypesClient struct { + BaseClient +} + +// NewClusterExtensionTypesClient creates an instance of the ClusterExtensionTypesClient client. +func NewClusterExtensionTypesClient(subscriptionID string) ClusterExtensionTypesClient { + return NewClusterExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypesClientWithBaseURI creates an instance of the ClusterExtensionTypesClient 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 NewClusterExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypesClient { + return ClusterExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get Extension Types +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ClusterExtensionTypesClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterName string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ClusterExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ClusterExtensionTypesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/connectedClusters/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes", 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 ClusterExtensionTypesClient) 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 ClusterExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, 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 ClusterExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "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, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClusterExtensionTypesClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterName string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.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, clusterRp, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/enums.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/enums.go new file mode 100644 index 000000000000..a7f301dd30ec --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/enums.go @@ -0,0 +1,200 @@ +package kubernetesconfiguration + +// 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. + +// ClusterTypes enumerates the values for cluster types. +type ClusterTypes string + +const ( + // ConnectedClusters ... + ConnectedClusters ClusterTypes = "connectedClusters" + // ManagedClusters ... + ManagedClusters ClusterTypes = "managedClusters" +) + +// PossibleClusterTypesValues returns an array of possible values for the ClusterTypes const type. +func PossibleClusterTypesValues() []ClusterTypes { + return []ClusterTypes{ConnectedClusters, ManagedClusters} +} + +// ComplianceStateType enumerates the values for compliance state type. +type ComplianceStateType string + +const ( + // Compliant ... + Compliant ComplianceStateType = "Compliant" + // Failed ... + Failed ComplianceStateType = "Failed" + // Installed ... + Installed ComplianceStateType = "Installed" + // Noncompliant ... + Noncompliant ComplianceStateType = "Noncompliant" + // Pending ... + Pending ComplianceStateType = "Pending" +) + +// PossibleComplianceStateTypeValues returns an array of possible values for the ComplianceStateType const type. +func PossibleComplianceStateTypeValues() []ComplianceStateType { + return []ComplianceStateType{Compliant, Failed, Installed, Noncompliant, Pending} +} + +// 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} +} + +// LevelType enumerates the values for level type. +type LevelType string + +const ( + // Error ... + Error LevelType = "Error" + // Information ... + Information LevelType = "Information" + // Warning ... + Warning LevelType = "Warning" +) + +// PossibleLevelTypeValues returns an array of possible values for the LevelType const type. +func PossibleLevelTypeValues() []LevelType { + return []LevelType{Error, Information, Warning} +} + +// MessageLevelType enumerates the values for message level type. +type MessageLevelType string + +const ( + // MessageLevelTypeError ... + MessageLevelTypeError MessageLevelType = "Error" + // MessageLevelTypeInformation ... + MessageLevelTypeInformation MessageLevelType = "Information" + // MessageLevelTypeWarning ... + MessageLevelTypeWarning MessageLevelType = "Warning" +) + +// PossibleMessageLevelTypeValues returns an array of possible values for the MessageLevelType const type. +func PossibleMessageLevelTypeValues() []MessageLevelType { + return []MessageLevelType{MessageLevelTypeError, MessageLevelTypeInformation, MessageLevelTypeWarning} +} + +// OperatorScopeType enumerates the values for operator scope type. +type OperatorScopeType string + +const ( + // Cluster ... + Cluster OperatorScopeType = "cluster" + // Namespace ... + Namespace OperatorScopeType = "namespace" +) + +// PossibleOperatorScopeTypeValues returns an array of possible values for the OperatorScopeType const type. +func PossibleOperatorScopeTypeValues() []OperatorScopeType { + return []OperatorScopeType{Cluster, Namespace} +} + +// OperatorType enumerates the values for operator type. +type OperatorType string + +const ( + // Flux ... + Flux OperatorType = "Flux" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{Flux} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ProvisioningStateType enumerates the values for provisioning state type. +type ProvisioningStateType string + +const ( + // ProvisioningStateTypeAccepted ... + ProvisioningStateTypeAccepted ProvisioningStateType = "Accepted" + // ProvisioningStateTypeDeleting ... + ProvisioningStateTypeDeleting ProvisioningStateType = "Deleting" + // ProvisioningStateTypeFailed ... + ProvisioningStateTypeFailed ProvisioningStateType = "Failed" + // ProvisioningStateTypeRunning ... + ProvisioningStateTypeRunning ProvisioningStateType = "Running" + // ProvisioningStateTypeSucceeded ... + ProvisioningStateTypeSucceeded ProvisioningStateType = "Succeeded" +) + +// PossibleProvisioningStateTypeValues returns an array of possible values for the ProvisioningStateType const type. +func PossibleProvisioningStateTypeValues() []ProvisioningStateType { + return []ProvisioningStateType{ProvisioningStateTypeAccepted, ProvisioningStateTypeDeleting, ProvisioningStateTypeFailed, ProvisioningStateTypeRunning, ProvisioningStateTypeSucceeded} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{SystemAssigned} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic ... + Basic SkuTier = "Basic" + // Free ... + Free SkuTier = "Free" + // Premium ... + Premium SkuTier = "Premium" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Basic, Free, Premium, Standard} +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/extensions.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/extensions.go new file mode 100644 index 000000000000..b7edcf88c039 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/extensions.go @@ -0,0 +1,456 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionsClient is the kubernetesConfiguration Client +type ExtensionsClient struct { + BaseClient +} + +// NewExtensionsClient creates an instance of the ExtensionsClient client. +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient 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 NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a new Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// extension - properties necessary to Create an Extension. +func (client ExtensionsClient) Create(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, extension Extension) (result ExtensionsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExtensionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, extension Extension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(extension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) CreateSender(req *http.Request) (future ExtensionsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) CreateResponder(resp *http.Response) (result Extension, 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 Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, forceDelete *bool) (result ExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) DeleteSender(req *http.Request) (future ExtensionsDeleteFuture, 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 ExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string) (result Extension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) 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 ExtensionsClient) GetResponder(resp *http.Response) (result Extension, 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 Extensions in the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ExtensionsClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result ExtensionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.List") + defer func() { + sc := -1 + if result.el.Response.Response != nil { + sc = result.el.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.el.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure sending request") + return + } + + result.el, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure responding to request") + return + } + if result.el.hasNextLink() && result.el.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions", 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 ExtensionsClient) 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 ExtensionsClient) ListResponder(resp *http.Response) (result ExtensionsList, 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 ExtensionsClient) listNextResults(ctx context.Context, lastResults ExtensionsList) (result ExtensionsList, err error) { + req, err := lastResults.extensionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "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, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result ExtensionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/extensiontypeversions.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/extensiontypeversions.go new file mode 100644 index 000000000000..17c239da27ae --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/extensiontypeversions.go @@ -0,0 +1,157 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionTypeVersionsClient is the kubernetesConfiguration Client +type ExtensionTypeVersionsClient struct { + BaseClient +} + +// NewExtensionTypeVersionsClient creates an instance of the ExtensionTypeVersionsClient client. +func NewExtensionTypeVersionsClient(subscriptionID string) ExtensionTypeVersionsClient { + return NewExtensionTypeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionTypeVersionsClientWithBaseURI creates an instance of the ExtensionTypeVersionsClient 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 NewExtensionTypeVersionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTypeVersionsClient { + return ExtensionTypeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list available versions for an Extension Type +// Parameters: +// location - extension location +// extensionTypeName - extension type name +func (client ExtensionTypeVersionsClient) List(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.List") + defer func() { + sc := -1 + if result.evl.Response.Response != nil { + sc = result.evl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionTypeVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.evl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure sending request") + return + } + + result.evl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.evl.hasNextLink() && result.evl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionTypeVersionsClient) ListPreparer(ctx context.Context, location string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions", 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 ExtensionTypeVersionsClient) 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 ExtensionTypeVersionsClient) ListResponder(resp *http.Response) (result ExtensionVersionList, 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 ExtensionTypeVersionsClient) listNextResults(ctx context.Context, lastResults ExtensionVersionList) (result ExtensionVersionList, err error) { + req, err := lastResults.extensionVersionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "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, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionTypeVersionsClient) ListComplete(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.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, location, extensionTypeName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go new file mode 100644 index 000000000000..052cdb848bea --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go @@ -0,0 +1,82 @@ +package kubernetesconfigurationapi + +// 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/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration" +) + +// ExtensionsClientAPI contains the set of methods on the ExtensionsClient type. +type ExtensionsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, extension kubernetesconfiguration.Extension) (result kubernetesconfiguration.ExtensionsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, forceDelete *bool) (result kubernetesconfiguration.ExtensionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string) (result kubernetesconfiguration.Extension, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.ExtensionsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.ExtensionsListIterator, err error) +} + +var _ ExtensionsClientAPI = (*kubernetesconfiguration.ExtensionsClient)(nil) + +// OperationStatusClientAPI contains the set of methods on the OperationStatusClient type. +type OperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.OperationStatusListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.OperationStatusListIterator, err error) +} + +var _ OperationStatusClientAPI = (*kubernetesconfiguration.OperationStatusClient)(nil) + +// ClusterExtensionTypeClientAPI contains the set of methods on the ClusterExtensionTypeClient type. +type ClusterExtensionTypeClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterType string, clusterName string, extensionTypeName string) (result kubernetesconfiguration.ExtensionType, err error) +} + +var _ ClusterExtensionTypeClientAPI = (*kubernetesconfiguration.ClusterExtensionTypeClient)(nil) + +// ClusterExtensionTypesClientAPI contains the set of methods on the ClusterExtensionTypesClient type. +type ClusterExtensionTypesClientAPI interface { + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterName string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterName string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ ClusterExtensionTypesClientAPI = (*kubernetesconfiguration.ClusterExtensionTypesClient)(nil) + +// ExtensionTypeVersionsClientAPI contains the set of methods on the ExtensionTypeVersionsClient type. +type ExtensionTypeVersionsClientAPI interface { + List(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListPage, err error) + ListComplete(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListIterator, err error) +} + +var _ ExtensionTypeVersionsClientAPI = (*kubernetesconfiguration.ExtensionTypeVersionsClient)(nil) + +// LocationExtensionTypesClientAPI contains the set of methods on the LocationExtensionTypesClient type. +type LocationExtensionTypesClientAPI interface { + List(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ LocationExtensionTypesClientAPI = (*kubernetesconfiguration.LocationExtensionTypesClient)(nil) + +// SourceControlConfigurationsClientAPI contains the set of methods on the SourceControlConfigurationsClient type. +type SourceControlConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration kubernetesconfiguration.SourceControlConfiguration) (result kubernetesconfiguration.SourceControlConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListIterator, err error) +} + +var _ SourceControlConfigurationsClientAPI = (*kubernetesconfiguration.SourceControlConfigurationsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListPage, err error) + ListComplete(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListIterator, err error) +} + +var _ OperationsClientAPI = (*kubernetesconfiguration.OperationsClient)(nil) diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/locationextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/locationextensiontypes.go new file mode 100644 index 000000000000..5727934ca363 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/locationextensiontypes.go @@ -0,0 +1,155 @@ +package kubernetesconfiguration + +// 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" +) + +// LocationExtensionTypesClient is the kubernetesConfiguration Client +type LocationExtensionTypesClient struct { + BaseClient +} + +// NewLocationExtensionTypesClient creates an instance of the LocationExtensionTypesClient client. +func NewLocationExtensionTypesClient(subscriptionID string) LocationExtensionTypesClient { + return NewLocationExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationExtensionTypesClientWithBaseURI creates an instance of the LocationExtensionTypesClient 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 NewLocationExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) LocationExtensionTypesClient { + return LocationExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all Extension Types +// Parameters: +// location - extension location +func (client LocationExtensionTypesClient) List(ctx context.Context, location string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.LocationExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LocationExtensionTypesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes", 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 LocationExtensionTypesClient) 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 LocationExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, 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 LocationExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "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, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocationExtensionTypesClient) ListComplete(ctx context.Context, location string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.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, location) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/models.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/models.go new file mode 100644 index 000000000000..c11f4c730ac6 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/models.go @@ -0,0 +1,2035 @@ +package kubernetesconfiguration + +// 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/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration" + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ClusterScopeSettings extension scope settings +type ClusterScopeSettings struct { + // ClusterScopeSettingsProperties - Extension scope settings + *ClusterScopeSettingsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterScopeSettings. +func (CSS ClusterScopeSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if CSS.ClusterScopeSettingsProperties != nil { + objectMap["properties"] = CSS.ClusterScopeSettingsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ClusterScopeSettings struct. +func (CSS *ClusterScopeSettings) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var clusterScopeSettingsProperties ClusterScopeSettingsProperties + err = json.Unmarshal(*v, &clusterScopeSettingsProperties) + if err != nil { + return err + } + CSS.ClusterScopeSettingsProperties = &clusterScopeSettingsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + CSS.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + CSS.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + CSS.Type = &typeVar + } + } + } + + return nil +} + +// ClusterScopeSettingsProperties extension scope settings +type ClusterScopeSettingsProperties struct { + // AllowMultipleInstances - Describes if multiple instances of the extension are allowed + AllowMultipleInstances *bool `json:"allowMultipleInstances,omitempty"` + // DefaultReleaseNamespace - Default extension release namespace + DefaultReleaseNamespace *string `json:"defaultReleaseNamespace,omitempty"` +} + +// ComplianceStatus compliance Status details +type ComplianceStatus struct { + // ComplianceState - READ-ONLY; The compliance state of the configuration. Possible values include: 'Pending', 'Compliant', 'Noncompliant', 'Installed', 'Failed' + ComplianceState ComplianceStateType `json:"complianceState,omitempty"` + // LastConfigApplied - Datetime the configuration was last applied. + LastConfigApplied *date.Time `json:"lastConfigApplied,omitempty"` + // Message - Message from when the configuration was applied. + Message *string `json:"message,omitempty"` + // MessageLevel - Level of the message. Possible values include: 'MessageLevelTypeError', 'MessageLevelTypeWarning', 'MessageLevelTypeInformation' + MessageLevel MessageLevelType `json:"messageLevel,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComplianceStatus. +func (cs ComplianceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.LastConfigApplied != nil { + objectMap["lastConfigApplied"] = cs.LastConfigApplied + } + if cs.Message != nil { + objectMap["message"] = cs.Message + } + if cs.MessageLevel != "" { + objectMap["messageLevel"] = cs.MessageLevel + } + return json.Marshal(objectMap) +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// Extension the Extension object. +type Extension struct { + autorest.Response `json:"-"` + // ExtensionProperties - Properties of an Extension resource + *ExtensionProperties `json:"properties,omitempty"` + // Identity - Identity of the Extension resource + Identity *Identity `json:"identity,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Extension. +func (e Extension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionProperties != nil { + objectMap["properties"] = e.ExtensionProperties + } + if e.Identity != nil { + objectMap["identity"] = e.Identity + } + if e.SystemData != nil { + objectMap["systemData"] = e.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Extension struct. +func (e *Extension) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var extensionProperties ExtensionProperties + err = json.Unmarshal(*v, &extensionProperties) + if err != nil { + return err + } + e.ExtensionProperties = &extensionProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + e.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + e.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + } + } + + return nil +} + +// ExtensionProperties properties of an Extension resource +type ExtensionProperties struct { + // ExtensionType - Type of the Extension, of which this resource is an instance of. It must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + ExtensionType *string `json:"extensionType,omitempty"` + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // Scope - Scope at which the extension is installed. + Scope *Scope `json:"scope,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // ProvisioningState - READ-ONLY; Status of installation of this extension. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Statuses - Status from this extension. + Statuses *[]ExtensionStatus `json:"statuses,omitempty"` + // ErrorInfo - READ-ONLY; Error information from the Agent - e.g. errors during installation. + ErrorInfo *ErrorDetail `json:"errorInfo,omitempty"` + // CustomLocationSettings - READ-ONLY; Custom Location settings properties. + CustomLocationSettings map[string]*string `json:"customLocationSettings"` + // PackageURI - READ-ONLY; Uri of the Helm package + PackageURI *string `json:"packageUri,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionProperties. +func (e ExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionType != nil { + objectMap["extensionType"] = e.ExtensionType + } + if e.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = e.AutoUpgradeMinorVersion + } + if e.ReleaseTrain != nil { + objectMap["releaseTrain"] = e.ReleaseTrain + } + if e.Version != nil { + objectMap["version"] = e.Version + } + if e.Scope != nil { + objectMap["scope"] = e.Scope + } + if e.ConfigurationSettings != nil { + objectMap["configurationSettings"] = e.ConfigurationSettings + } + if e.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = e.ConfigurationProtectedSettings + } + if e.Statuses != nil { + objectMap["statuses"] = e.Statuses + } + return json.Marshal(objectMap) +} + +// ExtensionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsCreateFuture) 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 ExtensionsCreateFuture.Result. +func (future *ExtensionsCreateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsDeleteFuture) 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 ExtensionsDeleteFuture.Result. +func (future *ExtensionsDeleteFuture) result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExtensionsList result of the request to list Extensions. It contains a list of Extension objects and a +// URL link to get the next set of results. +type ExtensionsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Extensions within a Kubernetes cluster. + Value *[]Extension `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of extension objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionsList. +func (el ExtensionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionsListIterator provides access to a complete listing of Extension values. +type ExtensionsListIterator struct { + i int + page ExtensionsListPage +} + +// 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 *ExtensionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListIterator.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 *ExtensionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionsListIterator) 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 ExtensionsListIterator) Response() ExtensionsList { + 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 ExtensionsListIterator) Value() Extension { + if !iter.page.NotDone() { + return Extension{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionsListIterator type. +func NewExtensionsListIterator(page ExtensionsListPage) ExtensionsListIterator { + return ExtensionsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (el ExtensionsList) IsEmpty() bool { + return el.Value == nil || len(*el.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (el ExtensionsList) hasNextLink() bool { + return el.NextLink != nil && len(*el.NextLink) != 0 +} + +// extensionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (el ExtensionsList) extensionsListPreparer(ctx context.Context) (*http.Request, error) { + if !el.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(el.NextLink))) +} + +// ExtensionsListPage contains a page of Extension values. +type ExtensionsListPage struct { + fn func(context.Context, ExtensionsList) (ExtensionsList, error) + el ExtensionsList +} + +// 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 *ExtensionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListPage.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.el) + if err != nil { + return err + } + page.el = 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 *ExtensionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionsListPage) NotDone() bool { + return !page.el.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionsListPage) Response() ExtensionsList { + return page.el +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionsListPage) Values() []Extension { + if page.el.IsEmpty() { + return nil + } + return *page.el.Value +} + +// Creates a new instance of the ExtensionsListPage type. +func NewExtensionsListPage(cur ExtensionsList, getNextPage func(context.Context, ExtensionsList) (ExtensionsList, error)) ExtensionsListPage { + return ExtensionsListPage{ + fn: getNextPage, + el: cur, + } +} + +// ExtensionStatus status from the extension. +type ExtensionStatus struct { + // Code - Status code provided by the Extension + Code *string `json:"code,omitempty"` + // DisplayStatus - Short description of status of the extension. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Level - Level of the status. Possible values include: 'Error', 'Warning', 'Information' + Level LevelType `json:"level,omitempty"` + // Message - Detailed message of the status from the Extension. + Message *string `json:"message,omitempty"` + // Time - DateLiteral (per ISO8601) noting the time of installation status. + Time *string `json:"time,omitempty"` +} + +// ExtensionType represents an Extension Type. +type ExtensionType struct { + autorest.Response `json:"-"` + // ExtensionTypeProperties - Describes the Resource Type properties. + *ExtensionTypeProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionType. +func (et ExtensionType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if et.ExtensionTypeProperties != nil { + objectMap["properties"] = et.ExtensionTypeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExtensionType struct. +func (et *ExtensionType) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var extensionTypeProperties ExtensionTypeProperties + err = json.Unmarshal(*v, &extensionTypeProperties) + if err != nil { + return err + } + et.ExtensionTypeProperties = &extensionTypeProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + et.SystemData = &systemData + } + } + } + + return nil +} + +// ExtensionTypeList list Extension Types +type ExtensionTypeList struct { + autorest.Response `json:"-"` + // Value - The list of Extension Types + Value *[]ExtensionType `json:"value,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` +} + +// ExtensionTypeListIterator provides access to a complete listing of ExtensionType values. +type ExtensionTypeListIterator struct { + i int + page ExtensionTypeListPage +} + +// 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 *ExtensionTypeListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListIterator.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 *ExtensionTypeListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionTypeListIterator) 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 ExtensionTypeListIterator) Response() ExtensionTypeList { + 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 ExtensionTypeListIterator) Value() ExtensionType { + if !iter.page.NotDone() { + return ExtensionType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionTypeListIterator type. +func NewExtensionTypeListIterator(page ExtensionTypeListPage) ExtensionTypeListIterator { + return ExtensionTypeListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (etl ExtensionTypeList) IsEmpty() bool { + return etl.Value == nil || len(*etl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (etl ExtensionTypeList) hasNextLink() bool { + return etl.NextLink != nil && len(*etl.NextLink) != 0 +} + +// extensionTypeListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (etl ExtensionTypeList) extensionTypeListPreparer(ctx context.Context) (*http.Request, error) { + if !etl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(etl.NextLink))) +} + +// ExtensionTypeListPage contains a page of ExtensionType values. +type ExtensionTypeListPage struct { + fn func(context.Context, ExtensionTypeList) (ExtensionTypeList, error) + etl ExtensionTypeList +} + +// 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 *ExtensionTypeListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListPage.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.etl) + if err != nil { + return err + } + page.etl = 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 *ExtensionTypeListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionTypeListPage) NotDone() bool { + return !page.etl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionTypeListPage) Response() ExtensionTypeList { + return page.etl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionTypeListPage) Values() []ExtensionType { + if page.etl.IsEmpty() { + return nil + } + return *page.etl.Value +} + +// Creates a new instance of the ExtensionTypeListPage type. +func NewExtensionTypeListPage(cur ExtensionTypeList, getNextPage func(context.Context, ExtensionTypeList) (ExtensionTypeList, error)) ExtensionTypeListPage { + return ExtensionTypeListPage{ + fn: getNextPage, + etl: cur, + } +} + +// ExtensionTypeProperties properties of the connected cluster. +type ExtensionTypeProperties struct { + // ReleaseTrains - READ-ONLY; Extension release train: preview or stable + ReleaseTrains *[]string `json:"releaseTrains,omitempty"` + // ClusterTypes - READ-ONLY; Cluster types. Possible values include: 'ConnectedClusters', 'ManagedClusters' + ClusterTypes ClusterTypes `json:"clusterTypes,omitempty"` + // SupportedScopes - READ-ONLY; Extension scopes + SupportedScopes *SupportedScopes `json:"supportedScopes,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionTypeProperties. +func (etp ExtensionTypeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionVersionList list versions for an Extension +type ExtensionVersionList struct { + autorest.Response `json:"-"` + // Versions - Versions available for this Extension Type + Versions *[]ExtensionVersionListVersionsItem `json:"versions,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionVersionList. +func (evl ExtensionVersionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if evl.Versions != nil { + objectMap["versions"] = evl.Versions + } + if evl.NextLink != nil { + objectMap["nextLink"] = evl.NextLink + } + return json.Marshal(objectMap) +} + +// ExtensionVersionListIterator provides access to a complete listing of ExtensionVersionListVersionsItem +// values. +type ExtensionVersionListIterator struct { + i int + page ExtensionVersionListPage +} + +// 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 *ExtensionVersionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListIterator.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 *ExtensionVersionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionVersionListIterator) 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 ExtensionVersionListIterator) Response() ExtensionVersionList { + 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 ExtensionVersionListIterator) Value() ExtensionVersionListVersionsItem { + if !iter.page.NotDone() { + return ExtensionVersionListVersionsItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionVersionListIterator type. +func NewExtensionVersionListIterator(page ExtensionVersionListPage) ExtensionVersionListIterator { + return ExtensionVersionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (evl ExtensionVersionList) IsEmpty() bool { + return evl.Versions == nil || len(*evl.Versions) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (evl ExtensionVersionList) hasNextLink() bool { + return evl.NextLink != nil && len(*evl.NextLink) != 0 +} + +// extensionVersionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (evl ExtensionVersionList) extensionVersionListPreparer(ctx context.Context) (*http.Request, error) { + if !evl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(evl.NextLink))) +} + +// ExtensionVersionListPage contains a page of ExtensionVersionListVersionsItem values. +type ExtensionVersionListPage struct { + fn func(context.Context, ExtensionVersionList) (ExtensionVersionList, error) + evl ExtensionVersionList +} + +// 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 *ExtensionVersionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListPage.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.evl) + if err != nil { + return err + } + page.evl = 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 *ExtensionVersionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionVersionListPage) NotDone() bool { + return !page.evl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionVersionListPage) Response() ExtensionVersionList { + return page.evl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionVersionListPage) Values() []ExtensionVersionListVersionsItem { + if page.evl.IsEmpty() { + return nil + } + return *page.evl.Versions +} + +// Creates a new instance of the ExtensionVersionListPage type. +func NewExtensionVersionListPage(cur ExtensionVersionList, getNextPage func(context.Context, ExtensionVersionList) (ExtensionVersionList, error)) ExtensionVersionListPage { + return ExtensionVersionListPage{ + fn: getNextPage, + evl: cur, + } +} + +// ExtensionVersionListVersionsItem ... +type ExtensionVersionListVersionsItem struct { + // ReleaseTrain - The release train for this Extension Type + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Versions - Versions available for this Extension Type and release train + Versions *[]string `json:"versions,omitempty"` +} + +// HelmOperatorProperties properties for Helm operator. +type HelmOperatorProperties struct { + // ChartVersion - Version of the operator Helm chart. + ChartVersion *string `json:"chartVersion,omitempty"` + // ChartValues - Values override for the operator Helm chart. + ChartValues *string `json:"chartValues,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + +// OperationStatusList the async operations in progress, in the cluster. +type OperationStatusList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of async operations in progress, in the cluster. + Value *[]OperationStatusResult `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of Operation Result objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusList. +func (osl OperationStatusList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationStatusListIterator provides access to a complete listing of OperationStatusResult values. +type OperationStatusListIterator struct { + i int + page OperationStatusListPage +} + +// 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 *OperationStatusListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListIterator.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 *OperationStatusListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationStatusListIterator) 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 OperationStatusListIterator) Response() OperationStatusList { + 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 OperationStatusListIterator) Value() OperationStatusResult { + if !iter.page.NotDone() { + return OperationStatusResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationStatusListIterator type. +func NewOperationStatusListIterator(page OperationStatusListPage) OperationStatusListIterator { + return OperationStatusListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (osl OperationStatusList) IsEmpty() bool { + return osl.Value == nil || len(*osl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (osl OperationStatusList) hasNextLink() bool { + return osl.NextLink != nil && len(*osl.NextLink) != 0 +} + +// operationStatusListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (osl OperationStatusList) operationStatusListPreparer(ctx context.Context) (*http.Request, error) { + if !osl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(osl.NextLink))) +} + +// OperationStatusListPage contains a page of OperationStatusResult values. +type OperationStatusListPage struct { + fn func(context.Context, OperationStatusList) (OperationStatusList, error) + osl OperationStatusList +} + +// 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 *OperationStatusListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListPage.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.osl) + if err != nil { + return err + } + page.osl = 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 *OperationStatusListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationStatusListPage) NotDone() bool { + return !page.osl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationStatusListPage) Response() OperationStatusList { + return page.osl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationStatusListPage) Values() []OperationStatusResult { + if page.osl.IsEmpty() { + return nil + } + return *page.osl.Value +} + +// Creates a new instance of the OperationStatusListPage type. +func NewOperationStatusListPage(cur OperationStatusList, getNextPage func(context.Context, OperationStatusList) (OperationStatusList, error)) OperationStatusListPage { + return OperationStatusListPage{ + fn: getNextPage, + osl: cur, + } +} + +// OperationStatusResult the current status of an async operation. +type OperationStatusResult struct { + autorest.Response `json:"-"` + // ID - Fully qualified ID for the async operation. + ID *string `json:"id,omitempty"` + // Name - Name of the async operation. + Name *string `json:"name,omitempty"` + // Status - Operation status. + Status *string `json:"status,omitempty"` + // Properties - Additional information, if available. + Properties map[string]*string `json:"properties"` + // Error - READ-ONLY; If present, details of the operation error. + Error *ErrorDetail `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusResult. +func (osr OperationStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if osr.ID != nil { + objectMap["id"] = osr.ID + } + if osr.Name != nil { + objectMap["name"] = osr.Name + } + if osr.Status != nil { + objectMap["status"] = osr.Status + } + if osr.Properties != nil { + objectMap["properties"] = osr.Properties + } + return json.Marshal(objectMap) +} + +// Plan plan for the resource. +type Plan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed +// properties for a resource. Except properties bag, there cannot be a top level property outside of this +// set. +type ResourceModelWithAllowedPropertySet struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + ManagedBy *string `json:"managedBy,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` + Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. +func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Location != nil { + objectMap["location"] = rmwaps.Location + } + if rmwaps.ManagedBy != nil { + objectMap["managedBy"] = rmwaps.ManagedBy + } + if rmwaps.Kind != nil { + objectMap["kind"] = rmwaps.Kind + } + if rmwaps.Tags != nil { + objectMap["tags"] = rmwaps.Tags + } + if rmwaps.Identity != nil { + objectMap["identity"] = rmwaps.Identity + } + if rmwaps.Sku != nil { + objectMap["sku"] = rmwaps.Sku + } + if rmwaps.Plan != nil { + objectMap["plan"] = rmwaps.Plan + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetIdentity ... +type ResourceModelWithAllowedPropertySetIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. +func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Type != "" { + objectMap["type"] = rmwaps.Type + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetPlan ... +type ResourceModelWithAllowedPropertySetPlan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ResourceModelWithAllowedPropertySetSku ... +type ResourceModelWithAllowedPropertySetSku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// ResourceProviderOperation supported operation of this resource provider. +type ResourceProviderOperation struct { + // Name - Operation name, in format of {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *ResourceProviderOperationDisplay `json:"display,omitempty"` + // Origin - The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX + Origin *string `json:"origin,omitempty"` + // IsDataAction - READ-ONLY; The flag that indicates whether the operation applies to data plane. + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperation. +func (rpo ResourceProviderOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpo.Name != nil { + objectMap["name"] = rpo.Name + } + if rpo.Display != nil { + objectMap["display"] = rpo.Display + } + if rpo.Origin != nil { + objectMap["origin"] = rpo.Origin + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationDisplay display metadata associated with the operation. +type ResourceProviderOperationDisplay struct { + // Provider - Resource provider: Microsoft KubernetesConfiguration. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of this operation. + Description *string `json:"description,omitempty"` +} + +// ResourceProviderOperationList result of the request to list operations. +type ResourceProviderOperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by this resource provider. + Value *[]ResourceProviderOperation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperationList. +func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpol.Value != nil { + objectMap["value"] = rpol.Value + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation +// values. +type ResourceProviderOperationListIterator struct { + i int + page ResourceProviderOperationListPage +} + +// 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 *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.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 *ResourceProviderOperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceProviderOperationListIterator) 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 ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { + 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 ResourceProviderOperationListIterator) Value() ResourceProviderOperation { + if !iter.page.NotDone() { + return ResourceProviderOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceProviderOperationListIterator type. +func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { + return ResourceProviderOperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rpol ResourceProviderOperationList) IsEmpty() bool { + return rpol.Value == nil || len(*rpol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rpol ResourceProviderOperationList) hasNextLink() bool { + return rpol.NextLink != nil && len(*rpol.NextLink) != 0 +} + +// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { + if !rpol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rpol.NextLink))) +} + +// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. +type ResourceProviderOperationListPage struct { + fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) + rpol ResourceProviderOperationList +} + +// 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 *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.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.rpol) + if err != nil { + return err + } + page.rpol = 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 *ResourceProviderOperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceProviderOperationListPage) NotDone() bool { + return !page.rpol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { + return page.rpol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { + if page.rpol.IsEmpty() { + return nil + } + return *page.rpol.Value +} + +// Creates a new instance of the ResourceProviderOperationListPage type. +func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { + return ResourceProviderOperationListPage{ + fn: getNextPage, + rpol: cur, + } +} + +// Scope scope of the extension. It can be either Cluster or Namespace; but not both. +type Scope struct { + // Cluster - Specifies that the scope of the extension is Cluster + Cluster *ScopeCluster `json:"cluster,omitempty"` + // Namespace - Specifies that the scope of the extension is Namespace + Namespace *ScopeNamespace `json:"namespace,omitempty"` +} + +// ScopeCluster specifies that the scope of the extension is Cluster +type ScopeCluster struct { + // ReleaseNamespace - Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created + ReleaseNamespace *string `json:"releaseNamespace,omitempty"` +} + +// ScopeNamespace specifies that the scope of the extension is Namespace +type ScopeNamespace struct { + // TargetNamespace - Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +// Sku the resource model definition representing SKU +type Sku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// SourceControlConfiguration the SourceControl Configuration object returned in Get & Put response. +type SourceControlConfiguration struct { + autorest.Response `json:"-"` + // SourceControlConfigurationProperties - Properties to create a Source Control Configuration resource + *SourceControlConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfiguration. +func (scc SourceControlConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.SourceControlConfigurationProperties != nil { + objectMap["properties"] = scc.SourceControlConfigurationProperties + } + if scc.SystemData != nil { + objectMap["systemData"] = scc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SourceControlConfiguration struct. +func (scc *SourceControlConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sourceControlConfigurationProperties SourceControlConfigurationProperties + err = json.Unmarshal(*v, &sourceControlConfigurationProperties) + if err != nil { + return err + } + scc.SourceControlConfigurationProperties = &sourceControlConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + scc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scc.Type = &typeVar + } + } + } + + return nil +} + +// SourceControlConfigurationList result of the request to list Source Control Configurations. It contains +// a list of SourceControlConfiguration objects and a URL link to get the next set of results. +type SourceControlConfigurationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Source Control Configurations within a Kubernetes cluster. + Value *[]SourceControlConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationList. +func (sccl SourceControlConfigurationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SourceControlConfigurationListIterator provides access to a complete listing of +// SourceControlConfiguration values. +type SourceControlConfigurationListIterator struct { + i int + page SourceControlConfigurationListPage +} + +// 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 *SourceControlConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListIterator.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 *SourceControlConfigurationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SourceControlConfigurationListIterator) 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 SourceControlConfigurationListIterator) Response() SourceControlConfigurationList { + 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 SourceControlConfigurationListIterator) Value() SourceControlConfiguration { + if !iter.page.NotDone() { + return SourceControlConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SourceControlConfigurationListIterator type. +func NewSourceControlConfigurationListIterator(page SourceControlConfigurationListPage) SourceControlConfigurationListIterator { + return SourceControlConfigurationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sccl SourceControlConfigurationList) IsEmpty() bool { + return sccl.Value == nil || len(*sccl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sccl SourceControlConfigurationList) hasNextLink() bool { + return sccl.NextLink != nil && len(*sccl.NextLink) != 0 +} + +// sourceControlConfigurationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sccl SourceControlConfigurationList) sourceControlConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if !sccl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sccl.NextLink))) +} + +// SourceControlConfigurationListPage contains a page of SourceControlConfiguration values. +type SourceControlConfigurationListPage struct { + fn func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error) + sccl SourceControlConfigurationList +} + +// 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 *SourceControlConfigurationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListPage.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.sccl) + if err != nil { + return err + } + page.sccl = 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 *SourceControlConfigurationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SourceControlConfigurationListPage) NotDone() bool { + return !page.sccl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SourceControlConfigurationListPage) Response() SourceControlConfigurationList { + return page.sccl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SourceControlConfigurationListPage) Values() []SourceControlConfiguration { + if page.sccl.IsEmpty() { + return nil + } + return *page.sccl.Value +} + +// Creates a new instance of the SourceControlConfigurationListPage type. +func NewSourceControlConfigurationListPage(cur SourceControlConfigurationList, getNextPage func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error)) SourceControlConfigurationListPage { + return SourceControlConfigurationListPage{ + fn: getNextPage, + sccl: cur, + } +} + +// SourceControlConfigurationProperties properties to create a Source Control Configuration resource +type SourceControlConfigurationProperties struct { + // RepositoryURL - Url of the SourceControl Repository. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // OperatorNamespace - The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + OperatorNamespace *string `json:"operatorNamespace,omitempty"` + // OperatorInstanceName - Instance name of the operator - identifying the specific configuration. + OperatorInstanceName *string `json:"operatorInstanceName,omitempty"` + // OperatorType - Type of the operator. Possible values include: 'Flux' + OperatorType OperatorType `json:"operatorType,omitempty"` + // OperatorParams - Any Parameters for the Operator instance in string format. + OperatorParams *string `json:"operatorParams,omitempty"` + // ConfigurationProtectedSettings - Name-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // OperatorScope - Scope at which the operator will be installed. Possible values include: 'Cluster', 'Namespace' + OperatorScope OperatorScopeType `json:"operatorScope,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // SSHKnownHostsContents - Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances + SSHKnownHostsContents *string `json:"sshKnownHostsContents,omitempty"` + // EnableHelmOperator - Option to enable Helm Operator for this git configuration. + EnableHelmOperator *bool `json:"enableHelmOperator,omitempty"` + // HelmOperatorProperties - Properties for Helm operator. + HelmOperatorProperties *HelmOperatorProperties `json:"helmOperatorProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource provider. Possible values include: 'ProvisioningStateTypeAccepted', 'ProvisioningStateTypeDeleting', 'ProvisioningStateTypeRunning', 'ProvisioningStateTypeSucceeded', 'ProvisioningStateTypeFailed' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // ComplianceStatus - READ-ONLY; Compliance Status of the Configuration + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationProperties. +func (scc SourceControlConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.RepositoryURL != nil { + objectMap["repositoryUrl"] = scc.RepositoryURL + } + if scc.OperatorNamespace != nil { + objectMap["operatorNamespace"] = scc.OperatorNamespace + } + if scc.OperatorInstanceName != nil { + objectMap["operatorInstanceName"] = scc.OperatorInstanceName + } + if scc.OperatorType != "" { + objectMap["operatorType"] = scc.OperatorType + } + if scc.OperatorParams != nil { + objectMap["operatorParams"] = scc.OperatorParams + } + if scc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = scc.ConfigurationProtectedSettings + } + if scc.OperatorScope != "" { + objectMap["operatorScope"] = scc.OperatorScope + } + if scc.SSHKnownHostsContents != nil { + objectMap["sshKnownHostsContents"] = scc.SSHKnownHostsContents + } + if scc.EnableHelmOperator != nil { + objectMap["enableHelmOperator"] = scc.EnableHelmOperator + } + if scc.HelmOperatorProperties != nil { + objectMap["helmOperatorProperties"] = scc.HelmOperatorProperties + } + return json.Marshal(objectMap) +} + +// SourceControlConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SourceControlConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SourceControlConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SourceControlConfigurationsDeleteFuture) 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 SourceControlConfigurationsDeleteFuture.Result. +func (future *SourceControlConfigurationsDeleteFuture) result(client SourceControlConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.SourceControlConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SupportedScopes extension scopes +type SupportedScopes struct { + // DefaultScope - Default extension scopes: cluster or namespace + DefaultScope *string `json:"defaultScope,omitempty"` + // ClusterScopeSettings - Scope settings + ClusterScopeSettings *ClusterScopeSettings `json:"clusterScopeSettings,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/operations.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/operations.go new file mode 100644 index 000000000000..e79b50bd5491 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/operations.go @@ -0,0 +1,140 @@ +package kubernetesconfiguration + +// 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 kubernetesConfiguration Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all the available operations the KubernetesConfiguration resource provider supports. +func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.rpol.Response.Response != nil { + sc = result.rpol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rpol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.rpol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.rpol.hasNextLink() && result.rpol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.KubernetesConfiguration/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 ResourceProviderOperationList, 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 ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { + req, err := lastResults.resourceProviderOperationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.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, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.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 ResourceProviderOperationListIterator, 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/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/operationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/operationstatus.go new file mode 100644 index 000000000000..de57f7009936 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/operationstatus.go @@ -0,0 +1,260 @@ +package kubernetesconfiguration + +// 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" +) + +// OperationStatusClient is the kubernetesConfiguration Client +type OperationStatusClient struct { + BaseClient +} + +// NewOperationStatusClient creates an instance of the OperationStatusClient client. +func NewOperationStatusClient(subscriptionID string) OperationStatusClient { + return NewOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationStatusClientWithBaseURI creates an instance of the OperationStatusClient 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 NewOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) OperationStatusClient { + return OperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// operationID - operation Id +func (client OperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.OperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}", 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 OperationStatusClient) 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 OperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list Async Operations, currently in progress, in a cluster +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client OperationStatusClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result OperationStatusListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.List") + defer func() { + sc := -1 + if result.osl.Response.Response != nil { + sc = result.osl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.OperationStatusClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.osl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure sending request") + return + } + + result.osl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure responding to request") + return + } + if result.osl.hasNextLink() && result.osl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations", 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 OperationStatusClient) 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 OperationStatusClient) ListResponder(resp *http.Response) (result OperationStatusList, 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 OperationStatusClient) listNextResults(ctx context.Context, lastResults OperationStatusList) (result OperationStatusList, err error) { + req, err := lastResults.operationStatusListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "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, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationStatusClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result OperationStatusListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go new file mode 100644 index 000000000000..9fd3cd07d368 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -0,0 +1,451 @@ +package kubernetesconfiguration + +// 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" +) + +// SourceControlConfigurationsClient is the kubernetesConfiguration Client +type SourceControlConfigurationsClient struct { + BaseClient +} + +// NewSourceControlConfigurationsClient creates an instance of the SourceControlConfigurationsClient client. +func NewSourceControlConfigurationsClient(subscriptionID string) SourceControlConfigurationsClient { + return NewSourceControlConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSourceControlConfigurationsClientWithBaseURI creates an instance of the SourceControlConfigurationsClient 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 NewSourceControlConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlConfigurationsClient { + return SourceControlConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +// sourceControlConfiguration - properties necessary to Create KubernetesConfiguration. +func (client SourceControlConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, sourceControlConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SourceControlConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", pathParameters), + autorest.WithJSON(sourceControlConfiguration), + 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 SourceControlConfigurationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result SourceControlConfiguration, 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 this will delete the YAML file used to set up the Source control configuration, thus stopping future sync +// from the source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result SourceControlConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SourceControlConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) DeleteSender(req *http.Request) (future SourceControlConfigurationsDeleteFuture, 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 SourceControlConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details of the Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SourceControlConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) GetResponder(resp *http.Response) (result SourceControlConfiguration, 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 Source Control Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client SourceControlConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result SourceControlConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.sccl.Response.Response != nil { + sc = result.sccl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sccl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.sccl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.sccl.hasNextLink() && result.sccl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SourceControlConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) ListResponder(resp *http.Response) (result SourceControlConfigurationList, 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 SourceControlConfigurationsClient) listNextResults(ctx context.Context, lastResults SourceControlConfigurationList) (result SourceControlConfigurationList, err error) { + req, err := lastResults.sourceControlConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "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, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SourceControlConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result SourceControlConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/version.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/version.go new file mode 100644 index 000000000000..7d381549193a --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/version.go @@ -0,0 +1,19 @@ +package kubernetesconfiguration + +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() + " kubernetesconfiguration/2021-05-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/_meta.json new file mode 100644 index 000000000000..15dda325cfa7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "62dc7865a18791290f282ed54bcb1d4b1517af16", + "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "tag": "package-preview-2021-11", + "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-2021-11 --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/kubernetesconfiguration/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/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/client.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/client.go new file mode 100644 index 000000000000..592bb0bf891d --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/client.go @@ -0,0 +1,42 @@ +// Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version +// 2021-11-01-preview. +// +// KubernetesConfiguration Client +package kubernetesconfiguration + +// 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 Kubernetesconfiguration + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Kubernetesconfiguration. +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/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/clusterextensiontype.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/clusterextensiontype.go new file mode 100644 index 000000000000..6d8ce1e9fbff --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/clusterextensiontype.go @@ -0,0 +1,126 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypeClient is the kubernetesConfiguration Client +type ClusterExtensionTypeClient struct { + BaseClient +} + +// NewClusterExtensionTypeClient creates an instance of the ClusterExtensionTypeClient client. +func NewClusterExtensionTypeClient(subscriptionID string) ClusterExtensionTypeClient { + return NewClusterExtensionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypeClientWithBaseURI creates an instance of the ClusterExtensionTypeClient 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 NewClusterExtensionTypeClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypeClient { + return ClusterExtensionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Extension Type details +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionTypeName - extension type name +func (client ClusterExtensionTypeClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionTypeName string) (result ExtensionType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypeClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ClusterExtensionTypeClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClusterExtensionTypeClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}", 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 ClusterExtensionTypeClient) 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 ClusterExtensionTypeClient) GetResponder(resp *http.Response) (result ExtensionType, 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/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/clusterextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/clusterextensiontypes.go new file mode 100644 index 000000000000..cf1e19d26bab --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/clusterextensiontypes.go @@ -0,0 +1,166 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypesClient is the kubernetesConfiguration Client +type ClusterExtensionTypesClient struct { + BaseClient +} + +// NewClusterExtensionTypesClient creates an instance of the ClusterExtensionTypesClient client. +func NewClusterExtensionTypesClient(subscriptionID string) ClusterExtensionTypesClient { + return NewClusterExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypesClientWithBaseURI creates an instance of the ClusterExtensionTypesClient 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 NewClusterExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypesClient { + return ClusterExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get Extension Types +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ClusterExtensionTypesClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ClusterExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ClusterExtensionTypesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes", 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 ClusterExtensionTypesClient) 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 ClusterExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, 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 ClusterExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "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, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClusterExtensionTypesClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/enums.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/enums.go new file mode 100644 index 000000000000..798e61694f5c --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/enums.go @@ -0,0 +1,266 @@ +package kubernetesconfiguration + +// 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. + +// ClusterTypes enumerates the values for cluster types. +type ClusterTypes string + +const ( + // ConnectedClusters ... + ConnectedClusters ClusterTypes = "connectedClusters" + // ManagedClusters ... + ManagedClusters ClusterTypes = "managedClusters" +) + +// PossibleClusterTypesValues returns an array of possible values for the ClusterTypes const type. +func PossibleClusterTypesValues() []ClusterTypes { + return []ClusterTypes{ConnectedClusters, ManagedClusters} +} + +// ComplianceStateType enumerates the values for compliance state type. +type ComplianceStateType string + +const ( + // Compliant ... + Compliant ComplianceStateType = "Compliant" + // Failed ... + Failed ComplianceStateType = "Failed" + // Installed ... + Installed ComplianceStateType = "Installed" + // Noncompliant ... + Noncompliant ComplianceStateType = "Noncompliant" + // Pending ... + Pending ComplianceStateType = "Pending" +) + +// PossibleComplianceStateTypeValues returns an array of possible values for the ComplianceStateType const type. +func PossibleComplianceStateTypeValues() []ComplianceStateType { + return []ComplianceStateType{Compliant, Failed, Installed, Noncompliant, Pending} +} + +// 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} +} + +// FluxComplianceState enumerates the values for flux compliance state. +type FluxComplianceState string + +const ( + // FluxComplianceStateCompliant ... + FluxComplianceStateCompliant FluxComplianceState = "Compliant" + // FluxComplianceStateNonCompliant ... + FluxComplianceStateNonCompliant FluxComplianceState = "Non-Compliant" + // FluxComplianceStatePending ... + FluxComplianceStatePending FluxComplianceState = "Pending" + // FluxComplianceStateSuspended ... + FluxComplianceStateSuspended FluxComplianceState = "Suspended" + // FluxComplianceStateUnknown ... + FluxComplianceStateUnknown FluxComplianceState = "Unknown" +) + +// PossibleFluxComplianceStateValues returns an array of possible values for the FluxComplianceState const type. +func PossibleFluxComplianceStateValues() []FluxComplianceState { + return []FluxComplianceState{FluxComplianceStateCompliant, FluxComplianceStateNonCompliant, FluxComplianceStatePending, FluxComplianceStateSuspended, FluxComplianceStateUnknown} +} + +// KustomizationValidationType enumerates the values for kustomization validation type. +type KustomizationValidationType string + +const ( + // Client ... + Client KustomizationValidationType = "client" + // None ... + None KustomizationValidationType = "none" + // Server ... + Server KustomizationValidationType = "server" +) + +// PossibleKustomizationValidationTypeValues returns an array of possible values for the KustomizationValidationType const type. +func PossibleKustomizationValidationTypeValues() []KustomizationValidationType { + return []KustomizationValidationType{Client, None, Server} +} + +// LevelType enumerates the values for level type. +type LevelType string + +const ( + // Error ... + Error LevelType = "Error" + // Information ... + Information LevelType = "Information" + // Warning ... + Warning LevelType = "Warning" +) + +// PossibleLevelTypeValues returns an array of possible values for the LevelType const type. +func PossibleLevelTypeValues() []LevelType { + return []LevelType{Error, Information, Warning} +} + +// MessageLevelType enumerates the values for message level type. +type MessageLevelType string + +const ( + // MessageLevelTypeError ... + MessageLevelTypeError MessageLevelType = "Error" + // MessageLevelTypeInformation ... + MessageLevelTypeInformation MessageLevelType = "Information" + // MessageLevelTypeWarning ... + MessageLevelTypeWarning MessageLevelType = "Warning" +) + +// PossibleMessageLevelTypeValues returns an array of possible values for the MessageLevelType const type. +func PossibleMessageLevelTypeValues() []MessageLevelType { + return []MessageLevelType{MessageLevelTypeError, MessageLevelTypeInformation, MessageLevelTypeWarning} +} + +// OperatorScopeType enumerates the values for operator scope type. +type OperatorScopeType string + +const ( + // Cluster ... + Cluster OperatorScopeType = "cluster" + // Namespace ... + Namespace OperatorScopeType = "namespace" +) + +// PossibleOperatorScopeTypeValues returns an array of possible values for the OperatorScopeType const type. +func PossibleOperatorScopeTypeValues() []OperatorScopeType { + return []OperatorScopeType{Cluster, Namespace} +} + +// OperatorType enumerates the values for operator type. +type OperatorType string + +const ( + // Flux ... + Flux OperatorType = "Flux" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{Flux} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ProvisioningStateType enumerates the values for provisioning state type. +type ProvisioningStateType string + +const ( + // ProvisioningStateTypeAccepted ... + ProvisioningStateTypeAccepted ProvisioningStateType = "Accepted" + // ProvisioningStateTypeDeleting ... + ProvisioningStateTypeDeleting ProvisioningStateType = "Deleting" + // ProvisioningStateTypeFailed ... + ProvisioningStateTypeFailed ProvisioningStateType = "Failed" + // ProvisioningStateTypeRunning ... + ProvisioningStateTypeRunning ProvisioningStateType = "Running" + // ProvisioningStateTypeSucceeded ... + ProvisioningStateTypeSucceeded ProvisioningStateType = "Succeeded" +) + +// PossibleProvisioningStateTypeValues returns an array of possible values for the ProvisioningStateType const type. +func PossibleProvisioningStateTypeValues() []ProvisioningStateType { + return []ProvisioningStateType{ProvisioningStateTypeAccepted, ProvisioningStateTypeDeleting, ProvisioningStateTypeFailed, ProvisioningStateTypeRunning, ProvisioningStateTypeSucceeded} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{SystemAssigned} +} + +// ScopeType enumerates the values for scope type. +type ScopeType string + +const ( + // ScopeTypeCluster ... + ScopeTypeCluster ScopeType = "cluster" + // ScopeTypeNamespace ... + ScopeTypeNamespace ScopeType = "namespace" +) + +// PossibleScopeTypeValues returns an array of possible values for the ScopeType const type. +func PossibleScopeTypeValues() []ScopeType { + return []ScopeType{ScopeTypeCluster, ScopeTypeNamespace} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic ... + Basic SkuTier = "Basic" + // Free ... + Free SkuTier = "Free" + // Premium ... + Premium SkuTier = "Premium" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Basic, Free, Premium, Standard} +} + +// SourceKindType enumerates the values for source kind type. +type SourceKindType string + +const ( + // GitRepository ... + GitRepository SourceKindType = "GitRepository" +) + +// PossibleSourceKindTypeValues returns an array of possible values for the SourceKindType const type. +func PossibleSourceKindTypeValues() []SourceKindType { + return []SourceKindType{GitRepository} +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/extensions.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/extensions.go new file mode 100644 index 000000000000..2513b1b57b5d --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/extensions.go @@ -0,0 +1,555 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionsClient is the kubernetesConfiguration Client +type ExtensionsClient struct { + BaseClient +} + +// NewExtensionsClient creates an instance of the ExtensionsClient client. +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient 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 NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a new Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// extension - properties necessary to Create an Extension. +func (client ExtensionsClient) Create(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, extension Extension) (result ExtensionsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExtensionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, extension Extension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(extension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) CreateSender(req *http.Request) (future ExtensionsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) CreateResponder(resp *http.Response) (result Extension, 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 Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, forceDelete *bool) (result ExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) DeleteSender(req *http.Request) (future ExtensionsDeleteFuture, 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 ExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string) (result Extension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) 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 ExtensionsClient) GetResponder(resp *http.Response) (result Extension, 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 Extensions in the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ExtensionsClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result ExtensionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.List") + defer func() { + sc := -1 + if result.el.Response.Response != nil { + sc = result.el.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.el.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure sending request") + return + } + + result.el, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure responding to request") + return + } + if result.el.hasNextLink() && result.el.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions", 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 ExtensionsClient) 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 ExtensionsClient) ListResponder(resp *http.Response) (result ExtensionsList, 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 ExtensionsClient) listNextResults(ctx context.Context, lastResults ExtensionsList) (result ExtensionsList, err error) { + req, err := lastResults.extensionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "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, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result ExtensionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.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, clusterRp, clusterResourceName, clusterName) + return +} + +// Update patch an existing Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// patchExtension - properties to Patch in an existing Extension. +func (client ExtensionsClient) Update(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, patchExtension PatchExtension) (result ExtensionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, patchExtension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, patchExtension PatchExtension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(patchExtension), + 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 ExtensionsClient) UpdateSender(req *http.Request) (future ExtensionsUpdateFuture, 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 ExtensionsClient) UpdateResponder(resp *http.Response) (result Extension, 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/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/extensiontypeversions.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/extensiontypeversions.go new file mode 100644 index 000000000000..f454b284d3ad --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/extensiontypeversions.go @@ -0,0 +1,157 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionTypeVersionsClient is the kubernetesConfiguration Client +type ExtensionTypeVersionsClient struct { + BaseClient +} + +// NewExtensionTypeVersionsClient creates an instance of the ExtensionTypeVersionsClient client. +func NewExtensionTypeVersionsClient(subscriptionID string) ExtensionTypeVersionsClient { + return NewExtensionTypeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionTypeVersionsClientWithBaseURI creates an instance of the ExtensionTypeVersionsClient 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 NewExtensionTypeVersionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTypeVersionsClient { + return ExtensionTypeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list available versions for an Extension Type +// Parameters: +// location - extension location +// extensionTypeName - extension type name +func (client ExtensionTypeVersionsClient) List(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.List") + defer func() { + sc := -1 + if result.evl.Response.Response != nil { + sc = result.evl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionTypeVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.evl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure sending request") + return + } + + result.evl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.evl.hasNextLink() && result.evl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionTypeVersionsClient) ListPreparer(ctx context.Context, location string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions", 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 ExtensionTypeVersionsClient) 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 ExtensionTypeVersionsClient) ListResponder(resp *http.Response) (result ExtensionVersionList, 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 ExtensionTypeVersionsClient) listNextResults(ctx context.Context, lastResults ExtensionVersionList) (result ExtensionVersionList, err error) { + req, err := lastResults.extensionVersionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "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, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionTypeVersionsClient) ListComplete(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.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, location, extensionTypeName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/fluxconfigoperationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/fluxconfigoperationstatus.go new file mode 100644 index 000000000000..483878a0a02e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/fluxconfigoperationstatus.go @@ -0,0 +1,128 @@ +package kubernetesconfiguration + +// 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" +) + +// FluxConfigOperationStatusClient is the kubernetesConfiguration Client +type FluxConfigOperationStatusClient struct { + BaseClient +} + +// NewFluxConfigOperationStatusClient creates an instance of the FluxConfigOperationStatusClient client. +func NewFluxConfigOperationStatusClient(subscriptionID string) FluxConfigOperationStatusClient { + return NewFluxConfigOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFluxConfigOperationStatusClientWithBaseURI creates an instance of the FluxConfigOperationStatusClient 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 NewFluxConfigOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) FluxConfigOperationStatusClient { + return FluxConfigOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// operationID - operation Id +func (client FluxConfigOperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigOperationStatusClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FluxConfigOperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}", 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 FluxConfigOperationStatusClient) 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 FluxConfigOperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, 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/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/fluxconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/fluxconfigurations.go new file mode 100644 index 000000000000..c0714efcac6f --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/fluxconfigurations.go @@ -0,0 +1,557 @@ +package kubernetesconfiguration + +// 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" +) + +// FluxConfigurationsClient is the kubernetesConfiguration Client +type FluxConfigurationsClient struct { + BaseClient +} + +// NewFluxConfigurationsClient creates an instance of the FluxConfigurationsClient client. +func NewFluxConfigurationsClient(subscriptionID string) FluxConfigurationsClient { + return NewFluxConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFluxConfigurationsClientWithBaseURI creates an instance of the FluxConfigurationsClient 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 NewFluxConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) FluxConfigurationsClient { + return FluxConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// fluxConfiguration - properties necessary to Create a FluxConfiguration. +func (client FluxConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration) (result FluxConfigurationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FluxConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", pathParameters), + autorest.WithJSON(fluxConfiguration), + 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 FluxConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future FluxConfigurationsCreateOrUpdateFuture, 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 FluxConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result FluxConfiguration, 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 this will delete the YAML file used to set up the Flux Configuration, thus stopping future sync from the +// source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client FluxConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, forceDelete *bool) (result FluxConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FluxConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", 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 FluxConfigurationsClient) DeleteSender(req *http.Request) (future FluxConfigurationsDeleteFuture, 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 FluxConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details of the Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +func (client FluxConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string) (result FluxConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FluxConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", 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 FluxConfigurationsClient) 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 FluxConfigurationsClient) GetResponder(resp *http.Response) (result FluxConfiguration, 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 Flux Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client FluxConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result FluxConfigurationsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.List") + defer func() { + sc := -1 + if result.fcl.Response.Response != nil { + sc = result.fcl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.fcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.fcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.fcl.hasNextLink() && result.fcl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FluxConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations", 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 FluxConfigurationsClient) 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 FluxConfigurationsClient) ListResponder(resp *http.Response) (result FluxConfigurationsList, 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 FluxConfigurationsClient) listNextResults(ctx context.Context, lastResults FluxConfigurationsList) (result FluxConfigurationsList, err error) { + req, err := lastResults.fluxConfigurationsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "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, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client FluxConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result FluxConfigurationsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.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, clusterRp, clusterResourceName, clusterName) + return +} + +// Update update an existing Kubernetes Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// fluxConfigurationPatch - properties to Patch in an existing Flux Configuration. +func (client FluxConfigurationsClient) Update(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch) (result FluxConfigurationsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfigurationPatch) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FluxConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", pathParameters), + autorest.WithJSON(fluxConfigurationPatch), + 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 FluxConfigurationsClient) UpdateSender(req *http.Request) (future FluxConfigurationsUpdateFuture, 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 FluxConfigurationsClient) UpdateResponder(resp *http.Response) (result FluxConfiguration, 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/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go new file mode 100644 index 000000000000..c68405c3c5f8 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go @@ -0,0 +1,102 @@ +package kubernetesconfigurationapi + +// 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/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration" +) + +// ExtensionsClientAPI contains the set of methods on the ExtensionsClient type. +type ExtensionsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, extension kubernetesconfiguration.Extension) (result kubernetesconfiguration.ExtensionsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, forceDelete *bool) (result kubernetesconfiguration.ExtensionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string) (result kubernetesconfiguration.Extension, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.ExtensionsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.ExtensionsListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, patchExtension kubernetesconfiguration.PatchExtension) (result kubernetesconfiguration.ExtensionsUpdateFuture, err error) +} + +var _ ExtensionsClientAPI = (*kubernetesconfiguration.ExtensionsClient)(nil) + +// OperationStatusClientAPI contains the set of methods on the OperationStatusClient type. +type OperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.OperationStatusListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.OperationStatusListIterator, err error) +} + +var _ OperationStatusClientAPI = (*kubernetesconfiguration.OperationStatusClient)(nil) + +// ClusterExtensionTypeClientAPI contains the set of methods on the ClusterExtensionTypeClient type. +type ClusterExtensionTypeClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionTypeName string) (result kubernetesconfiguration.ExtensionType, err error) +} + +var _ ClusterExtensionTypeClientAPI = (*kubernetesconfiguration.ClusterExtensionTypeClient)(nil) + +// ClusterExtensionTypesClientAPI contains the set of methods on the ClusterExtensionTypesClient type. +type ClusterExtensionTypesClientAPI interface { + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ ClusterExtensionTypesClientAPI = (*kubernetesconfiguration.ClusterExtensionTypesClient)(nil) + +// ExtensionTypeVersionsClientAPI contains the set of methods on the ExtensionTypeVersionsClient type. +type ExtensionTypeVersionsClientAPI interface { + List(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListPage, err error) + ListComplete(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListIterator, err error) +} + +var _ ExtensionTypeVersionsClientAPI = (*kubernetesconfiguration.ExtensionTypeVersionsClient)(nil) + +// LocationExtensionTypesClientAPI contains the set of methods on the LocationExtensionTypesClient type. +type LocationExtensionTypesClientAPI interface { + List(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ LocationExtensionTypesClientAPI = (*kubernetesconfiguration.LocationExtensionTypesClient)(nil) + +// SourceControlConfigurationsClientAPI contains the set of methods on the SourceControlConfigurationsClient type. +type SourceControlConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration kubernetesconfiguration.SourceControlConfiguration) (result kubernetesconfiguration.SourceControlConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListIterator, err error) +} + +var _ SourceControlConfigurationsClientAPI = (*kubernetesconfiguration.SourceControlConfigurationsClient)(nil) + +// FluxConfigurationsClientAPI contains the set of methods on the FluxConfigurationsClient type. +type FluxConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfiguration kubernetesconfiguration.FluxConfiguration) (result kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, forceDelete *bool) (result kubernetesconfiguration.FluxConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string) (result kubernetesconfiguration.FluxConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.FluxConfigurationsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.FluxConfigurationsListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfigurationPatch kubernetesconfiguration.FluxConfigurationPatch) (result kubernetesconfiguration.FluxConfigurationsUpdateFuture, err error) +} + +var _ FluxConfigurationsClientAPI = (*kubernetesconfiguration.FluxConfigurationsClient)(nil) + +// FluxConfigOperationStatusClientAPI contains the set of methods on the FluxConfigOperationStatusClient type. +type FluxConfigOperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) +} + +var _ FluxConfigOperationStatusClientAPI = (*kubernetesconfiguration.FluxConfigOperationStatusClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListPage, err error) + ListComplete(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListIterator, err error) +} + +var _ OperationsClientAPI = (*kubernetesconfiguration.OperationsClient)(nil) diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/locationextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/locationextensiontypes.go new file mode 100644 index 000000000000..701a106d44b7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/locationextensiontypes.go @@ -0,0 +1,155 @@ +package kubernetesconfiguration + +// 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" +) + +// LocationExtensionTypesClient is the kubernetesConfiguration Client +type LocationExtensionTypesClient struct { + BaseClient +} + +// NewLocationExtensionTypesClient creates an instance of the LocationExtensionTypesClient client. +func NewLocationExtensionTypesClient(subscriptionID string) LocationExtensionTypesClient { + return NewLocationExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationExtensionTypesClientWithBaseURI creates an instance of the LocationExtensionTypesClient 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 NewLocationExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) LocationExtensionTypesClient { + return LocationExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all Extension Types +// Parameters: +// location - extension location +func (client LocationExtensionTypesClient) List(ctx context.Context, location string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.LocationExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LocationExtensionTypesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes", 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 LocationExtensionTypesClient) 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 LocationExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, 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 LocationExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "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, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocationExtensionTypesClient) ListComplete(ctx context.Context, location string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.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, location) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/models.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/models.go new file mode 100644 index 000000000000..5d59412c2a05 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/models.go @@ -0,0 +1,2797 @@ +package kubernetesconfiguration + +// 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/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration" + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ClusterScopeSettings extension scope settings +type ClusterScopeSettings struct { + // ClusterScopeSettingsProperties - Extension scope settings + *ClusterScopeSettingsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterScopeSettings. +func (CSS ClusterScopeSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if CSS.ClusterScopeSettingsProperties != nil { + objectMap["properties"] = CSS.ClusterScopeSettingsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ClusterScopeSettings struct. +func (CSS *ClusterScopeSettings) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var clusterScopeSettingsProperties ClusterScopeSettingsProperties + err = json.Unmarshal(*v, &clusterScopeSettingsProperties) + if err != nil { + return err + } + CSS.ClusterScopeSettingsProperties = &clusterScopeSettingsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + CSS.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + CSS.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + CSS.Type = &typeVar + } + } + } + + return nil +} + +// ClusterScopeSettingsProperties extension scope settings +type ClusterScopeSettingsProperties struct { + // AllowMultipleInstances - Describes if multiple instances of the extension are allowed + AllowMultipleInstances *bool `json:"allowMultipleInstances,omitempty"` + // DefaultReleaseNamespace - Default extension release namespace + DefaultReleaseNamespace *string `json:"defaultReleaseNamespace,omitempty"` +} + +// ComplianceStatus compliance Status details +type ComplianceStatus struct { + // ComplianceState - READ-ONLY; The compliance state of the configuration. Possible values include: 'Pending', 'Compliant', 'Noncompliant', 'Installed', 'Failed' + ComplianceState ComplianceStateType `json:"complianceState,omitempty"` + // LastConfigApplied - Datetime the configuration was last applied. + LastConfigApplied *date.Time `json:"lastConfigApplied,omitempty"` + // Message - Message from when the configuration was applied. + Message *string `json:"message,omitempty"` + // MessageLevel - Level of the message. Possible values include: 'MessageLevelTypeError', 'MessageLevelTypeWarning', 'MessageLevelTypeInformation' + MessageLevel MessageLevelType `json:"messageLevel,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComplianceStatus. +func (cs ComplianceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.LastConfigApplied != nil { + objectMap["lastConfigApplied"] = cs.LastConfigApplied + } + if cs.Message != nil { + objectMap["message"] = cs.Message + } + if cs.MessageLevel != "" { + objectMap["messageLevel"] = cs.MessageLevel + } + return json.Marshal(objectMap) +} + +// DependsOnDefinition specify which kustomizations must succeed reconciliation on the cluster prior to +// reconciling this kustomization +type DependsOnDefinition struct { + // KustomizationName - Name of the kustomization to claim dependency on + KustomizationName *string `json:"kustomizationName,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// Extension the Extension object. +type Extension struct { + autorest.Response `json:"-"` + // ExtensionProperties - Properties of an Extension resource + *ExtensionProperties `json:"properties,omitempty"` + // Identity - Identity of the Extension resource + Identity *Identity `json:"identity,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Extension. +func (e Extension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionProperties != nil { + objectMap["properties"] = e.ExtensionProperties + } + if e.Identity != nil { + objectMap["identity"] = e.Identity + } + if e.SystemData != nil { + objectMap["systemData"] = e.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Extension struct. +func (e *Extension) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var extensionProperties ExtensionProperties + err = json.Unmarshal(*v, &extensionProperties) + if err != nil { + return err + } + e.ExtensionProperties = &extensionProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + e.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + e.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + } + } + + return nil +} + +// ExtensionProperties properties of an Extension resource +type ExtensionProperties struct { + // ExtensionType - Type of the Extension, of which this resource is an instance of. It must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + ExtensionType *string `json:"extensionType,omitempty"` + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // Scope - Scope at which the extension is installed. + Scope *Scope `json:"scope,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // ProvisioningState - READ-ONLY; Status of installation of this extension. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Statuses - Status from this extension. + Statuses *[]ExtensionStatus `json:"statuses,omitempty"` + // ErrorInfo - READ-ONLY; Error information from the Agent - e.g. errors during installation. + ErrorInfo *ErrorDetail `json:"errorInfo,omitempty"` + // CustomLocationSettings - READ-ONLY; Custom Location settings properties. + CustomLocationSettings map[string]*string `json:"customLocationSettings"` + // PackageURI - READ-ONLY; Uri of the Helm package + PackageURI *string `json:"packageUri,omitempty"` + // AksAssignedIdentity - Identity of the Extension resource in an AKS cluster + AksAssignedIdentity *ExtensionPropertiesAksAssignedIdentity `json:"aksAssignedIdentity,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionProperties. +func (e ExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionType != nil { + objectMap["extensionType"] = e.ExtensionType + } + if e.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = e.AutoUpgradeMinorVersion + } + if e.ReleaseTrain != nil { + objectMap["releaseTrain"] = e.ReleaseTrain + } + if e.Version != nil { + objectMap["version"] = e.Version + } + if e.Scope != nil { + objectMap["scope"] = e.Scope + } + if e.ConfigurationSettings != nil { + objectMap["configurationSettings"] = e.ConfigurationSettings + } + if e.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = e.ConfigurationProtectedSettings + } + if e.Statuses != nil { + objectMap["statuses"] = e.Statuses + } + if e.AksAssignedIdentity != nil { + objectMap["aksAssignedIdentity"] = e.AksAssignedIdentity + } + return json.Marshal(objectMap) +} + +// ExtensionPropertiesAksAssignedIdentity identity of the Extension resource in an AKS cluster +type ExtensionPropertiesAksAssignedIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionPropertiesAksAssignedIdentity. +func (eAi ExtensionPropertiesAksAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eAi.Type != "" { + objectMap["type"] = eAi.Type + } + return json.Marshal(objectMap) +} + +// ExtensionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsCreateFuture) 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 ExtensionsCreateFuture.Result. +func (future *ExtensionsCreateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsDeleteFuture) 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 ExtensionsDeleteFuture.Result. +func (future *ExtensionsDeleteFuture) result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExtensionsList result of the request to list Extensions. It contains a list of Extension objects and a +// URL link to get the next set of results. +type ExtensionsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Extensions within a Kubernetes cluster. + Value *[]Extension `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of extension objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionsList. +func (el ExtensionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionsListIterator provides access to a complete listing of Extension values. +type ExtensionsListIterator struct { + i int + page ExtensionsListPage +} + +// 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 *ExtensionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListIterator.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 *ExtensionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionsListIterator) 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 ExtensionsListIterator) Response() ExtensionsList { + 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 ExtensionsListIterator) Value() Extension { + if !iter.page.NotDone() { + return Extension{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionsListIterator type. +func NewExtensionsListIterator(page ExtensionsListPage) ExtensionsListIterator { + return ExtensionsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (el ExtensionsList) IsEmpty() bool { + return el.Value == nil || len(*el.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (el ExtensionsList) hasNextLink() bool { + return el.NextLink != nil && len(*el.NextLink) != 0 +} + +// extensionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (el ExtensionsList) extensionsListPreparer(ctx context.Context) (*http.Request, error) { + if !el.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(el.NextLink))) +} + +// ExtensionsListPage contains a page of Extension values. +type ExtensionsListPage struct { + fn func(context.Context, ExtensionsList) (ExtensionsList, error) + el ExtensionsList +} + +// 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 *ExtensionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListPage.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.el) + if err != nil { + return err + } + page.el = 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 *ExtensionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionsListPage) NotDone() bool { + return !page.el.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionsListPage) Response() ExtensionsList { + return page.el +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionsListPage) Values() []Extension { + if page.el.IsEmpty() { + return nil + } + return *page.el.Value +} + +// Creates a new instance of the ExtensionsListPage type. +func NewExtensionsListPage(cur ExtensionsList, getNextPage func(context.Context, ExtensionsList) (ExtensionsList, error)) ExtensionsListPage { + return ExtensionsListPage{ + fn: getNextPage, + el: cur, + } +} + +// ExtensionStatus status from the extension. +type ExtensionStatus struct { + // Code - Status code provided by the Extension + Code *string `json:"code,omitempty"` + // DisplayStatus - Short description of status of the extension. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Level - Level of the status. Possible values include: 'Error', 'Warning', 'Information' + Level LevelType `json:"level,omitempty"` + // Message - Detailed message of the status from the Extension. + Message *string `json:"message,omitempty"` + // Time - DateLiteral (per ISO8601) noting the time of installation status. + Time *string `json:"time,omitempty"` +} + +// ExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsUpdateFuture) 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 ExtensionsUpdateFuture.Result. +func (future *ExtensionsUpdateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.UpdateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsUpdateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionType represents an Extension Type. +type ExtensionType struct { + autorest.Response `json:"-"` + // ExtensionTypeProperties - Describes the Resource Type properties. + *ExtensionTypeProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionType. +func (et ExtensionType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if et.ExtensionTypeProperties != nil { + objectMap["properties"] = et.ExtensionTypeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExtensionType struct. +func (et *ExtensionType) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var extensionTypeProperties ExtensionTypeProperties + err = json.Unmarshal(*v, &extensionTypeProperties) + if err != nil { + return err + } + et.ExtensionTypeProperties = &extensionTypeProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + et.SystemData = &systemData + } + } + } + + return nil +} + +// ExtensionTypeList list Extension Types +type ExtensionTypeList struct { + autorest.Response `json:"-"` + // Value - The list of Extension Types + Value *[]ExtensionType `json:"value,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` +} + +// ExtensionTypeListIterator provides access to a complete listing of ExtensionType values. +type ExtensionTypeListIterator struct { + i int + page ExtensionTypeListPage +} + +// 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 *ExtensionTypeListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListIterator.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 *ExtensionTypeListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionTypeListIterator) 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 ExtensionTypeListIterator) Response() ExtensionTypeList { + 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 ExtensionTypeListIterator) Value() ExtensionType { + if !iter.page.NotDone() { + return ExtensionType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionTypeListIterator type. +func NewExtensionTypeListIterator(page ExtensionTypeListPage) ExtensionTypeListIterator { + return ExtensionTypeListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (etl ExtensionTypeList) IsEmpty() bool { + return etl.Value == nil || len(*etl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (etl ExtensionTypeList) hasNextLink() bool { + return etl.NextLink != nil && len(*etl.NextLink) != 0 +} + +// extensionTypeListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (etl ExtensionTypeList) extensionTypeListPreparer(ctx context.Context) (*http.Request, error) { + if !etl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(etl.NextLink))) +} + +// ExtensionTypeListPage contains a page of ExtensionType values. +type ExtensionTypeListPage struct { + fn func(context.Context, ExtensionTypeList) (ExtensionTypeList, error) + etl ExtensionTypeList +} + +// 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 *ExtensionTypeListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListPage.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.etl) + if err != nil { + return err + } + page.etl = 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 *ExtensionTypeListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionTypeListPage) NotDone() bool { + return !page.etl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionTypeListPage) Response() ExtensionTypeList { + return page.etl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionTypeListPage) Values() []ExtensionType { + if page.etl.IsEmpty() { + return nil + } + return *page.etl.Value +} + +// Creates a new instance of the ExtensionTypeListPage type. +func NewExtensionTypeListPage(cur ExtensionTypeList, getNextPage func(context.Context, ExtensionTypeList) (ExtensionTypeList, error)) ExtensionTypeListPage { + return ExtensionTypeListPage{ + fn: getNextPage, + etl: cur, + } +} + +// ExtensionTypeProperties properties of the connected cluster. +type ExtensionTypeProperties struct { + // ReleaseTrains - READ-ONLY; Extension release train: preview or stable + ReleaseTrains *[]string `json:"releaseTrains,omitempty"` + // ClusterTypes - READ-ONLY; Cluster types. Possible values include: 'ConnectedClusters', 'ManagedClusters' + ClusterTypes ClusterTypes `json:"clusterTypes,omitempty"` + // SupportedScopes - READ-ONLY; Extension scopes + SupportedScopes *SupportedScopes `json:"supportedScopes,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionTypeProperties. +func (etp ExtensionTypeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionVersionList list versions for an Extension +type ExtensionVersionList struct { + autorest.Response `json:"-"` + // Versions - Versions available for this Extension Type + Versions *[]ExtensionVersionListVersionsItem `json:"versions,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionVersionList. +func (evl ExtensionVersionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if evl.Versions != nil { + objectMap["versions"] = evl.Versions + } + if evl.NextLink != nil { + objectMap["nextLink"] = evl.NextLink + } + return json.Marshal(objectMap) +} + +// ExtensionVersionListIterator provides access to a complete listing of ExtensionVersionListVersionsItem +// values. +type ExtensionVersionListIterator struct { + i int + page ExtensionVersionListPage +} + +// 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 *ExtensionVersionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListIterator.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 *ExtensionVersionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionVersionListIterator) 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 ExtensionVersionListIterator) Response() ExtensionVersionList { + 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 ExtensionVersionListIterator) Value() ExtensionVersionListVersionsItem { + if !iter.page.NotDone() { + return ExtensionVersionListVersionsItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionVersionListIterator type. +func NewExtensionVersionListIterator(page ExtensionVersionListPage) ExtensionVersionListIterator { + return ExtensionVersionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (evl ExtensionVersionList) IsEmpty() bool { + return evl.Versions == nil || len(*evl.Versions) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (evl ExtensionVersionList) hasNextLink() bool { + return evl.NextLink != nil && len(*evl.NextLink) != 0 +} + +// extensionVersionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (evl ExtensionVersionList) extensionVersionListPreparer(ctx context.Context) (*http.Request, error) { + if !evl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(evl.NextLink))) +} + +// ExtensionVersionListPage contains a page of ExtensionVersionListVersionsItem values. +type ExtensionVersionListPage struct { + fn func(context.Context, ExtensionVersionList) (ExtensionVersionList, error) + evl ExtensionVersionList +} + +// 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 *ExtensionVersionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListPage.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.evl) + if err != nil { + return err + } + page.evl = 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 *ExtensionVersionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionVersionListPage) NotDone() bool { + return !page.evl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionVersionListPage) Response() ExtensionVersionList { + return page.evl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionVersionListPage) Values() []ExtensionVersionListVersionsItem { + if page.evl.IsEmpty() { + return nil + } + return *page.evl.Versions +} + +// Creates a new instance of the ExtensionVersionListPage type. +func NewExtensionVersionListPage(cur ExtensionVersionList, getNextPage func(context.Context, ExtensionVersionList) (ExtensionVersionList, error)) ExtensionVersionListPage { + return ExtensionVersionListPage{ + fn: getNextPage, + evl: cur, + } +} + +// ExtensionVersionListVersionsItem ... +type ExtensionVersionListVersionsItem struct { + // ReleaseTrain - The release train for this Extension Type + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Versions - Versions available for this Extension Type and release train + Versions *[]string `json:"versions,omitempty"` +} + +// FluxConfiguration the Flux Configuration object returned in Get & Put response. +type FluxConfiguration struct { + autorest.Response `json:"-"` + // FluxConfigurationProperties - Properties to create a Flux Configuration resource + *FluxConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfiguration. +func (fc FluxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fc.FluxConfigurationProperties != nil { + objectMap["properties"] = fc.FluxConfigurationProperties + } + if fc.SystemData != nil { + objectMap["systemData"] = fc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FluxConfiguration struct. +func (fc *FluxConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fluxConfigurationProperties FluxConfigurationProperties + err = json.Unmarshal(*v, &fluxConfigurationProperties) + if err != nil { + return err + } + fc.FluxConfigurationProperties = &fluxConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + fc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fc.Type = &typeVar + } + } + } + + return nil +} + +// FluxConfigurationPatch the Flux Configuration Patch Request object. +type FluxConfigurationPatch struct { + // FluxConfigurationPatchProperties - Updatable properties of an Flux Configuration Patch Request + *FluxConfigurationPatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationPatch. +func (fcp FluxConfigurationPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.FluxConfigurationPatchProperties != nil { + objectMap["properties"] = fcp.FluxConfigurationPatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FluxConfigurationPatch struct. +func (fcp *FluxConfigurationPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fluxConfigurationPatchProperties FluxConfigurationPatchProperties + err = json.Unmarshal(*v, &fluxConfigurationPatchProperties) + if err != nil { + return err + } + fcp.FluxConfigurationPatchProperties = &fluxConfigurationPatchProperties + } + } + } + + return nil +} + +// FluxConfigurationPatchProperties updatable properties of an Flux Configuration Patch Request +type FluxConfigurationPatchProperties struct { + // SourceKind - Source Kind to pull the configuration data from. Possible values include: 'GitRepository' + SourceKind SourceKindType `json:"sourceKind,omitempty"` + // Suspend - Whether this configuration should suspend its reconciliation of its kustomizations and sources. + Suspend *bool `json:"suspend,omitempty"` + // GitRepository - Parameters to reconcile to the GitRepository source kind type. + GitRepository *GitRepositoryDefinition `json:"gitRepository,omitempty"` + // Kustomizations - Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. + Kustomizations map[string]*KustomizationDefinition `json:"kustomizations"` + // ConfigurationProtectedSettings - Key-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationPatchProperties. +func (fcp FluxConfigurationPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.SourceKind != "" { + objectMap["sourceKind"] = fcp.SourceKind + } + if fcp.Suspend != nil { + objectMap["suspend"] = fcp.Suspend + } + if fcp.GitRepository != nil { + objectMap["gitRepository"] = fcp.GitRepository + } + if fcp.Kustomizations != nil { + objectMap["kustomizations"] = fcp.Kustomizations + } + if fcp.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = fcp.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// FluxConfigurationProperties properties to create a Flux Configuration resource +type FluxConfigurationProperties struct { + // Scope - Scope at which the operator will be installed. Possible values include: 'ScopeTypeCluster', 'ScopeTypeNamespace' + Scope ScopeType `json:"scope,omitempty"` + // Namespace - The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + Namespace *string `json:"namespace,omitempty"` + // SourceKind - Source Kind to pull the configuration data from. Possible values include: 'GitRepository' + SourceKind SourceKindType `json:"sourceKind,omitempty"` + // Suspend - Whether this configuration should suspend its reconciliation of its kustomizations and sources. + Suspend *bool `json:"suspend,omitempty"` + // GitRepository - Parameters to reconcile to the GitRepository source kind type. + GitRepository *GitRepositoryDefinition `json:"gitRepository,omitempty"` + // Kustomizations - Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. + Kustomizations map[string]*KustomizationDefinition `json:"kustomizations"` + // ConfigurationProtectedSettings - Key-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // Statuses - READ-ONLY; Statuses of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects provisioned by the fluxConfiguration. + Statuses *[]ObjectStatusDefinition `json:"statuses,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this fluxConfiguration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // LastSourceSyncedCommitID - READ-ONLY; Branch and SHA of the last source commit synced with the cluster. + LastSourceSyncedCommitID *string `json:"lastSourceSyncedCommitId,omitempty"` + // LastSourceSyncedAt - READ-ONLY; Datetime the fluxConfiguration last synced its source on the cluster. + LastSourceSyncedAt *date.Time `json:"lastSourceSyncedAt,omitempty"` + // ComplianceState - READ-ONLY; Combined status of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects. Possible values include: 'FluxComplianceStateCompliant', 'FluxComplianceStateNonCompliant', 'FluxComplianceStatePending', 'FluxComplianceStateSuspended', 'FluxComplianceStateUnknown' + ComplianceState FluxComplianceState `json:"complianceState,omitempty"` + // ProvisioningState - READ-ONLY; Status of the creation of the fluxConfiguration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ErrorMessage - READ-ONLY; Error message returned to the user in the case of provisioning failure. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationProperties. +func (fc FluxConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fc.Scope != "" { + objectMap["scope"] = fc.Scope + } + if fc.Namespace != nil { + objectMap["namespace"] = fc.Namespace + } + if fc.SourceKind != "" { + objectMap["sourceKind"] = fc.SourceKind + } + if fc.Suspend != nil { + objectMap["suspend"] = fc.Suspend + } + if fc.GitRepository != nil { + objectMap["gitRepository"] = fc.GitRepository + } + if fc.Kustomizations != nil { + objectMap["kustomizations"] = fc.Kustomizations + } + if fc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = fc.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// FluxConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (FluxConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsCreateOrUpdateFuture) 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 FluxConfigurationsCreateOrUpdateFuture.Result. +func (future *FluxConfigurationsCreateOrUpdateFuture) result(client FluxConfigurationsClient) (fc FluxConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fc.Response.Response, err = future.GetResult(sender); err == nil && fc.Response.Response.StatusCode != http.StatusNoContent { + fc, err = client.CreateOrUpdateResponder(fc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture", "Result", fc.Response.Response, "Failure responding to request") + } + } + return +} + +// FluxConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsDeleteFuture) 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 FluxConfigurationsDeleteFuture.Result. +func (future *FluxConfigurationsDeleteFuture) result(client FluxConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// FluxConfigurationsList result of the request to list Flux Configurations. It contains a list of +// FluxConfiguration objects and a URL link to get the next set of results. +type FluxConfigurationsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Flux Configurations within a Kubernetes cluster. + Value *[]FluxConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationsList. +func (fcl FluxConfigurationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FluxConfigurationsListIterator provides access to a complete listing of FluxConfiguration values. +type FluxConfigurationsListIterator struct { + i int + page FluxConfigurationsListPage +} + +// 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 *FluxConfigurationsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsListIterator.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 *FluxConfigurationsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FluxConfigurationsListIterator) 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 FluxConfigurationsListIterator) Response() FluxConfigurationsList { + 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 FluxConfigurationsListIterator) Value() FluxConfiguration { + if !iter.page.NotDone() { + return FluxConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FluxConfigurationsListIterator type. +func NewFluxConfigurationsListIterator(page FluxConfigurationsListPage) FluxConfigurationsListIterator { + return FluxConfigurationsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fcl FluxConfigurationsList) IsEmpty() bool { + return fcl.Value == nil || len(*fcl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fcl FluxConfigurationsList) hasNextLink() bool { + return fcl.NextLink != nil && len(*fcl.NextLink) != 0 +} + +// fluxConfigurationsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fcl FluxConfigurationsList) fluxConfigurationsListPreparer(ctx context.Context) (*http.Request, error) { + if !fcl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fcl.NextLink))) +} + +// FluxConfigurationsListPage contains a page of FluxConfiguration values. +type FluxConfigurationsListPage struct { + fn func(context.Context, FluxConfigurationsList) (FluxConfigurationsList, error) + fcl FluxConfigurationsList +} + +// 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 *FluxConfigurationsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsListPage.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.fcl) + if err != nil { + return err + } + page.fcl = 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 *FluxConfigurationsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FluxConfigurationsListPage) NotDone() bool { + return !page.fcl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FluxConfigurationsListPage) Response() FluxConfigurationsList { + return page.fcl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FluxConfigurationsListPage) Values() []FluxConfiguration { + if page.fcl.IsEmpty() { + return nil + } + return *page.fcl.Value +} + +// Creates a new instance of the FluxConfigurationsListPage type. +func NewFluxConfigurationsListPage(cur FluxConfigurationsList, getNextPage func(context.Context, FluxConfigurationsList) (FluxConfigurationsList, error)) FluxConfigurationsListPage { + return FluxConfigurationsListPage{ + fn: getNextPage, + fcl: cur, + } +} + +// FluxConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (FluxConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsUpdateFuture) 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 FluxConfigurationsUpdateFuture.Result. +func (future *FluxConfigurationsUpdateFuture) result(client FluxConfigurationsClient) (fc FluxConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fc.Response.Response, err = future.GetResult(sender); err == nil && fc.Response.Response.StatusCode != http.StatusNoContent { + fc, err = client.UpdateResponder(fc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsUpdateFuture", "Result", fc.Response.Response, "Failure responding to request") + } + } + return +} + +// GitRepositoryDefinition parameters to reconcile to the GitRepository source kind type. +type GitRepositoryDefinition struct { + // URL - The URL to sync for the flux configuration git repository. + URL *string `json:"url,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RepositoryRef - The source reference for the GitRepository object. + RepositoryRef *RepositoryRefDefinition `json:"repositoryRef,omitempty"` + // SSHKnownHosts - Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH + SSHKnownHosts *string `json:"sshKnownHosts,omitempty"` + // HTTPSUser - Base64-encoded HTTPS username used to access private git repositories over HTTPS + HTTPSUser *string `json:"httpsUser,omitempty"` + // HTTPSCAFile - Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS + HTTPSCAFile *string `json:"httpsCAFile,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// HelmOperatorProperties properties for Helm operator. +type HelmOperatorProperties struct { + // ChartVersion - Version of the operator Helm chart. + ChartVersion *string `json:"chartVersion,omitempty"` + // ChartValues - Values override for the operator Helm chart. + ChartValues *string `json:"chartValues,omitempty"` +} + +// HelmReleasePropertiesDefinition ... +type HelmReleasePropertiesDefinition struct { + // LastRevisionApplied - The revision number of the last released object change + LastRevisionApplied *int64 `json:"lastRevisionApplied,omitempty"` + // HelmChartRef - The reference to the HelmChart object used as the source to this HelmRelease + HelmChartRef *ObjectReferenceDefinition `json:"helmChartRef,omitempty"` + // FailureCount - Total number of times that the HelmRelease failed to install or upgrade + FailureCount *int64 `json:"failureCount,omitempty"` + // InstallFailureCount - Number of times that the HelmRelease failed to install + InstallFailureCount *int64 `json:"installFailureCount,omitempty"` + // UpgradeFailureCount - Number of times that the HelmRelease failed to upgrade + UpgradeFailureCount *int64 `json:"upgradeFailureCount,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + +// KustomizationDefinition the Kustomization defining how to reconcile the artifact pulled by the source +// type on the cluster. +type KustomizationDefinition struct { + // Path - The path in the source reference to reconcile on the cluster. + Path *string `json:"path,omitempty"` + // DependsOn - Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. + DependsOn *[]DependsOnDefinition `json:"dependsOn,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the Kustomization on the cluster. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RetryIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster in the event of failure on reconciliation. + RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` + // Prune - Enable/disable garbage collections of Kubernetes objects created by this Kustomization. + Prune *bool `json:"prune,omitempty"` + // Validation - Specify whether to validate the Kubernetes objects referenced in the Kustomization before applying them to the cluster. Possible values include: 'None', 'Client', 'Server' + Validation KustomizationValidationType `json:"validation,omitempty"` + // Force - Enable/disable re-creating Kubernetes resources on the cluster when patching fails due to an immutable field change. + Force *bool `json:"force,omitempty"` +} + +// ObjectReferenceDefinition object reference to a Kubernetes object on a cluster +type ObjectReferenceDefinition struct { + // Name - Name of the object + Name *string `json:"name,omitempty"` + // Namespace - Namespace of the object + Namespace *string `json:"namespace,omitempty"` +} + +// ObjectStatusConditionDefinition status condition of Kubernetes object +type ObjectStatusConditionDefinition struct { + // LastTransitionTime - Last time this status condition has changed + LastTransitionTime *date.Time `json:"lastTransitionTime,omitempty"` + // Message - A more verbose description of the object status condition + Message *string `json:"message,omitempty"` + // Reason - Reason for the specified status condition type status + Reason *string `json:"reason,omitempty"` + // Status - Status of the Kubernetes object condition type + Status *string `json:"status,omitempty"` + // Type - Object status condition type for this object + Type *string `json:"type,omitempty"` +} + +// ObjectStatusDefinition statuses of objects deployed by the user-specified kustomizations from the git +// repository. +type ObjectStatusDefinition struct { + // Name - Name of the applied object + Name *string `json:"name,omitempty"` + // Namespace - Namespace of the applied object + Namespace *string `json:"namespace,omitempty"` + // Kind - Kind of the applied object + Kind *string `json:"kind,omitempty"` + // ComplianceState - Compliance state of the applied object showing whether the applied object has come into a ready state on the cluster. Possible values include: 'FluxComplianceStateCompliant', 'FluxComplianceStateNonCompliant', 'FluxComplianceStatePending', 'FluxComplianceStateSuspended', 'FluxComplianceStateUnknown' + ComplianceState FluxComplianceState `json:"complianceState,omitempty"` + // AppliedBy - Object reference to the Kustomization that applied this object + AppliedBy *ObjectReferenceDefinition `json:"appliedBy,omitempty"` + // StatusConditions - List of Kubernetes object status conditions present on the cluster + StatusConditions *[]ObjectStatusConditionDefinition `json:"statusConditions,omitempty"` + // HelmReleaseProperties - Additional properties that are provided from objects of the HelmRelease kind + HelmReleaseProperties *HelmReleasePropertiesDefinition `json:"helmReleaseProperties,omitempty"` +} + +// OperationStatusList the async operations in progress, in the cluster. +type OperationStatusList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of async operations in progress, in the cluster. + Value *[]OperationStatusResult `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of Operation Result objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusList. +func (osl OperationStatusList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationStatusListIterator provides access to a complete listing of OperationStatusResult values. +type OperationStatusListIterator struct { + i int + page OperationStatusListPage +} + +// 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 *OperationStatusListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListIterator.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 *OperationStatusListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationStatusListIterator) 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 OperationStatusListIterator) Response() OperationStatusList { + 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 OperationStatusListIterator) Value() OperationStatusResult { + if !iter.page.NotDone() { + return OperationStatusResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationStatusListIterator type. +func NewOperationStatusListIterator(page OperationStatusListPage) OperationStatusListIterator { + return OperationStatusListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (osl OperationStatusList) IsEmpty() bool { + return osl.Value == nil || len(*osl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (osl OperationStatusList) hasNextLink() bool { + return osl.NextLink != nil && len(*osl.NextLink) != 0 +} + +// operationStatusListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (osl OperationStatusList) operationStatusListPreparer(ctx context.Context) (*http.Request, error) { + if !osl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(osl.NextLink))) +} + +// OperationStatusListPage contains a page of OperationStatusResult values. +type OperationStatusListPage struct { + fn func(context.Context, OperationStatusList) (OperationStatusList, error) + osl OperationStatusList +} + +// 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 *OperationStatusListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListPage.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.osl) + if err != nil { + return err + } + page.osl = 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 *OperationStatusListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationStatusListPage) NotDone() bool { + return !page.osl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationStatusListPage) Response() OperationStatusList { + return page.osl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationStatusListPage) Values() []OperationStatusResult { + if page.osl.IsEmpty() { + return nil + } + return *page.osl.Value +} + +// Creates a new instance of the OperationStatusListPage type. +func NewOperationStatusListPage(cur OperationStatusList, getNextPage func(context.Context, OperationStatusList) (OperationStatusList, error)) OperationStatusListPage { + return OperationStatusListPage{ + fn: getNextPage, + osl: cur, + } +} + +// OperationStatusResult the current status of an async operation. +type OperationStatusResult struct { + autorest.Response `json:"-"` + // ID - Fully qualified ID for the async operation. + ID *string `json:"id,omitempty"` + // Name - Name of the async operation. + Name *string `json:"name,omitempty"` + // Status - Operation status. + Status *string `json:"status,omitempty"` + // Properties - Additional information, if available. + Properties map[string]*string `json:"properties"` + // Error - READ-ONLY; If present, details of the operation error. + Error *ErrorDetail `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusResult. +func (osr OperationStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if osr.ID != nil { + objectMap["id"] = osr.ID + } + if osr.Name != nil { + objectMap["name"] = osr.Name + } + if osr.Status != nil { + objectMap["status"] = osr.Status + } + if osr.Properties != nil { + objectMap["properties"] = osr.Properties + } + return json.Marshal(objectMap) +} + +// PatchExtension the Extension Patch Request object. +type PatchExtension struct { + // PatchExtensionProperties - Updatable properties of an Extension Patch Request + *PatchExtensionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PatchExtension. +func (peVar PatchExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.PatchExtensionProperties != nil { + objectMap["properties"] = peVar.PatchExtensionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PatchExtension struct. +func (peVar *PatchExtension) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var patchExtensionProperties PatchExtensionProperties + err = json.Unmarshal(*v, &patchExtensionProperties) + if err != nil { + return err + } + peVar.PatchExtensionProperties = &patchExtensionProperties + } + } + } + + return nil +} + +// PatchExtensionProperties updatable properties of an Extension Patch Request +type PatchExtensionProperties struct { + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` +} + +// MarshalJSON is the custom marshaler for PatchExtensionProperties. +func (peVar PatchExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = peVar.AutoUpgradeMinorVersion + } + if peVar.ReleaseTrain != nil { + objectMap["releaseTrain"] = peVar.ReleaseTrain + } + if peVar.Version != nil { + objectMap["version"] = peVar.Version + } + if peVar.ConfigurationSettings != nil { + objectMap["configurationSettings"] = peVar.ConfigurationSettings + } + if peVar.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = peVar.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// Plan plan for the resource. +type Plan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RepositoryRefDefinition the source reference for the GitRepository object. +type RepositoryRefDefinition struct { + // Branch - The git repository branch name to checkout. + Branch *string `json:"branch,omitempty"` + // Tag - The git repository tag name to checkout. This takes precedence over branch. + Tag *string `json:"tag,omitempty"` + // Semver - The semver range used to match against git repository tags. This takes precedence over tag. + Semver *string `json:"semver,omitempty"` + // Commit - The commit SHA to checkout. This value must be combined with the branch name to be valid. This takes precedence over semver. + Commit *string `json:"commit,omitempty"` +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed +// properties for a resource. Except properties bag, there cannot be a top level property outside of this +// set. +type ResourceModelWithAllowedPropertySet struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + ManagedBy *string `json:"managedBy,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` + Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. +func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Location != nil { + objectMap["location"] = rmwaps.Location + } + if rmwaps.ManagedBy != nil { + objectMap["managedBy"] = rmwaps.ManagedBy + } + if rmwaps.Kind != nil { + objectMap["kind"] = rmwaps.Kind + } + if rmwaps.Tags != nil { + objectMap["tags"] = rmwaps.Tags + } + if rmwaps.Identity != nil { + objectMap["identity"] = rmwaps.Identity + } + if rmwaps.Sku != nil { + objectMap["sku"] = rmwaps.Sku + } + if rmwaps.Plan != nil { + objectMap["plan"] = rmwaps.Plan + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetIdentity ... +type ResourceModelWithAllowedPropertySetIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. +func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Type != "" { + objectMap["type"] = rmwaps.Type + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetPlan ... +type ResourceModelWithAllowedPropertySetPlan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ResourceModelWithAllowedPropertySetSku ... +type ResourceModelWithAllowedPropertySetSku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// ResourceProviderOperation supported operation of this resource provider. +type ResourceProviderOperation struct { + // Name - Operation name, in format of {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *ResourceProviderOperationDisplay `json:"display,omitempty"` + // IsDataAction - READ-ONLY; The flag that indicates whether the operation applies to data plane. + IsDataAction *bool `json:"isDataAction,omitempty"` + // Origin - READ-ONLY; Origin of the operation + Origin *string `json:"origin,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperation. +func (rpo ResourceProviderOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpo.Name != nil { + objectMap["name"] = rpo.Name + } + if rpo.Display != nil { + objectMap["display"] = rpo.Display + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationDisplay display metadata associated with the operation. +type ResourceProviderOperationDisplay struct { + // Provider - Resource provider: Microsoft KubernetesConfiguration. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of this operation. + Description *string `json:"description,omitempty"` +} + +// ResourceProviderOperationList result of the request to list operations. +type ResourceProviderOperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by this resource provider. + Value *[]ResourceProviderOperation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperationList. +func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpol.Value != nil { + objectMap["value"] = rpol.Value + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation +// values. +type ResourceProviderOperationListIterator struct { + i int + page ResourceProviderOperationListPage +} + +// 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 *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.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 *ResourceProviderOperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceProviderOperationListIterator) 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 ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { + 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 ResourceProviderOperationListIterator) Value() ResourceProviderOperation { + if !iter.page.NotDone() { + return ResourceProviderOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceProviderOperationListIterator type. +func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { + return ResourceProviderOperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rpol ResourceProviderOperationList) IsEmpty() bool { + return rpol.Value == nil || len(*rpol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rpol ResourceProviderOperationList) hasNextLink() bool { + return rpol.NextLink != nil && len(*rpol.NextLink) != 0 +} + +// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { + if !rpol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rpol.NextLink))) +} + +// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. +type ResourceProviderOperationListPage struct { + fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) + rpol ResourceProviderOperationList +} + +// 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 *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.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.rpol) + if err != nil { + return err + } + page.rpol = 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 *ResourceProviderOperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceProviderOperationListPage) NotDone() bool { + return !page.rpol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { + return page.rpol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { + if page.rpol.IsEmpty() { + return nil + } + return *page.rpol.Value +} + +// Creates a new instance of the ResourceProviderOperationListPage type. +func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { + return ResourceProviderOperationListPage{ + fn: getNextPage, + rpol: cur, + } +} + +// Scope scope of the extension. It can be either Cluster or Namespace; but not both. +type Scope struct { + // Cluster - Specifies that the scope of the extension is Cluster + Cluster *ScopeCluster `json:"cluster,omitempty"` + // Namespace - Specifies that the scope of the extension is Namespace + Namespace *ScopeNamespace `json:"namespace,omitempty"` +} + +// ScopeCluster specifies that the scope of the extension is Cluster +type ScopeCluster struct { + // ReleaseNamespace - Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created + ReleaseNamespace *string `json:"releaseNamespace,omitempty"` +} + +// ScopeNamespace specifies that the scope of the extension is Namespace +type ScopeNamespace struct { + // TargetNamespace - Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +// Sku the resource model definition representing SKU +type Sku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// SourceControlConfiguration the SourceControl Configuration object returned in Get & Put response. +type SourceControlConfiguration struct { + autorest.Response `json:"-"` + // SourceControlConfigurationProperties - Properties to create a Source Control Configuration resource + *SourceControlConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfiguration. +func (scc SourceControlConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.SourceControlConfigurationProperties != nil { + objectMap["properties"] = scc.SourceControlConfigurationProperties + } + if scc.SystemData != nil { + objectMap["systemData"] = scc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SourceControlConfiguration struct. +func (scc *SourceControlConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sourceControlConfigurationProperties SourceControlConfigurationProperties + err = json.Unmarshal(*v, &sourceControlConfigurationProperties) + if err != nil { + return err + } + scc.SourceControlConfigurationProperties = &sourceControlConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + scc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scc.Type = &typeVar + } + } + } + + return nil +} + +// SourceControlConfigurationList result of the request to list Source Control Configurations. It contains +// a list of SourceControlConfiguration objects and a URL link to get the next set of results. +type SourceControlConfigurationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Source Control Configurations within a Kubernetes cluster. + Value *[]SourceControlConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationList. +func (sccl SourceControlConfigurationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SourceControlConfigurationListIterator provides access to a complete listing of +// SourceControlConfiguration values. +type SourceControlConfigurationListIterator struct { + i int + page SourceControlConfigurationListPage +} + +// 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 *SourceControlConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListIterator.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 *SourceControlConfigurationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SourceControlConfigurationListIterator) 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 SourceControlConfigurationListIterator) Response() SourceControlConfigurationList { + 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 SourceControlConfigurationListIterator) Value() SourceControlConfiguration { + if !iter.page.NotDone() { + return SourceControlConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SourceControlConfigurationListIterator type. +func NewSourceControlConfigurationListIterator(page SourceControlConfigurationListPage) SourceControlConfigurationListIterator { + return SourceControlConfigurationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sccl SourceControlConfigurationList) IsEmpty() bool { + return sccl.Value == nil || len(*sccl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sccl SourceControlConfigurationList) hasNextLink() bool { + return sccl.NextLink != nil && len(*sccl.NextLink) != 0 +} + +// sourceControlConfigurationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sccl SourceControlConfigurationList) sourceControlConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if !sccl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sccl.NextLink))) +} + +// SourceControlConfigurationListPage contains a page of SourceControlConfiguration values. +type SourceControlConfigurationListPage struct { + fn func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error) + sccl SourceControlConfigurationList +} + +// 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 *SourceControlConfigurationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListPage.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.sccl) + if err != nil { + return err + } + page.sccl = 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 *SourceControlConfigurationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SourceControlConfigurationListPage) NotDone() bool { + return !page.sccl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SourceControlConfigurationListPage) Response() SourceControlConfigurationList { + return page.sccl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SourceControlConfigurationListPage) Values() []SourceControlConfiguration { + if page.sccl.IsEmpty() { + return nil + } + return *page.sccl.Value +} + +// Creates a new instance of the SourceControlConfigurationListPage type. +func NewSourceControlConfigurationListPage(cur SourceControlConfigurationList, getNextPage func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error)) SourceControlConfigurationListPage { + return SourceControlConfigurationListPage{ + fn: getNextPage, + sccl: cur, + } +} + +// SourceControlConfigurationProperties properties to create a Source Control Configuration resource +type SourceControlConfigurationProperties struct { + // RepositoryURL - Url of the SourceControl Repository. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // OperatorNamespace - The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + OperatorNamespace *string `json:"operatorNamespace,omitempty"` + // OperatorInstanceName - Instance name of the operator - identifying the specific configuration. + OperatorInstanceName *string `json:"operatorInstanceName,omitempty"` + // OperatorType - Type of the operator. Possible values include: 'Flux' + OperatorType OperatorType `json:"operatorType,omitempty"` + // OperatorParams - Any Parameters for the Operator instance in string format. + OperatorParams *string `json:"operatorParams,omitempty"` + // ConfigurationProtectedSettings - Name-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // OperatorScope - Scope at which the operator will be installed. Possible values include: 'Cluster', 'Namespace' + OperatorScope OperatorScopeType `json:"operatorScope,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // SSHKnownHostsContents - Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances + SSHKnownHostsContents *string `json:"sshKnownHostsContents,omitempty"` + // EnableHelmOperator - Option to enable Helm Operator for this git configuration. + EnableHelmOperator *bool `json:"enableHelmOperator,omitempty"` + // HelmOperatorProperties - Properties for Helm operator. + HelmOperatorProperties *HelmOperatorProperties `json:"helmOperatorProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource provider. Possible values include: 'ProvisioningStateTypeAccepted', 'ProvisioningStateTypeDeleting', 'ProvisioningStateTypeRunning', 'ProvisioningStateTypeSucceeded', 'ProvisioningStateTypeFailed' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // ComplianceStatus - READ-ONLY; Compliance Status of the Configuration + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationProperties. +func (scc SourceControlConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.RepositoryURL != nil { + objectMap["repositoryUrl"] = scc.RepositoryURL + } + if scc.OperatorNamespace != nil { + objectMap["operatorNamespace"] = scc.OperatorNamespace + } + if scc.OperatorInstanceName != nil { + objectMap["operatorInstanceName"] = scc.OperatorInstanceName + } + if scc.OperatorType != "" { + objectMap["operatorType"] = scc.OperatorType + } + if scc.OperatorParams != nil { + objectMap["operatorParams"] = scc.OperatorParams + } + if scc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = scc.ConfigurationProtectedSettings + } + if scc.OperatorScope != "" { + objectMap["operatorScope"] = scc.OperatorScope + } + if scc.SSHKnownHostsContents != nil { + objectMap["sshKnownHostsContents"] = scc.SSHKnownHostsContents + } + if scc.EnableHelmOperator != nil { + objectMap["enableHelmOperator"] = scc.EnableHelmOperator + } + if scc.HelmOperatorProperties != nil { + objectMap["helmOperatorProperties"] = scc.HelmOperatorProperties + } + return json.Marshal(objectMap) +} + +// SourceControlConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SourceControlConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SourceControlConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SourceControlConfigurationsDeleteFuture) 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 SourceControlConfigurationsDeleteFuture.Result. +func (future *SourceControlConfigurationsDeleteFuture) result(client SourceControlConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.SourceControlConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SupportedScopes extension scopes +type SupportedScopes struct { + // DefaultScope - Default extension scopes: cluster or namespace + DefaultScope *string `json:"defaultScope,omitempty"` + // ClusterScopeSettings - Scope settings + ClusterScopeSettings *ClusterScopeSettings `json:"clusterScopeSettings,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/operations.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/operations.go new file mode 100644 index 000000000000..b62242a9ff6c --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/operations.go @@ -0,0 +1,140 @@ +package kubernetesconfiguration + +// 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 kubernetesConfiguration Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all the available operations the KubernetesConfiguration resource provider supports. +func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.rpol.Response.Response != nil { + sc = result.rpol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rpol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.rpol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.rpol.hasNextLink() && result.rpol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.KubernetesConfiguration/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 ResourceProviderOperationList, 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 ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { + req, err := lastResults.resourceProviderOperationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.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, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.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 ResourceProviderOperationListIterator, 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/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/operationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/operationstatus.go new file mode 100644 index 000000000000..ab307f579a8e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/operationstatus.go @@ -0,0 +1,260 @@ +package kubernetesconfiguration + +// 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" +) + +// OperationStatusClient is the kubernetesConfiguration Client +type OperationStatusClient struct { + BaseClient +} + +// NewOperationStatusClient creates an instance of the OperationStatusClient client. +func NewOperationStatusClient(subscriptionID string) OperationStatusClient { + return NewOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationStatusClientWithBaseURI creates an instance of the OperationStatusClient 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 NewOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) OperationStatusClient { + return OperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// operationID - operation Id +func (client OperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.OperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}", 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 OperationStatusClient) 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 OperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list Async Operations, currently in progress, in a cluster +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client OperationStatusClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result OperationStatusListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.List") + defer func() { + sc := -1 + if result.osl.Response.Response != nil { + sc = result.osl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.OperationStatusClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.osl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure sending request") + return + } + + result.osl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure responding to request") + return + } + if result.osl.hasNextLink() && result.osl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations", 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 OperationStatusClient) 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 OperationStatusClient) ListResponder(resp *http.Response) (result OperationStatusList, 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 OperationStatusClient) listNextResults(ctx context.Context, lastResults OperationStatusList) (result OperationStatusList, err error) { + req, err := lastResults.operationStatusListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "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, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationStatusClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result OperationStatusListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go new file mode 100644 index 000000000000..26a28c09c540 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -0,0 +1,451 @@ +package kubernetesconfiguration + +// 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" +) + +// SourceControlConfigurationsClient is the kubernetesConfiguration Client +type SourceControlConfigurationsClient struct { + BaseClient +} + +// NewSourceControlConfigurationsClient creates an instance of the SourceControlConfigurationsClient client. +func NewSourceControlConfigurationsClient(subscriptionID string) SourceControlConfigurationsClient { + return NewSourceControlConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSourceControlConfigurationsClientWithBaseURI creates an instance of the SourceControlConfigurationsClient 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 NewSourceControlConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlConfigurationsClient { + return SourceControlConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +// sourceControlConfiguration - properties necessary to Create KubernetesConfiguration. +func (client SourceControlConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, sourceControlConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SourceControlConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", pathParameters), + autorest.WithJSON(sourceControlConfiguration), + 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 SourceControlConfigurationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result SourceControlConfiguration, 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 this will delete the YAML file used to set up the Source control configuration, thus stopping future sync +// from the source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result SourceControlConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SourceControlConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) DeleteSender(req *http.Request) (future SourceControlConfigurationsDeleteFuture, 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 SourceControlConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details of the Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SourceControlConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) GetResponder(resp *http.Response) (result SourceControlConfiguration, 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 Source Control Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client SourceControlConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result SourceControlConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.sccl.Response.Response != nil { + sc = result.sccl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sccl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.sccl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.sccl.hasNextLink() && result.sccl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SourceControlConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) ListResponder(resp *http.Response) (result SourceControlConfigurationList, 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 SourceControlConfigurationsClient) listNextResults(ctx context.Context, lastResults SourceControlConfigurationList) (result SourceControlConfigurationList, err error) { + req, err := lastResults.sourceControlConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "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, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SourceControlConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result SourceControlConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/version.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/version.go new file mode 100644 index 000000000000..cd52ce9db8a0 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/version.go @@ -0,0 +1,19 @@ +package kubernetesconfiguration + +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() + " kubernetesconfiguration/2021-11-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/_meta.json new file mode 100644 index 000000000000..cf7e15b9d5d4 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "62dc7865a18791290f282ed54bcb1d4b1517af16", + "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "tag": "package-preview-2022-01", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2022-01 --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/kubernetesconfiguration/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/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/client.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/client.go new file mode 100644 index 000000000000..ad4f75523b32 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/client.go @@ -0,0 +1,42 @@ +// Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version +// 2022-01-01-preview. +// +// KubernetesConfiguration Client +package kubernetesconfiguration + +// 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 Kubernetesconfiguration + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Kubernetesconfiguration. +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/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/clusterextensiontype.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/clusterextensiontype.go new file mode 100644 index 000000000000..6b294911dcac --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/clusterextensiontype.go @@ -0,0 +1,126 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypeClient is the kubernetesConfiguration Client +type ClusterExtensionTypeClient struct { + BaseClient +} + +// NewClusterExtensionTypeClient creates an instance of the ClusterExtensionTypeClient client. +func NewClusterExtensionTypeClient(subscriptionID string) ClusterExtensionTypeClient { + return NewClusterExtensionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypeClientWithBaseURI creates an instance of the ClusterExtensionTypeClient 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 NewClusterExtensionTypeClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypeClient { + return ClusterExtensionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Extension Type details +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionTypeName - extension type name +func (client ClusterExtensionTypeClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionTypeName string) (result ExtensionType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypeClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ClusterExtensionTypeClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClusterExtensionTypeClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}", 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 ClusterExtensionTypeClient) 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 ClusterExtensionTypeClient) GetResponder(resp *http.Response) (result ExtensionType, 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/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/clusterextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/clusterextensiontypes.go new file mode 100644 index 000000000000..776de805a6b7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/clusterextensiontypes.go @@ -0,0 +1,166 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypesClient is the kubernetesConfiguration Client +type ClusterExtensionTypesClient struct { + BaseClient +} + +// NewClusterExtensionTypesClient creates an instance of the ClusterExtensionTypesClient client. +func NewClusterExtensionTypesClient(subscriptionID string) ClusterExtensionTypesClient { + return NewClusterExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypesClientWithBaseURI creates an instance of the ClusterExtensionTypesClient 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 NewClusterExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypesClient { + return ClusterExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get Extension Types +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ClusterExtensionTypesClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ClusterExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ClusterExtensionTypesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes", 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 ClusterExtensionTypesClient) 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 ClusterExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, 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 ClusterExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "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, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClusterExtensionTypesClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/enums.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/enums.go new file mode 100644 index 000000000000..f1ba81413eb6 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/enums.go @@ -0,0 +1,298 @@ +package kubernetesconfiguration + +// 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. + +// ClusterTypes enumerates the values for cluster types. +type ClusterTypes string + +const ( + // ConnectedClusters ... + ConnectedClusters ClusterTypes = "connectedClusters" + // ManagedClusters ... + ManagedClusters ClusterTypes = "managedClusters" +) + +// PossibleClusterTypesValues returns an array of possible values for the ClusterTypes const type. +func PossibleClusterTypesValues() []ClusterTypes { + return []ClusterTypes{ConnectedClusters, ManagedClusters} +} + +// ComplianceStateType enumerates the values for compliance state type. +type ComplianceStateType string + +const ( + // Compliant ... + Compliant ComplianceStateType = "Compliant" + // Failed ... + Failed ComplianceStateType = "Failed" + // Installed ... + Installed ComplianceStateType = "Installed" + // Noncompliant ... + Noncompliant ComplianceStateType = "Noncompliant" + // Pending ... + Pending ComplianceStateType = "Pending" +) + +// PossibleComplianceStateTypeValues returns an array of possible values for the ComplianceStateType const type. +func PossibleComplianceStateTypeValues() []ComplianceStateType { + return []ComplianceStateType{Compliant, Failed, Installed, Noncompliant, Pending} +} + +// 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} +} + +// ExtensionsClusterResourceName enumerates the values for extensions cluster resource name. +type ExtensionsClusterResourceName string + +const ( + // ExtensionsClusterResourceNameConnectedClusters ... + ExtensionsClusterResourceNameConnectedClusters ExtensionsClusterResourceName = "connectedClusters" + // ExtensionsClusterResourceNameManagedClusters ... + ExtensionsClusterResourceNameManagedClusters ExtensionsClusterResourceName = "managedClusters" +) + +// PossibleExtensionsClusterResourceNameValues returns an array of possible values for the ExtensionsClusterResourceName const type. +func PossibleExtensionsClusterResourceNameValues() []ExtensionsClusterResourceName { + return []ExtensionsClusterResourceName{ExtensionsClusterResourceNameConnectedClusters, ExtensionsClusterResourceNameManagedClusters} +} + +// ExtensionsClusterRp enumerates the values for extensions cluster rp. +type ExtensionsClusterRp string + +const ( + // MicrosoftContainerService ... + MicrosoftContainerService ExtensionsClusterRp = "Microsoft.ContainerService" + // MicrosoftKubernetes ... + MicrosoftKubernetes ExtensionsClusterRp = "Microsoft.Kubernetes" +) + +// PossibleExtensionsClusterRpValues returns an array of possible values for the ExtensionsClusterRp const type. +func PossibleExtensionsClusterRpValues() []ExtensionsClusterRp { + return []ExtensionsClusterRp{MicrosoftContainerService, MicrosoftKubernetes} +} + +// FluxComplianceState enumerates the values for flux compliance state. +type FluxComplianceState string + +const ( + // FluxComplianceStateCompliant ... + FluxComplianceStateCompliant FluxComplianceState = "Compliant" + // FluxComplianceStateNonCompliant ... + FluxComplianceStateNonCompliant FluxComplianceState = "Non-Compliant" + // FluxComplianceStatePending ... + FluxComplianceStatePending FluxComplianceState = "Pending" + // FluxComplianceStateSuspended ... + FluxComplianceStateSuspended FluxComplianceState = "Suspended" + // FluxComplianceStateUnknown ... + FluxComplianceStateUnknown FluxComplianceState = "Unknown" +) + +// PossibleFluxComplianceStateValues returns an array of possible values for the FluxComplianceState const type. +func PossibleFluxComplianceStateValues() []FluxComplianceState { + return []FluxComplianceState{FluxComplianceStateCompliant, FluxComplianceStateNonCompliant, FluxComplianceStatePending, FluxComplianceStateSuspended, FluxComplianceStateUnknown} +} + +// KustomizationValidationType enumerates the values for kustomization validation type. +type KustomizationValidationType string + +const ( + // Client ... + Client KustomizationValidationType = "client" + // None ... + None KustomizationValidationType = "none" + // Server ... + Server KustomizationValidationType = "server" +) + +// PossibleKustomizationValidationTypeValues returns an array of possible values for the KustomizationValidationType const type. +func PossibleKustomizationValidationTypeValues() []KustomizationValidationType { + return []KustomizationValidationType{Client, None, Server} +} + +// LevelType enumerates the values for level type. +type LevelType string + +const ( + // Error ... + Error LevelType = "Error" + // Information ... + Information LevelType = "Information" + // Warning ... + Warning LevelType = "Warning" +) + +// PossibleLevelTypeValues returns an array of possible values for the LevelType const type. +func PossibleLevelTypeValues() []LevelType { + return []LevelType{Error, Information, Warning} +} + +// MessageLevelType enumerates the values for message level type. +type MessageLevelType string + +const ( + // MessageLevelTypeError ... + MessageLevelTypeError MessageLevelType = "Error" + // MessageLevelTypeInformation ... + MessageLevelTypeInformation MessageLevelType = "Information" + // MessageLevelTypeWarning ... + MessageLevelTypeWarning MessageLevelType = "Warning" +) + +// PossibleMessageLevelTypeValues returns an array of possible values for the MessageLevelType const type. +func PossibleMessageLevelTypeValues() []MessageLevelType { + return []MessageLevelType{MessageLevelTypeError, MessageLevelTypeInformation, MessageLevelTypeWarning} +} + +// OperatorScopeType enumerates the values for operator scope type. +type OperatorScopeType string + +const ( + // Cluster ... + Cluster OperatorScopeType = "cluster" + // Namespace ... + Namespace OperatorScopeType = "namespace" +) + +// PossibleOperatorScopeTypeValues returns an array of possible values for the OperatorScopeType const type. +func PossibleOperatorScopeTypeValues() []OperatorScopeType { + return []OperatorScopeType{Cluster, Namespace} +} + +// OperatorType enumerates the values for operator type. +type OperatorType string + +const ( + // Flux ... + Flux OperatorType = "Flux" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{Flux} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ProvisioningStateType enumerates the values for provisioning state type. +type ProvisioningStateType string + +const ( + // ProvisioningStateTypeAccepted ... + ProvisioningStateTypeAccepted ProvisioningStateType = "Accepted" + // ProvisioningStateTypeDeleting ... + ProvisioningStateTypeDeleting ProvisioningStateType = "Deleting" + // ProvisioningStateTypeFailed ... + ProvisioningStateTypeFailed ProvisioningStateType = "Failed" + // ProvisioningStateTypeRunning ... + ProvisioningStateTypeRunning ProvisioningStateType = "Running" + // ProvisioningStateTypeSucceeded ... + ProvisioningStateTypeSucceeded ProvisioningStateType = "Succeeded" +) + +// PossibleProvisioningStateTypeValues returns an array of possible values for the ProvisioningStateType const type. +func PossibleProvisioningStateTypeValues() []ProvisioningStateType { + return []ProvisioningStateType{ProvisioningStateTypeAccepted, ProvisioningStateTypeDeleting, ProvisioningStateTypeFailed, ProvisioningStateTypeRunning, ProvisioningStateTypeSucceeded} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{SystemAssigned} +} + +// ScopeType enumerates the values for scope type. +type ScopeType string + +const ( + // ScopeTypeCluster ... + ScopeTypeCluster ScopeType = "cluster" + // ScopeTypeNamespace ... + ScopeTypeNamespace ScopeType = "namespace" +) + +// PossibleScopeTypeValues returns an array of possible values for the ScopeType const type. +func PossibleScopeTypeValues() []ScopeType { + return []ScopeType{ScopeTypeCluster, ScopeTypeNamespace} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic ... + Basic SkuTier = "Basic" + // Free ... + Free SkuTier = "Free" + // Premium ... + Premium SkuTier = "Premium" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Basic, Free, Premium, Standard} +} + +// SourceKindType enumerates the values for source kind type. +type SourceKindType string + +const ( + // Bucket ... + Bucket SourceKindType = "Bucket" + // GitRepository ... + GitRepository SourceKindType = "GitRepository" +) + +// PossibleSourceKindTypeValues returns an array of possible values for the SourceKindType const type. +func PossibleSourceKindTypeValues() []SourceKindType { + return []SourceKindType{Bucket, GitRepository} +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/extensions.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/extensions.go new file mode 100644 index 000000000000..58d8447bcc65 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/extensions.go @@ -0,0 +1,555 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionsClient is the kubernetesConfiguration Client +type ExtensionsClient struct { + BaseClient +} + +// NewExtensionsClient creates an instance of the ExtensionsClient client. +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient 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 NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a new Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// extension - properties necessary to Create an Extension. +func (client ExtensionsClient) Create(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, extension Extension) (result ExtensionsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExtensionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, extension Extension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(extension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) CreateSender(req *http.Request) (future ExtensionsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) CreateResponder(resp *http.Response) (result Extension, 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 Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, forceDelete *bool) (result ExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) DeleteSender(req *http.Request) (future ExtensionsDeleteFuture, 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 ExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string) (result Extension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) 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 ExtensionsClient) GetResponder(resp *http.Response) (result Extension, 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 Extensions in the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ExtensionsClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.List") + defer func() { + sc := -1 + if result.el.Response.Response != nil { + sc = result.el.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.el.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure sending request") + return + } + + result.el, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure responding to request") + return + } + if result.el.hasNextLink() && result.el.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions", 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 ExtensionsClient) 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 ExtensionsClient) ListResponder(resp *http.Response) (result ExtensionsList, 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 ExtensionsClient) listNextResults(ctx context.Context, lastResults ExtensionsList) (result ExtensionsList, err error) { + req, err := lastResults.extensionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "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, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.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, clusterRp, clusterResourceName, clusterName) + return +} + +// Update patch an existing Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// patchExtension - properties to Patch in an existing Extension. +func (client ExtensionsClient) Update(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, patchExtension PatchExtension) (result ExtensionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, patchExtension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, patchExtension PatchExtension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(patchExtension), + 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 ExtensionsClient) UpdateSender(req *http.Request) (future ExtensionsUpdateFuture, 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 ExtensionsClient) UpdateResponder(resp *http.Response) (result Extension, 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/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/extensiontypeversions.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/extensiontypeversions.go new file mode 100644 index 000000000000..1d727485f9fd --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/extensiontypeversions.go @@ -0,0 +1,157 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionTypeVersionsClient is the kubernetesConfiguration Client +type ExtensionTypeVersionsClient struct { + BaseClient +} + +// NewExtensionTypeVersionsClient creates an instance of the ExtensionTypeVersionsClient client. +func NewExtensionTypeVersionsClient(subscriptionID string) ExtensionTypeVersionsClient { + return NewExtensionTypeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionTypeVersionsClientWithBaseURI creates an instance of the ExtensionTypeVersionsClient 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 NewExtensionTypeVersionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTypeVersionsClient { + return ExtensionTypeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list available versions for an Extension Type +// Parameters: +// location - extension location +// extensionTypeName - extension type name +func (client ExtensionTypeVersionsClient) List(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.List") + defer func() { + sc := -1 + if result.evl.Response.Response != nil { + sc = result.evl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionTypeVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.evl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure sending request") + return + } + + result.evl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.evl.hasNextLink() && result.evl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionTypeVersionsClient) ListPreparer(ctx context.Context, location string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions", 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 ExtensionTypeVersionsClient) 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 ExtensionTypeVersionsClient) ListResponder(resp *http.Response) (result ExtensionVersionList, 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 ExtensionTypeVersionsClient) listNextResults(ctx context.Context, lastResults ExtensionVersionList) (result ExtensionVersionList, err error) { + req, err := lastResults.extensionVersionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "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, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionTypeVersionsClient) ListComplete(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.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, location, extensionTypeName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/fluxconfigoperationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/fluxconfigoperationstatus.go new file mode 100644 index 000000000000..a4229db101c7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/fluxconfigoperationstatus.go @@ -0,0 +1,128 @@ +package kubernetesconfiguration + +// 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" +) + +// FluxConfigOperationStatusClient is the kubernetesConfiguration Client +type FluxConfigOperationStatusClient struct { + BaseClient +} + +// NewFluxConfigOperationStatusClient creates an instance of the FluxConfigOperationStatusClient client. +func NewFluxConfigOperationStatusClient(subscriptionID string) FluxConfigOperationStatusClient { + return NewFluxConfigOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFluxConfigOperationStatusClientWithBaseURI creates an instance of the FluxConfigOperationStatusClient 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 NewFluxConfigOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) FluxConfigOperationStatusClient { + return FluxConfigOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// operationID - operation Id +func (client FluxConfigOperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigOperationStatusClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FluxConfigOperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}", 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 FluxConfigOperationStatusClient) 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 FluxConfigOperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, 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/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/fluxconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/fluxconfigurations.go new file mode 100644 index 000000000000..220ed8904bc7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/fluxconfigurations.go @@ -0,0 +1,557 @@ +package kubernetesconfiguration + +// 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" +) + +// FluxConfigurationsClient is the kubernetesConfiguration Client +type FluxConfigurationsClient struct { + BaseClient +} + +// NewFluxConfigurationsClient creates an instance of the FluxConfigurationsClient client. +func NewFluxConfigurationsClient(subscriptionID string) FluxConfigurationsClient { + return NewFluxConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFluxConfigurationsClientWithBaseURI creates an instance of the FluxConfigurationsClient 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 NewFluxConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) FluxConfigurationsClient { + return FluxConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// fluxConfiguration - properties necessary to Create a FluxConfiguration. +func (client FluxConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration) (result FluxConfigurationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FluxConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", pathParameters), + autorest.WithJSON(fluxConfiguration), + 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 FluxConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future FluxConfigurationsCreateOrUpdateFuture, 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 FluxConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result FluxConfiguration, 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 this will delete the YAML file used to set up the Flux Configuration, thus stopping future sync from the +// source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client FluxConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, forceDelete *bool) (result FluxConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FluxConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", 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 FluxConfigurationsClient) DeleteSender(req *http.Request) (future FluxConfigurationsDeleteFuture, 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 FluxConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details of the Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +func (client FluxConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string) (result FluxConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FluxConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", 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 FluxConfigurationsClient) 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 FluxConfigurationsClient) GetResponder(resp *http.Response) (result FluxConfiguration, 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 Flux Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client FluxConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result FluxConfigurationsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.List") + defer func() { + sc := -1 + if result.fcl.Response.Response != nil { + sc = result.fcl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.fcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.fcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.fcl.hasNextLink() && result.fcl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FluxConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations", 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 FluxConfigurationsClient) 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 FluxConfigurationsClient) ListResponder(resp *http.Response) (result FluxConfigurationsList, 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 FluxConfigurationsClient) listNextResults(ctx context.Context, lastResults FluxConfigurationsList) (result FluxConfigurationsList, err error) { + req, err := lastResults.fluxConfigurationsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "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, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client FluxConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result FluxConfigurationsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.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, clusterRp, clusterResourceName, clusterName) + return +} + +// Update update an existing Kubernetes Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// fluxConfigurationPatch - properties to Patch in an existing Flux Configuration. +func (client FluxConfigurationsClient) Update(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch) (result FluxConfigurationsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfigurationPatch) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FluxConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", pathParameters), + autorest.WithJSON(fluxConfigurationPatch), + 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 FluxConfigurationsClient) UpdateSender(req *http.Request) (future FluxConfigurationsUpdateFuture, 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 FluxConfigurationsClient) UpdateResponder(resp *http.Response) (result FluxConfiguration, 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/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go new file mode 100644 index 000000000000..d1f650a961a7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go @@ -0,0 +1,102 @@ +package kubernetesconfigurationapi + +// 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/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration" +) + +// ClusterExtensionTypeClientAPI contains the set of methods on the ClusterExtensionTypeClient type. +type ClusterExtensionTypeClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionTypeName string) (result kubernetesconfiguration.ExtensionType, err error) +} + +var _ ClusterExtensionTypeClientAPI = (*kubernetesconfiguration.ClusterExtensionTypeClient)(nil) + +// ClusterExtensionTypesClientAPI contains the set of methods on the ClusterExtensionTypesClient type. +type ClusterExtensionTypesClientAPI interface { + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ ClusterExtensionTypesClientAPI = (*kubernetesconfiguration.ClusterExtensionTypesClient)(nil) + +// ExtensionTypeVersionsClientAPI contains the set of methods on the ExtensionTypeVersionsClient type. +type ExtensionTypeVersionsClientAPI interface { + List(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListPage, err error) + ListComplete(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListIterator, err error) +} + +var _ ExtensionTypeVersionsClientAPI = (*kubernetesconfiguration.ExtensionTypeVersionsClient)(nil) + +// LocationExtensionTypesClientAPI contains the set of methods on the LocationExtensionTypesClient type. +type LocationExtensionTypesClientAPI interface { + List(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ LocationExtensionTypesClientAPI = (*kubernetesconfiguration.LocationExtensionTypesClient)(nil) + +// ExtensionsClientAPI contains the set of methods on the ExtensionsClient type. +type ExtensionsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, extension kubernetesconfiguration.Extension) (result kubernetesconfiguration.ExtensionsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, forceDelete *bool) (result kubernetesconfiguration.ExtensionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string) (result kubernetesconfiguration.Extension, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionsListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, patchExtension kubernetesconfiguration.PatchExtension) (result kubernetesconfiguration.ExtensionsUpdateFuture, err error) +} + +var _ ExtensionsClientAPI = (*kubernetesconfiguration.ExtensionsClient)(nil) + +// OperationStatusClientAPI contains the set of methods on the OperationStatusClient type. +type OperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.OperationStatusListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.OperationStatusListIterator, err error) +} + +var _ OperationStatusClientAPI = (*kubernetesconfiguration.OperationStatusClient)(nil) + +// FluxConfigurationsClientAPI contains the set of methods on the FluxConfigurationsClient type. +type FluxConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfiguration kubernetesconfiguration.FluxConfiguration) (result kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, forceDelete *bool) (result kubernetesconfiguration.FluxConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string) (result kubernetesconfiguration.FluxConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.FluxConfigurationsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.FluxConfigurationsListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfigurationPatch kubernetesconfiguration.FluxConfigurationPatch) (result kubernetesconfiguration.FluxConfigurationsUpdateFuture, err error) +} + +var _ FluxConfigurationsClientAPI = (*kubernetesconfiguration.FluxConfigurationsClient)(nil) + +// FluxConfigOperationStatusClientAPI contains the set of methods on the FluxConfigOperationStatusClient type. +type FluxConfigOperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) +} + +var _ FluxConfigOperationStatusClientAPI = (*kubernetesconfiguration.FluxConfigOperationStatusClient)(nil) + +// SourceControlConfigurationsClientAPI contains the set of methods on the SourceControlConfigurationsClient type. +type SourceControlConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration kubernetesconfiguration.SourceControlConfiguration) (result kubernetesconfiguration.SourceControlConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListIterator, err error) +} + +var _ SourceControlConfigurationsClientAPI = (*kubernetesconfiguration.SourceControlConfigurationsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListPage, err error) + ListComplete(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListIterator, err error) +} + +var _ OperationsClientAPI = (*kubernetesconfiguration.OperationsClient)(nil) diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/locationextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/locationextensiontypes.go new file mode 100644 index 000000000000..d8f4a8e9b76e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/locationextensiontypes.go @@ -0,0 +1,155 @@ +package kubernetesconfiguration + +// 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" +) + +// LocationExtensionTypesClient is the kubernetesConfiguration Client +type LocationExtensionTypesClient struct { + BaseClient +} + +// NewLocationExtensionTypesClient creates an instance of the LocationExtensionTypesClient client. +func NewLocationExtensionTypesClient(subscriptionID string) LocationExtensionTypesClient { + return NewLocationExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationExtensionTypesClientWithBaseURI creates an instance of the LocationExtensionTypesClient 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 NewLocationExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) LocationExtensionTypesClient { + return LocationExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all Extension Types +// Parameters: +// location - extension location +func (client LocationExtensionTypesClient) List(ctx context.Context, location string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.LocationExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LocationExtensionTypesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes", 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 LocationExtensionTypesClient) 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 LocationExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, 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 LocationExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "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, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocationExtensionTypesClient) ListComplete(ctx context.Context, location string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.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, location) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/models.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/models.go new file mode 100644 index 000000000000..acc2bf32ee4a --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/models.go @@ -0,0 +1,2880 @@ +package kubernetesconfiguration + +// 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/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration" + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BucketDefinition parameters to reconcile to the GitRepository source kind type. +type BucketDefinition struct { + // URL - The URL to sync for the flux configuration S3 bucket. + URL *string `json:"url,omitempty"` + // BucketName - The bucket name to sync from the url endpoint for the flux configuration. + BucketName *string `json:"bucketName,omitempty"` + // Insecure - Specify whether to use insecure communication when puling data from the S3 bucket. + Insecure *bool `json:"insecure,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // AccessKey - Plaintext access key used to securely access the S3 bucket + AccessKey *string `json:"accessKey,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// BucketPatchDefinition parameters to reconcile to the GitRepository source kind type. +type BucketPatchDefinition struct { + // URL - The URL to sync for the flux configuration S3 bucket. + URL *string `json:"url,omitempty"` + // BucketName - The bucket name to sync from the url endpoint for the flux configuration. + BucketName *string `json:"bucketName,omitempty"` + // Insecure - Specify whether to use insecure communication when puling data from the S3 bucket. + Insecure *bool `json:"insecure,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // AccessKey - Plaintext access key used to securely access the S3 bucket + AccessKey *string `json:"accessKey,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// ClusterScopeSettings extension scope settings +type ClusterScopeSettings struct { + // ClusterScopeSettingsProperties - Extension scope settings + *ClusterScopeSettingsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ClusterScopeSettings. +func (CSS ClusterScopeSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if CSS.ClusterScopeSettingsProperties != nil { + objectMap["properties"] = CSS.ClusterScopeSettingsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ClusterScopeSettings struct. +func (CSS *ClusterScopeSettings) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var clusterScopeSettingsProperties ClusterScopeSettingsProperties + err = json.Unmarshal(*v, &clusterScopeSettingsProperties) + if err != nil { + return err + } + CSS.ClusterScopeSettingsProperties = &clusterScopeSettingsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + CSS.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + CSS.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + CSS.Type = &typeVar + } + } + } + + return nil +} + +// ClusterScopeSettingsProperties extension scope settings +type ClusterScopeSettingsProperties struct { + // AllowMultipleInstances - Describes if multiple instances of the extension are allowed + AllowMultipleInstances *bool `json:"allowMultipleInstances,omitempty"` + // DefaultReleaseNamespace - Default extension release namespace + DefaultReleaseNamespace *string `json:"defaultReleaseNamespace,omitempty"` +} + +// ComplianceStatus compliance Status details +type ComplianceStatus struct { + // ComplianceState - READ-ONLY; The compliance state of the configuration. Possible values include: 'Pending', 'Compliant', 'Noncompliant', 'Installed', 'Failed' + ComplianceState ComplianceStateType `json:"complianceState,omitempty"` + // LastConfigApplied - Datetime the configuration was last applied. + LastConfigApplied *date.Time `json:"lastConfigApplied,omitempty"` + // Message - Message from when the configuration was applied. + Message *string `json:"message,omitempty"` + // MessageLevel - Level of the message. Possible values include: 'MessageLevelTypeError', 'MessageLevelTypeWarning', 'MessageLevelTypeInformation' + MessageLevel MessageLevelType `json:"messageLevel,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComplianceStatus. +func (cs ComplianceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.LastConfigApplied != nil { + objectMap["lastConfigApplied"] = cs.LastConfigApplied + } + if cs.Message != nil { + objectMap["message"] = cs.Message + } + if cs.MessageLevel != "" { + objectMap["messageLevel"] = cs.MessageLevel + } + return json.Marshal(objectMap) +} + +// DependsOnDefinition specify which kustomizations must succeed reconciliation on the cluster prior to +// reconciling this kustomization +type DependsOnDefinition struct { + // KustomizationName - Name of the kustomization to claim dependency on + KustomizationName *string `json:"kustomizationName,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// Extension the Extension object. +type Extension struct { + autorest.Response `json:"-"` + // ExtensionProperties - Properties of an Extension resource + *ExtensionProperties `json:"properties,omitempty"` + // Identity - Identity of the Extension resource + Identity *Identity `json:"identity,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Extension. +func (e Extension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionProperties != nil { + objectMap["properties"] = e.ExtensionProperties + } + if e.Identity != nil { + objectMap["identity"] = e.Identity + } + if e.SystemData != nil { + objectMap["systemData"] = e.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Extension struct. +func (e *Extension) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var extensionProperties ExtensionProperties + err = json.Unmarshal(*v, &extensionProperties) + if err != nil { + return err + } + e.ExtensionProperties = &extensionProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + e.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + e.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + } + } + + return nil +} + +// ExtensionProperties properties of an Extension resource +type ExtensionProperties struct { + // ExtensionType - Type of the Extension, of which this resource is an instance of. It must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + ExtensionType *string `json:"extensionType,omitempty"` + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // Scope - Scope at which the extension is installed. + Scope *Scope `json:"scope,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // ProvisioningState - READ-ONLY; Status of installation of this extension. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Statuses - Status from this extension. + Statuses *[]ExtensionStatus `json:"statuses,omitempty"` + // ErrorInfo - READ-ONLY; Error information from the Agent - e.g. errors during installation. + ErrorInfo *ErrorDetail `json:"errorInfo,omitempty"` + // CustomLocationSettings - READ-ONLY; Custom Location settings properties. + CustomLocationSettings map[string]*string `json:"customLocationSettings"` + // PackageURI - READ-ONLY; Uri of the Helm package + PackageURI *string `json:"packageUri,omitempty"` + // AksAssignedIdentity - Identity of the Extension resource in an AKS cluster + AksAssignedIdentity *ExtensionPropertiesAksAssignedIdentity `json:"aksAssignedIdentity,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionProperties. +func (e ExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionType != nil { + objectMap["extensionType"] = e.ExtensionType + } + if e.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = e.AutoUpgradeMinorVersion + } + if e.ReleaseTrain != nil { + objectMap["releaseTrain"] = e.ReleaseTrain + } + if e.Version != nil { + objectMap["version"] = e.Version + } + if e.Scope != nil { + objectMap["scope"] = e.Scope + } + if e.ConfigurationSettings != nil { + objectMap["configurationSettings"] = e.ConfigurationSettings + } + if e.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = e.ConfigurationProtectedSettings + } + if e.Statuses != nil { + objectMap["statuses"] = e.Statuses + } + if e.AksAssignedIdentity != nil { + objectMap["aksAssignedIdentity"] = e.AksAssignedIdentity + } + return json.Marshal(objectMap) +} + +// ExtensionPropertiesAksAssignedIdentity identity of the Extension resource in an AKS cluster +type ExtensionPropertiesAksAssignedIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionPropertiesAksAssignedIdentity. +func (eAi ExtensionPropertiesAksAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eAi.Type != "" { + objectMap["type"] = eAi.Type + } + return json.Marshal(objectMap) +} + +// ExtensionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsCreateFuture) 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 ExtensionsCreateFuture.Result. +func (future *ExtensionsCreateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsDeleteFuture) 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 ExtensionsDeleteFuture.Result. +func (future *ExtensionsDeleteFuture) result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExtensionsList result of the request to list Extensions. It contains a list of Extension objects and a +// URL link to get the next set of results. +type ExtensionsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Extensions within a Kubernetes cluster. + Value *[]Extension `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of extension objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionsList. +func (el ExtensionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionsListIterator provides access to a complete listing of Extension values. +type ExtensionsListIterator struct { + i int + page ExtensionsListPage +} + +// 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 *ExtensionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListIterator.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 *ExtensionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionsListIterator) 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 ExtensionsListIterator) Response() ExtensionsList { + 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 ExtensionsListIterator) Value() Extension { + if !iter.page.NotDone() { + return Extension{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionsListIterator type. +func NewExtensionsListIterator(page ExtensionsListPage) ExtensionsListIterator { + return ExtensionsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (el ExtensionsList) IsEmpty() bool { + return el.Value == nil || len(*el.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (el ExtensionsList) hasNextLink() bool { + return el.NextLink != nil && len(*el.NextLink) != 0 +} + +// extensionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (el ExtensionsList) extensionsListPreparer(ctx context.Context) (*http.Request, error) { + if !el.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(el.NextLink))) +} + +// ExtensionsListPage contains a page of Extension values. +type ExtensionsListPage struct { + fn func(context.Context, ExtensionsList) (ExtensionsList, error) + el ExtensionsList +} + +// 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 *ExtensionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListPage.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.el) + if err != nil { + return err + } + page.el = 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 *ExtensionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionsListPage) NotDone() bool { + return !page.el.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionsListPage) Response() ExtensionsList { + return page.el +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionsListPage) Values() []Extension { + if page.el.IsEmpty() { + return nil + } + return *page.el.Value +} + +// Creates a new instance of the ExtensionsListPage type. +func NewExtensionsListPage(cur ExtensionsList, getNextPage func(context.Context, ExtensionsList) (ExtensionsList, error)) ExtensionsListPage { + return ExtensionsListPage{ + fn: getNextPage, + el: cur, + } +} + +// ExtensionStatus status from the extension. +type ExtensionStatus struct { + // Code - Status code provided by the Extension + Code *string `json:"code,omitempty"` + // DisplayStatus - Short description of status of the extension. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Level - Level of the status. Possible values include: 'Error', 'Warning', 'Information' + Level LevelType `json:"level,omitempty"` + // Message - Detailed message of the status from the Extension. + Message *string `json:"message,omitempty"` + // Time - DateLiteral (per ISO8601) noting the time of installation status. + Time *string `json:"time,omitempty"` +} + +// ExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsUpdateFuture) 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 ExtensionsUpdateFuture.Result. +func (future *ExtensionsUpdateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.UpdateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsUpdateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionType represents an Extension Type. +type ExtensionType struct { + autorest.Response `json:"-"` + // ExtensionTypeProperties - Describes the Resource Type properties. + *ExtensionTypeProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionType. +func (et ExtensionType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if et.ExtensionTypeProperties != nil { + objectMap["properties"] = et.ExtensionTypeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExtensionType struct. +func (et *ExtensionType) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var extensionTypeProperties ExtensionTypeProperties + err = json.Unmarshal(*v, &extensionTypeProperties) + if err != nil { + return err + } + et.ExtensionTypeProperties = &extensionTypeProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + et.SystemData = &systemData + } + } + } + + return nil +} + +// ExtensionTypeList list Extension Types +type ExtensionTypeList struct { + autorest.Response `json:"-"` + // Value - The list of Extension Types + Value *[]ExtensionType `json:"value,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` +} + +// ExtensionTypeListIterator provides access to a complete listing of ExtensionType values. +type ExtensionTypeListIterator struct { + i int + page ExtensionTypeListPage +} + +// 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 *ExtensionTypeListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListIterator.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 *ExtensionTypeListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionTypeListIterator) 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 ExtensionTypeListIterator) Response() ExtensionTypeList { + 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 ExtensionTypeListIterator) Value() ExtensionType { + if !iter.page.NotDone() { + return ExtensionType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionTypeListIterator type. +func NewExtensionTypeListIterator(page ExtensionTypeListPage) ExtensionTypeListIterator { + return ExtensionTypeListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (etl ExtensionTypeList) IsEmpty() bool { + return etl.Value == nil || len(*etl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (etl ExtensionTypeList) hasNextLink() bool { + return etl.NextLink != nil && len(*etl.NextLink) != 0 +} + +// extensionTypeListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (etl ExtensionTypeList) extensionTypeListPreparer(ctx context.Context) (*http.Request, error) { + if !etl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(etl.NextLink))) +} + +// ExtensionTypeListPage contains a page of ExtensionType values. +type ExtensionTypeListPage struct { + fn func(context.Context, ExtensionTypeList) (ExtensionTypeList, error) + etl ExtensionTypeList +} + +// 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 *ExtensionTypeListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListPage.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.etl) + if err != nil { + return err + } + page.etl = 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 *ExtensionTypeListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionTypeListPage) NotDone() bool { + return !page.etl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionTypeListPage) Response() ExtensionTypeList { + return page.etl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionTypeListPage) Values() []ExtensionType { + if page.etl.IsEmpty() { + return nil + } + return *page.etl.Value +} + +// Creates a new instance of the ExtensionTypeListPage type. +func NewExtensionTypeListPage(cur ExtensionTypeList, getNextPage func(context.Context, ExtensionTypeList) (ExtensionTypeList, error)) ExtensionTypeListPage { + return ExtensionTypeListPage{ + fn: getNextPage, + etl: cur, + } +} + +// ExtensionTypeProperties properties of the connected cluster. +type ExtensionTypeProperties struct { + // ReleaseTrains - READ-ONLY; Extension release train: preview or stable + ReleaseTrains *[]string `json:"releaseTrains,omitempty"` + // ClusterTypes - READ-ONLY; Cluster types. Possible values include: 'ConnectedClusters', 'ManagedClusters' + ClusterTypes ClusterTypes `json:"clusterTypes,omitempty"` + // SupportedScopes - READ-ONLY; Extension scopes + SupportedScopes *SupportedScopes `json:"supportedScopes,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionTypeProperties. +func (etp ExtensionTypeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionVersionList list versions for an Extension +type ExtensionVersionList struct { + autorest.Response `json:"-"` + // Versions - Versions available for this Extension Type + Versions *[]ExtensionVersionListVersionsItem `json:"versions,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionVersionList. +func (evl ExtensionVersionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if evl.Versions != nil { + objectMap["versions"] = evl.Versions + } + if evl.NextLink != nil { + objectMap["nextLink"] = evl.NextLink + } + return json.Marshal(objectMap) +} + +// ExtensionVersionListIterator provides access to a complete listing of ExtensionVersionListVersionsItem +// values. +type ExtensionVersionListIterator struct { + i int + page ExtensionVersionListPage +} + +// 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 *ExtensionVersionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListIterator.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 *ExtensionVersionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionVersionListIterator) 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 ExtensionVersionListIterator) Response() ExtensionVersionList { + 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 ExtensionVersionListIterator) Value() ExtensionVersionListVersionsItem { + if !iter.page.NotDone() { + return ExtensionVersionListVersionsItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionVersionListIterator type. +func NewExtensionVersionListIterator(page ExtensionVersionListPage) ExtensionVersionListIterator { + return ExtensionVersionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (evl ExtensionVersionList) IsEmpty() bool { + return evl.Versions == nil || len(*evl.Versions) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (evl ExtensionVersionList) hasNextLink() bool { + return evl.NextLink != nil && len(*evl.NextLink) != 0 +} + +// extensionVersionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (evl ExtensionVersionList) extensionVersionListPreparer(ctx context.Context) (*http.Request, error) { + if !evl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(evl.NextLink))) +} + +// ExtensionVersionListPage contains a page of ExtensionVersionListVersionsItem values. +type ExtensionVersionListPage struct { + fn func(context.Context, ExtensionVersionList) (ExtensionVersionList, error) + evl ExtensionVersionList +} + +// 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 *ExtensionVersionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListPage.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.evl) + if err != nil { + return err + } + page.evl = 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 *ExtensionVersionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionVersionListPage) NotDone() bool { + return !page.evl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionVersionListPage) Response() ExtensionVersionList { + return page.evl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionVersionListPage) Values() []ExtensionVersionListVersionsItem { + if page.evl.IsEmpty() { + return nil + } + return *page.evl.Versions +} + +// Creates a new instance of the ExtensionVersionListPage type. +func NewExtensionVersionListPage(cur ExtensionVersionList, getNextPage func(context.Context, ExtensionVersionList) (ExtensionVersionList, error)) ExtensionVersionListPage { + return ExtensionVersionListPage{ + fn: getNextPage, + evl: cur, + } +} + +// ExtensionVersionListVersionsItem ... +type ExtensionVersionListVersionsItem struct { + // ReleaseTrain - The release train for this Extension Type + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Versions - Versions available for this Extension Type and release train + Versions *[]string `json:"versions,omitempty"` +} + +// FluxConfiguration the Flux Configuration object returned in Get & Put response. +type FluxConfiguration struct { + autorest.Response `json:"-"` + // FluxConfigurationProperties - Properties to create a Flux Configuration resource + *FluxConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfiguration. +func (fc FluxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fc.FluxConfigurationProperties != nil { + objectMap["properties"] = fc.FluxConfigurationProperties + } + if fc.SystemData != nil { + objectMap["systemData"] = fc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FluxConfiguration struct. +func (fc *FluxConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fluxConfigurationProperties FluxConfigurationProperties + err = json.Unmarshal(*v, &fluxConfigurationProperties) + if err != nil { + return err + } + fc.FluxConfigurationProperties = &fluxConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + fc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fc.Type = &typeVar + } + } + } + + return nil +} + +// FluxConfigurationPatch the Flux Configuration Patch Request object. +type FluxConfigurationPatch struct { + // FluxConfigurationPatchProperties - Updatable properties of an Flux Configuration Patch Request + *FluxConfigurationPatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationPatch. +func (fcp FluxConfigurationPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.FluxConfigurationPatchProperties != nil { + objectMap["properties"] = fcp.FluxConfigurationPatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FluxConfigurationPatch struct. +func (fcp *FluxConfigurationPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fluxConfigurationPatchProperties FluxConfigurationPatchProperties + err = json.Unmarshal(*v, &fluxConfigurationPatchProperties) + if err != nil { + return err + } + fcp.FluxConfigurationPatchProperties = &fluxConfigurationPatchProperties + } + } + } + + return nil +} + +// FluxConfigurationPatchProperties updatable properties of an Flux Configuration Patch Request +type FluxConfigurationPatchProperties struct { + // SourceKind - Source Kind to pull the configuration data from. Possible values include: 'GitRepository', 'Bucket' + SourceKind SourceKindType `json:"sourceKind,omitempty"` + // Suspend - Whether this configuration should suspend its reconciliation of its kustomizations and sources. + Suspend *bool `json:"suspend,omitempty"` + // GitRepository - Parameters to reconcile to the GitRepository source kind type. + GitRepository *GitRepositoryPatchDefinition `json:"gitRepository,omitempty"` + // Bucket - Parameters to reconcile to the Bucket source kind type. + Bucket *BucketDefinition `json:"bucket,omitempty"` + // Kustomizations - Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. + Kustomizations map[string]*KustomizationPatchDefinition `json:"kustomizations"` + // ConfigurationProtectedSettings - Key-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationPatchProperties. +func (fcp FluxConfigurationPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.SourceKind != "" { + objectMap["sourceKind"] = fcp.SourceKind + } + if fcp.Suspend != nil { + objectMap["suspend"] = fcp.Suspend + } + if fcp.GitRepository != nil { + objectMap["gitRepository"] = fcp.GitRepository + } + if fcp.Bucket != nil { + objectMap["bucket"] = fcp.Bucket + } + if fcp.Kustomizations != nil { + objectMap["kustomizations"] = fcp.Kustomizations + } + if fcp.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = fcp.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// FluxConfigurationProperties properties to create a Flux Configuration resource +type FluxConfigurationProperties struct { + // Scope - Scope at which the operator will be installed. Possible values include: 'ScopeTypeCluster', 'ScopeTypeNamespace' + Scope ScopeType `json:"scope,omitempty"` + // Namespace - The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + Namespace *string `json:"namespace,omitempty"` + // SourceKind - Source Kind to pull the configuration data from. Possible values include: 'GitRepository', 'Bucket' + SourceKind SourceKindType `json:"sourceKind,omitempty"` + // Suspend - Whether this configuration should suspend its reconciliation of its kustomizations and sources. + Suspend *bool `json:"suspend,omitempty"` + // GitRepository - Parameters to reconcile to the GitRepository source kind type. + GitRepository *GitRepositoryDefinition `json:"gitRepository,omitempty"` + // Bucket - Parameters to reconcile to the Bucket source kind type. + Bucket *BucketDefinition `json:"bucket,omitempty"` + // Kustomizations - Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. + Kustomizations map[string]*KustomizationDefinition `json:"kustomizations"` + // ConfigurationProtectedSettings - Key-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // Statuses - READ-ONLY; Statuses of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects provisioned by the fluxConfiguration. + Statuses *[]ObjectStatusDefinition `json:"statuses,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this fluxConfiguration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // LastSourceUpdatedCommitID - READ-ONLY; Branch and SHA of the last source commit synced with the cluster. + LastSourceUpdatedCommitID *string `json:"lastSourceUpdatedCommitId,omitempty"` + // LastSourceUpdatedAt - READ-ONLY; Datetime the fluxConfiguration last synced its source on the cluster. + LastSourceUpdatedAt *date.Time `json:"lastSourceUpdatedAt,omitempty"` + // ComplianceState - READ-ONLY; Combined status of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects. Possible values include: 'FluxComplianceStateCompliant', 'FluxComplianceStateNonCompliant', 'FluxComplianceStatePending', 'FluxComplianceStateSuspended', 'FluxComplianceStateUnknown' + ComplianceState FluxComplianceState `json:"complianceState,omitempty"` + // ProvisioningState - READ-ONLY; Status of the creation of the fluxConfiguration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ErrorMessage - READ-ONLY; Error message returned to the user in the case of provisioning failure. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationProperties. +func (fc FluxConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fc.Scope != "" { + objectMap["scope"] = fc.Scope + } + if fc.Namespace != nil { + objectMap["namespace"] = fc.Namespace + } + if fc.SourceKind != "" { + objectMap["sourceKind"] = fc.SourceKind + } + if fc.Suspend != nil { + objectMap["suspend"] = fc.Suspend + } + if fc.GitRepository != nil { + objectMap["gitRepository"] = fc.GitRepository + } + if fc.Bucket != nil { + objectMap["bucket"] = fc.Bucket + } + if fc.Kustomizations != nil { + objectMap["kustomizations"] = fc.Kustomizations + } + if fc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = fc.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// FluxConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (FluxConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsCreateOrUpdateFuture) 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 FluxConfigurationsCreateOrUpdateFuture.Result. +func (future *FluxConfigurationsCreateOrUpdateFuture) result(client FluxConfigurationsClient) (fc FluxConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fc.Response.Response, err = future.GetResult(sender); err == nil && fc.Response.Response.StatusCode != http.StatusNoContent { + fc, err = client.CreateOrUpdateResponder(fc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture", "Result", fc.Response.Response, "Failure responding to request") + } + } + return +} + +// FluxConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsDeleteFuture) 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 FluxConfigurationsDeleteFuture.Result. +func (future *FluxConfigurationsDeleteFuture) result(client FluxConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// FluxConfigurationsList result of the request to list Flux Configurations. It contains a list of +// FluxConfiguration objects and a URL link to get the next set of results. +type FluxConfigurationsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Flux Configurations within a Kubernetes cluster. + Value *[]FluxConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationsList. +func (fcl FluxConfigurationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FluxConfigurationsListIterator provides access to a complete listing of FluxConfiguration values. +type FluxConfigurationsListIterator struct { + i int + page FluxConfigurationsListPage +} + +// 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 *FluxConfigurationsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsListIterator.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 *FluxConfigurationsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FluxConfigurationsListIterator) 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 FluxConfigurationsListIterator) Response() FluxConfigurationsList { + 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 FluxConfigurationsListIterator) Value() FluxConfiguration { + if !iter.page.NotDone() { + return FluxConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FluxConfigurationsListIterator type. +func NewFluxConfigurationsListIterator(page FluxConfigurationsListPage) FluxConfigurationsListIterator { + return FluxConfigurationsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fcl FluxConfigurationsList) IsEmpty() bool { + return fcl.Value == nil || len(*fcl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fcl FluxConfigurationsList) hasNextLink() bool { + return fcl.NextLink != nil && len(*fcl.NextLink) != 0 +} + +// fluxConfigurationsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fcl FluxConfigurationsList) fluxConfigurationsListPreparer(ctx context.Context) (*http.Request, error) { + if !fcl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fcl.NextLink))) +} + +// FluxConfigurationsListPage contains a page of FluxConfiguration values. +type FluxConfigurationsListPage struct { + fn func(context.Context, FluxConfigurationsList) (FluxConfigurationsList, error) + fcl FluxConfigurationsList +} + +// 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 *FluxConfigurationsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsListPage.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.fcl) + if err != nil { + return err + } + page.fcl = 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 *FluxConfigurationsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FluxConfigurationsListPage) NotDone() bool { + return !page.fcl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FluxConfigurationsListPage) Response() FluxConfigurationsList { + return page.fcl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FluxConfigurationsListPage) Values() []FluxConfiguration { + if page.fcl.IsEmpty() { + return nil + } + return *page.fcl.Value +} + +// Creates a new instance of the FluxConfigurationsListPage type. +func NewFluxConfigurationsListPage(cur FluxConfigurationsList, getNextPage func(context.Context, FluxConfigurationsList) (FluxConfigurationsList, error)) FluxConfigurationsListPage { + return FluxConfigurationsListPage{ + fn: getNextPage, + fcl: cur, + } +} + +// FluxConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (FluxConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsUpdateFuture) 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 FluxConfigurationsUpdateFuture.Result. +func (future *FluxConfigurationsUpdateFuture) result(client FluxConfigurationsClient) (fc FluxConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fc.Response.Response, err = future.GetResult(sender); err == nil && fc.Response.Response.StatusCode != http.StatusNoContent { + fc, err = client.UpdateResponder(fc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsUpdateFuture", "Result", fc.Response.Response, "Failure responding to request") + } + } + return +} + +// GitRepositoryDefinition parameters to reconcile to the GitRepository source kind type. +type GitRepositoryDefinition struct { + // URL - The URL to sync for the flux configuration git repository. + URL *string `json:"url,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RepositoryRef - The source reference for the GitRepository object. + RepositoryRef *RepositoryRefDefinition `json:"repositoryRef,omitempty"` + // SSHKnownHosts - Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH + SSHKnownHosts *string `json:"sshKnownHosts,omitempty"` + // HTTPSUser - Plaintext HTTPS username used to access private git repositories over HTTPS + HTTPSUser *string `json:"httpsUser,omitempty"` + // HTTPSCACert - Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS + HTTPSCACert *string `json:"httpsCACert,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// GitRepositoryPatchDefinition parameters to reconcile to the GitRepository source kind type. +type GitRepositoryPatchDefinition struct { + // URL - The URL to sync for the flux configuration git repository. + URL *string `json:"url,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RepositoryRef - The source reference for the GitRepository object. + RepositoryRef *RepositoryRefDefinition `json:"repositoryRef,omitempty"` + // SSHKnownHosts - Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH + SSHKnownHosts *string `json:"sshKnownHosts,omitempty"` + // HTTPSUser - Plaintext HTTPS username used to access private git repositories over HTTPS + HTTPSUser *string `json:"httpsUser,omitempty"` + // HTTPSCACert - Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS + HTTPSCACert *string `json:"httpsCACert,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// HelmOperatorProperties properties for Helm operator. +type HelmOperatorProperties struct { + // ChartVersion - Version of the operator Helm chart. + ChartVersion *string `json:"chartVersion,omitempty"` + // ChartValues - Values override for the operator Helm chart. + ChartValues *string `json:"chartValues,omitempty"` +} + +// HelmReleasePropertiesDefinition ... +type HelmReleasePropertiesDefinition struct { + // LastRevisionApplied - The revision number of the last released object change + LastRevisionApplied *int64 `json:"lastRevisionApplied,omitempty"` + // HelmChartRef - The reference to the HelmChart object used as the source to this HelmRelease + HelmChartRef *ObjectReferenceDefinition `json:"helmChartRef,omitempty"` + // FailureCount - Total number of times that the HelmRelease failed to install or upgrade + FailureCount *int64 `json:"failureCount,omitempty"` + // InstallFailureCount - Number of times that the HelmRelease failed to install + InstallFailureCount *int64 `json:"installFailureCount,omitempty"` + // UpgradeFailureCount - Number of times that the HelmRelease failed to upgrade + UpgradeFailureCount *int64 `json:"upgradeFailureCount,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + +// KustomizationDefinition the Kustomization defining how to reconcile the artifact pulled by the source +// type on the cluster. +type KustomizationDefinition struct { + // Path - The path in the source reference to reconcile on the cluster. + Path *string `json:"path,omitempty"` + // DependsOn - Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. + DependsOn *[]DependsOnDefinition `json:"dependsOn,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the Kustomization on the cluster. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RetryIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster in the event of failure on reconciliation. + RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` + // Prune - Enable/disable garbage collections of Kubernetes objects created by this Kustomization. + Prune *bool `json:"prune,omitempty"` + // Force - Enable/disable re-creating Kubernetes resources on the cluster when patching fails due to an immutable field change. + Force *bool `json:"force,omitempty"` +} + +// KustomizationPatchDefinition the Kustomization defining how to reconcile the artifact pulled by the +// source type on the cluster. +type KustomizationPatchDefinition struct { + // Path - The path in the source reference to reconcile on the cluster. + Path *string `json:"path,omitempty"` + // DependsOn - Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. + DependsOn *[]DependsOnDefinition `json:"dependsOn,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the Kustomization on the cluster. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RetryIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster in the event of failure on reconciliation. + RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` + // Prune - Enable/disable garbage collections of Kubernetes objects created by this Kustomization. + Prune *bool `json:"prune,omitempty"` + // Force - Enable/disable re-creating Kubernetes resources on the cluster when patching fails due to an immutable field change. + Force *bool `json:"force,omitempty"` +} + +// ObjectReferenceDefinition object reference to a Kubernetes object on a cluster +type ObjectReferenceDefinition struct { + // Name - Name of the object + Name *string `json:"name,omitempty"` + // Namespace - Namespace of the object + Namespace *string `json:"namespace,omitempty"` +} + +// ObjectStatusConditionDefinition status condition of Kubernetes object +type ObjectStatusConditionDefinition struct { + // LastTransitionTime - Last time this status condition has changed + LastTransitionTime *date.Time `json:"lastTransitionTime,omitempty"` + // Message - A more verbose description of the object status condition + Message *string `json:"message,omitempty"` + // Reason - Reason for the specified status condition type status + Reason *string `json:"reason,omitempty"` + // Status - Status of the Kubernetes object condition type + Status *string `json:"status,omitempty"` + // Type - Object status condition type for this object + Type *string `json:"type,omitempty"` +} + +// ObjectStatusDefinition statuses of objects deployed by the user-specified kustomizations from the git +// repository. +type ObjectStatusDefinition struct { + // Name - Name of the applied object + Name *string `json:"name,omitempty"` + // Namespace - Namespace of the applied object + Namespace *string `json:"namespace,omitempty"` + // Kind - Kind of the applied object + Kind *string `json:"kind,omitempty"` + // ComplianceState - Compliance state of the applied object showing whether the applied object has come into a ready state on the cluster. Possible values include: 'FluxComplianceStateCompliant', 'FluxComplianceStateNonCompliant', 'FluxComplianceStatePending', 'FluxComplianceStateSuspended', 'FluxComplianceStateUnknown' + ComplianceState FluxComplianceState `json:"complianceState,omitempty"` + // AppliedBy - Object reference to the Kustomization that applied this object + AppliedBy *ObjectReferenceDefinition `json:"appliedBy,omitempty"` + // StatusConditions - List of Kubernetes object status conditions present on the cluster + StatusConditions *[]ObjectStatusConditionDefinition `json:"statusConditions,omitempty"` + // HelmReleaseProperties - Additional properties that are provided from objects of the HelmRelease kind + HelmReleaseProperties *HelmReleasePropertiesDefinition `json:"helmReleaseProperties,omitempty"` +} + +// OperationStatusList the async operations in progress, in the cluster. +type OperationStatusList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of async operations in progress, in the cluster. + Value *[]OperationStatusResult `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of Operation Result objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusList. +func (osl OperationStatusList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationStatusListIterator provides access to a complete listing of OperationStatusResult values. +type OperationStatusListIterator struct { + i int + page OperationStatusListPage +} + +// 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 *OperationStatusListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListIterator.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 *OperationStatusListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationStatusListIterator) 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 OperationStatusListIterator) Response() OperationStatusList { + 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 OperationStatusListIterator) Value() OperationStatusResult { + if !iter.page.NotDone() { + return OperationStatusResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationStatusListIterator type. +func NewOperationStatusListIterator(page OperationStatusListPage) OperationStatusListIterator { + return OperationStatusListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (osl OperationStatusList) IsEmpty() bool { + return osl.Value == nil || len(*osl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (osl OperationStatusList) hasNextLink() bool { + return osl.NextLink != nil && len(*osl.NextLink) != 0 +} + +// operationStatusListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (osl OperationStatusList) operationStatusListPreparer(ctx context.Context) (*http.Request, error) { + if !osl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(osl.NextLink))) +} + +// OperationStatusListPage contains a page of OperationStatusResult values. +type OperationStatusListPage struct { + fn func(context.Context, OperationStatusList) (OperationStatusList, error) + osl OperationStatusList +} + +// 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 *OperationStatusListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListPage.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.osl) + if err != nil { + return err + } + page.osl = 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 *OperationStatusListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationStatusListPage) NotDone() bool { + return !page.osl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationStatusListPage) Response() OperationStatusList { + return page.osl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationStatusListPage) Values() []OperationStatusResult { + if page.osl.IsEmpty() { + return nil + } + return *page.osl.Value +} + +// Creates a new instance of the OperationStatusListPage type. +func NewOperationStatusListPage(cur OperationStatusList, getNextPage func(context.Context, OperationStatusList) (OperationStatusList, error)) OperationStatusListPage { + return OperationStatusListPage{ + fn: getNextPage, + osl: cur, + } +} + +// OperationStatusResult the current status of an async operation. +type OperationStatusResult struct { + autorest.Response `json:"-"` + // ID - Fully qualified ID for the async operation. + ID *string `json:"id,omitempty"` + // Name - Name of the async operation. + Name *string `json:"name,omitempty"` + // Status - Operation status. + Status *string `json:"status,omitempty"` + // Properties - Additional information, if available. + Properties map[string]*string `json:"properties"` + // Error - READ-ONLY; If present, details of the operation error. + Error *ErrorDetail `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusResult. +func (osr OperationStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if osr.ID != nil { + objectMap["id"] = osr.ID + } + if osr.Name != nil { + objectMap["name"] = osr.Name + } + if osr.Status != nil { + objectMap["status"] = osr.Status + } + if osr.Properties != nil { + objectMap["properties"] = osr.Properties + } + return json.Marshal(objectMap) +} + +// PatchExtension the Extension Patch Request object. +type PatchExtension struct { + // PatchExtensionProperties - Updatable properties of an Extension Patch Request + *PatchExtensionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PatchExtension. +func (peVar PatchExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.PatchExtensionProperties != nil { + objectMap["properties"] = peVar.PatchExtensionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PatchExtension struct. +func (peVar *PatchExtension) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var patchExtensionProperties PatchExtensionProperties + err = json.Unmarshal(*v, &patchExtensionProperties) + if err != nil { + return err + } + peVar.PatchExtensionProperties = &patchExtensionProperties + } + } + } + + return nil +} + +// PatchExtensionProperties updatable properties of an Extension Patch Request +type PatchExtensionProperties struct { + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` +} + +// MarshalJSON is the custom marshaler for PatchExtensionProperties. +func (peVar PatchExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = peVar.AutoUpgradeMinorVersion + } + if peVar.ReleaseTrain != nil { + objectMap["releaseTrain"] = peVar.ReleaseTrain + } + if peVar.Version != nil { + objectMap["version"] = peVar.Version + } + if peVar.ConfigurationSettings != nil { + objectMap["configurationSettings"] = peVar.ConfigurationSettings + } + if peVar.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = peVar.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// Plan plan for the resource. +type Plan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RepositoryRefDefinition the source reference for the GitRepository object. +type RepositoryRefDefinition struct { + // Branch - The git repository branch name to checkout. + Branch *string `json:"branch,omitempty"` + // Tag - The git repository tag name to checkout. This takes precedence over branch. + Tag *string `json:"tag,omitempty"` + // Semver - The semver range used to match against git repository tags. This takes precedence over tag. + Semver *string `json:"semver,omitempty"` + // Commit - The commit SHA to checkout. This value must be combined with the branch name to be valid. This takes precedence over semver. + Commit *string `json:"commit,omitempty"` +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed +// properties for a resource. Except properties bag, there cannot be a top level property outside of this +// set. +type ResourceModelWithAllowedPropertySet struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + ManagedBy *string `json:"managedBy,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` + Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. +func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Location != nil { + objectMap["location"] = rmwaps.Location + } + if rmwaps.ManagedBy != nil { + objectMap["managedBy"] = rmwaps.ManagedBy + } + if rmwaps.Kind != nil { + objectMap["kind"] = rmwaps.Kind + } + if rmwaps.Tags != nil { + objectMap["tags"] = rmwaps.Tags + } + if rmwaps.Identity != nil { + objectMap["identity"] = rmwaps.Identity + } + if rmwaps.Sku != nil { + objectMap["sku"] = rmwaps.Sku + } + if rmwaps.Plan != nil { + objectMap["plan"] = rmwaps.Plan + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetIdentity ... +type ResourceModelWithAllowedPropertySetIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. +func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Type != "" { + objectMap["type"] = rmwaps.Type + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetPlan ... +type ResourceModelWithAllowedPropertySetPlan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ResourceModelWithAllowedPropertySetSku ... +type ResourceModelWithAllowedPropertySetSku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// ResourceProviderOperation supported operation of this resource provider. +type ResourceProviderOperation struct { + // Name - Operation name, in format of {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *ResourceProviderOperationDisplay `json:"display,omitempty"` + // IsDataAction - READ-ONLY; The flag that indicates whether the operation applies to data plane. + IsDataAction *bool `json:"isDataAction,omitempty"` + // Origin - READ-ONLY; Origin of the operation + Origin *string `json:"origin,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperation. +func (rpo ResourceProviderOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpo.Name != nil { + objectMap["name"] = rpo.Name + } + if rpo.Display != nil { + objectMap["display"] = rpo.Display + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationDisplay display metadata associated with the operation. +type ResourceProviderOperationDisplay struct { + // Provider - Resource provider: Microsoft KubernetesConfiguration. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of this operation. + Description *string `json:"description,omitempty"` +} + +// ResourceProviderOperationList result of the request to list operations. +type ResourceProviderOperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by this resource provider. + Value *[]ResourceProviderOperation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperationList. +func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpol.Value != nil { + objectMap["value"] = rpol.Value + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation +// values. +type ResourceProviderOperationListIterator struct { + i int + page ResourceProviderOperationListPage +} + +// 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 *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.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 *ResourceProviderOperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceProviderOperationListIterator) 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 ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { + 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 ResourceProviderOperationListIterator) Value() ResourceProviderOperation { + if !iter.page.NotDone() { + return ResourceProviderOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceProviderOperationListIterator type. +func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { + return ResourceProviderOperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rpol ResourceProviderOperationList) IsEmpty() bool { + return rpol.Value == nil || len(*rpol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rpol ResourceProviderOperationList) hasNextLink() bool { + return rpol.NextLink != nil && len(*rpol.NextLink) != 0 +} + +// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { + if !rpol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rpol.NextLink))) +} + +// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. +type ResourceProviderOperationListPage struct { + fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) + rpol ResourceProviderOperationList +} + +// 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 *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.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.rpol) + if err != nil { + return err + } + page.rpol = 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 *ResourceProviderOperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceProviderOperationListPage) NotDone() bool { + return !page.rpol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { + return page.rpol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { + if page.rpol.IsEmpty() { + return nil + } + return *page.rpol.Value +} + +// Creates a new instance of the ResourceProviderOperationListPage type. +func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { + return ResourceProviderOperationListPage{ + fn: getNextPage, + rpol: cur, + } +} + +// Scope scope of the extension. It can be either Cluster or Namespace; but not both. +type Scope struct { + // Cluster - Specifies that the scope of the extension is Cluster + Cluster *ScopeCluster `json:"cluster,omitempty"` + // Namespace - Specifies that the scope of the extension is Namespace + Namespace *ScopeNamespace `json:"namespace,omitempty"` +} + +// ScopeCluster specifies that the scope of the extension is Cluster +type ScopeCluster struct { + // ReleaseNamespace - Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created + ReleaseNamespace *string `json:"releaseNamespace,omitempty"` +} + +// ScopeNamespace specifies that the scope of the extension is Namespace +type ScopeNamespace struct { + // TargetNamespace - Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +// Sku the resource model definition representing SKU +type Sku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// SourceControlConfiguration the SourceControl Configuration object returned in Get & Put response. +type SourceControlConfiguration struct { + autorest.Response `json:"-"` + // SourceControlConfigurationProperties - Properties to create a Source Control Configuration resource + *SourceControlConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfiguration. +func (scc SourceControlConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.SourceControlConfigurationProperties != nil { + objectMap["properties"] = scc.SourceControlConfigurationProperties + } + if scc.SystemData != nil { + objectMap["systemData"] = scc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SourceControlConfiguration struct. +func (scc *SourceControlConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sourceControlConfigurationProperties SourceControlConfigurationProperties + err = json.Unmarshal(*v, &sourceControlConfigurationProperties) + if err != nil { + return err + } + scc.SourceControlConfigurationProperties = &sourceControlConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + scc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scc.Type = &typeVar + } + } + } + + return nil +} + +// SourceControlConfigurationList result of the request to list Source Control Configurations. It contains +// a list of SourceControlConfiguration objects and a URL link to get the next set of results. +type SourceControlConfigurationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Source Control Configurations within a Kubernetes cluster. + Value *[]SourceControlConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationList. +func (sccl SourceControlConfigurationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SourceControlConfigurationListIterator provides access to a complete listing of +// SourceControlConfiguration values. +type SourceControlConfigurationListIterator struct { + i int + page SourceControlConfigurationListPage +} + +// 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 *SourceControlConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListIterator.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 *SourceControlConfigurationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SourceControlConfigurationListIterator) 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 SourceControlConfigurationListIterator) Response() SourceControlConfigurationList { + 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 SourceControlConfigurationListIterator) Value() SourceControlConfiguration { + if !iter.page.NotDone() { + return SourceControlConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SourceControlConfigurationListIterator type. +func NewSourceControlConfigurationListIterator(page SourceControlConfigurationListPage) SourceControlConfigurationListIterator { + return SourceControlConfigurationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sccl SourceControlConfigurationList) IsEmpty() bool { + return sccl.Value == nil || len(*sccl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sccl SourceControlConfigurationList) hasNextLink() bool { + return sccl.NextLink != nil && len(*sccl.NextLink) != 0 +} + +// sourceControlConfigurationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sccl SourceControlConfigurationList) sourceControlConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if !sccl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sccl.NextLink))) +} + +// SourceControlConfigurationListPage contains a page of SourceControlConfiguration values. +type SourceControlConfigurationListPage struct { + fn func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error) + sccl SourceControlConfigurationList +} + +// 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 *SourceControlConfigurationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListPage.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.sccl) + if err != nil { + return err + } + page.sccl = 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 *SourceControlConfigurationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SourceControlConfigurationListPage) NotDone() bool { + return !page.sccl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SourceControlConfigurationListPage) Response() SourceControlConfigurationList { + return page.sccl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SourceControlConfigurationListPage) Values() []SourceControlConfiguration { + if page.sccl.IsEmpty() { + return nil + } + return *page.sccl.Value +} + +// Creates a new instance of the SourceControlConfigurationListPage type. +func NewSourceControlConfigurationListPage(cur SourceControlConfigurationList, getNextPage func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error)) SourceControlConfigurationListPage { + return SourceControlConfigurationListPage{ + fn: getNextPage, + sccl: cur, + } +} + +// SourceControlConfigurationProperties properties to create a Source Control Configuration resource +type SourceControlConfigurationProperties struct { + // RepositoryURL - Url of the SourceControl Repository. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // OperatorNamespace - The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + OperatorNamespace *string `json:"operatorNamespace,omitempty"` + // OperatorInstanceName - Instance name of the operator - identifying the specific configuration. + OperatorInstanceName *string `json:"operatorInstanceName,omitempty"` + // OperatorType - Type of the operator. Possible values include: 'Flux' + OperatorType OperatorType `json:"operatorType,omitempty"` + // OperatorParams - Any Parameters for the Operator instance in string format. + OperatorParams *string `json:"operatorParams,omitempty"` + // ConfigurationProtectedSettings - Name-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // OperatorScope - Scope at which the operator will be installed. Possible values include: 'Cluster', 'Namespace' + OperatorScope OperatorScopeType `json:"operatorScope,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // SSHKnownHostsContents - Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances + SSHKnownHostsContents *string `json:"sshKnownHostsContents,omitempty"` + // EnableHelmOperator - Option to enable Helm Operator for this git configuration. + EnableHelmOperator *bool `json:"enableHelmOperator,omitempty"` + // HelmOperatorProperties - Properties for Helm operator. + HelmOperatorProperties *HelmOperatorProperties `json:"helmOperatorProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource provider. Possible values include: 'ProvisioningStateTypeAccepted', 'ProvisioningStateTypeDeleting', 'ProvisioningStateTypeRunning', 'ProvisioningStateTypeSucceeded', 'ProvisioningStateTypeFailed' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // ComplianceStatus - READ-ONLY; Compliance Status of the Configuration + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationProperties. +func (scc SourceControlConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.RepositoryURL != nil { + objectMap["repositoryUrl"] = scc.RepositoryURL + } + if scc.OperatorNamespace != nil { + objectMap["operatorNamespace"] = scc.OperatorNamespace + } + if scc.OperatorInstanceName != nil { + objectMap["operatorInstanceName"] = scc.OperatorInstanceName + } + if scc.OperatorType != "" { + objectMap["operatorType"] = scc.OperatorType + } + if scc.OperatorParams != nil { + objectMap["operatorParams"] = scc.OperatorParams + } + if scc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = scc.ConfigurationProtectedSettings + } + if scc.OperatorScope != "" { + objectMap["operatorScope"] = scc.OperatorScope + } + if scc.SSHKnownHostsContents != nil { + objectMap["sshKnownHostsContents"] = scc.SSHKnownHostsContents + } + if scc.EnableHelmOperator != nil { + objectMap["enableHelmOperator"] = scc.EnableHelmOperator + } + if scc.HelmOperatorProperties != nil { + objectMap["helmOperatorProperties"] = scc.HelmOperatorProperties + } + return json.Marshal(objectMap) +} + +// SourceControlConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SourceControlConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SourceControlConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SourceControlConfigurationsDeleteFuture) 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 SourceControlConfigurationsDeleteFuture.Result. +func (future *SourceControlConfigurationsDeleteFuture) result(client SourceControlConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.SourceControlConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SupportedScopes extension scopes +type SupportedScopes struct { + // DefaultScope - Default extension scopes: cluster or namespace + DefaultScope *string `json:"defaultScope,omitempty"` + // ClusterScopeSettings - Scope settings + ClusterScopeSettings *ClusterScopeSettings `json:"clusterScopeSettings,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/operations.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/operations.go new file mode 100644 index 000000000000..b08a45c050b4 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/operations.go @@ -0,0 +1,140 @@ +package kubernetesconfiguration + +// 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 kubernetesConfiguration Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all the available operations the KubernetesConfiguration resource provider supports. +func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.rpol.Response.Response != nil { + sc = result.rpol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rpol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.rpol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.rpol.hasNextLink() && result.rpol.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-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.KubernetesConfiguration/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 ResourceProviderOperationList, 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 ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { + req, err := lastResults.resourceProviderOperationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.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, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.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 ResourceProviderOperationListIterator, 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/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/operationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/operationstatus.go new file mode 100644 index 000000000000..0a88f703e9e9 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/operationstatus.go @@ -0,0 +1,260 @@ +package kubernetesconfiguration + +// 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" +) + +// OperationStatusClient is the kubernetesConfiguration Client +type OperationStatusClient struct { + BaseClient +} + +// NewOperationStatusClient creates an instance of the OperationStatusClient client. +func NewOperationStatusClient(subscriptionID string) OperationStatusClient { + return NewOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationStatusClientWithBaseURI creates an instance of the OperationStatusClient 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 NewOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) OperationStatusClient { + return OperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// operationID - operation Id +func (client OperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.OperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}", 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 OperationStatusClient) 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 OperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list Async Operations, currently in progress, in a cluster +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client OperationStatusClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result OperationStatusListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.List") + defer func() { + sc := -1 + if result.osl.Response.Response != nil { + sc = result.osl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.OperationStatusClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.osl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure sending request") + return + } + + result.osl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure responding to request") + return + } + if result.osl.hasNextLink() && result.osl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations", 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 OperationStatusClient) 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 OperationStatusClient) ListResponder(resp *http.Response) (result OperationStatusList, 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 OperationStatusClient) listNextResults(ctx context.Context, lastResults OperationStatusList) (result OperationStatusList, err error) { + req, err := lastResults.operationStatusListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "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, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationStatusClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result OperationStatusListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go new file mode 100644 index 000000000000..bf36d87ae8b2 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -0,0 +1,451 @@ +package kubernetesconfiguration + +// 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" +) + +// SourceControlConfigurationsClient is the kubernetesConfiguration Client +type SourceControlConfigurationsClient struct { + BaseClient +} + +// NewSourceControlConfigurationsClient creates an instance of the SourceControlConfigurationsClient client. +func NewSourceControlConfigurationsClient(subscriptionID string) SourceControlConfigurationsClient { + return NewSourceControlConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSourceControlConfigurationsClientWithBaseURI creates an instance of the SourceControlConfigurationsClient 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 NewSourceControlConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlConfigurationsClient { + return SourceControlConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +// sourceControlConfiguration - properties necessary to Create KubernetesConfiguration. +func (client SourceControlConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, sourceControlConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SourceControlConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", pathParameters), + autorest.WithJSON(sourceControlConfiguration), + 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 SourceControlConfigurationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result SourceControlConfiguration, 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 this will delete the YAML file used to set up the Source control configuration, thus stopping future sync +// from the source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result SourceControlConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SourceControlConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) DeleteSender(req *http.Request) (future SourceControlConfigurationsDeleteFuture, 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 SourceControlConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details of the Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SourceControlConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) GetResponder(resp *http.Response) (result SourceControlConfiguration, 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 Source Control Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client SourceControlConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result SourceControlConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.sccl.Response.Response != nil { + sc = result.sccl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sccl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.sccl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.sccl.hasNextLink() && result.sccl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SourceControlConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) ListResponder(resp *http.Response) (result SourceControlConfigurationList, 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 SourceControlConfigurationsClient) listNextResults(ctx context.Context, lastResults SourceControlConfigurationList) (result SourceControlConfigurationList, err error) { + req, err := lastResults.sourceControlConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "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, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SourceControlConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result SourceControlConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/version.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/version.go new file mode 100644 index 000000000000..2ccd3aede340 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/version.go @@ -0,0 +1,19 @@ +package kubernetesconfiguration + +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() + " kubernetesconfiguration/2022-01-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/_meta.json new file mode 100644 index 000000000000..ab0ae325cfa8 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "62dc7865a18791290f282ed54bcb1d4b1517af16", + "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "tag": "package-preview-2022-01-15", + "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-01-15 --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/kubernetesconfiguration/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/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/client.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/client.go new file mode 100644 index 000000000000..937988ca0f57 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/client.go @@ -0,0 +1,41 @@ +// Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version . +// +// KubernetesConfiguration Client +package kubernetesconfiguration + +// 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 Kubernetesconfiguration + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Kubernetesconfiguration. +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/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/clusterextensiontype.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/clusterextensiontype.go new file mode 100644 index 000000000000..d6d113a13780 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/clusterextensiontype.go @@ -0,0 +1,126 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypeClient is the kubernetesConfiguration Client +type ClusterExtensionTypeClient struct { + BaseClient +} + +// NewClusterExtensionTypeClient creates an instance of the ClusterExtensionTypeClient client. +func NewClusterExtensionTypeClient(subscriptionID string) ClusterExtensionTypeClient { + return NewClusterExtensionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypeClientWithBaseURI creates an instance of the ClusterExtensionTypeClient 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 NewClusterExtensionTypeClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypeClient { + return ClusterExtensionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Extension Type details +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionTypeName - extension type name +func (client ClusterExtensionTypeClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionTypeName string) (result ExtensionType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypeClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ClusterExtensionTypeClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClusterExtensionTypeClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}", 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 ClusterExtensionTypeClient) 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 ClusterExtensionTypeClient) GetResponder(resp *http.Response) (result ExtensionType, 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/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/clusterextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/clusterextensiontypes.go new file mode 100644 index 000000000000..bcb896b94c8c --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/clusterextensiontypes.go @@ -0,0 +1,166 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypesClient is the kubernetesConfiguration Client +type ClusterExtensionTypesClient struct { + BaseClient +} + +// NewClusterExtensionTypesClient creates an instance of the ClusterExtensionTypesClient client. +func NewClusterExtensionTypesClient(subscriptionID string) ClusterExtensionTypesClient { + return NewClusterExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypesClientWithBaseURI creates an instance of the ClusterExtensionTypesClient 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 NewClusterExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypesClient { + return ClusterExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get Extension Types +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ClusterExtensionTypesClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ClusterExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ClusterExtensionTypesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes", 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 ClusterExtensionTypesClient) 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 ClusterExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, 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 ClusterExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "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, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClusterExtensionTypesClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/enums.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/enums.go new file mode 100644 index 000000000000..35ae447ae4d5 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/enums.go @@ -0,0 +1,283 @@ +package kubernetesconfiguration + +// 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. + +// ComplianceStateType enumerates the values for compliance state type. +type ComplianceStateType string + +const ( + // Compliant ... + Compliant ComplianceStateType = "Compliant" + // Failed ... + Failed ComplianceStateType = "Failed" + // Installed ... + Installed ComplianceStateType = "Installed" + // Noncompliant ... + Noncompliant ComplianceStateType = "Noncompliant" + // Pending ... + Pending ComplianceStateType = "Pending" +) + +// PossibleComplianceStateTypeValues returns an array of possible values for the ComplianceStateType const type. +func PossibleComplianceStateTypeValues() []ComplianceStateType { + return []ComplianceStateType{Compliant, Failed, Installed, Noncompliant, Pending} +} + +// 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} +} + +// ExtensionsClusterResourceName enumerates the values for extensions cluster resource name. +type ExtensionsClusterResourceName string + +const ( + // ConnectedClusters ... + ConnectedClusters ExtensionsClusterResourceName = "connectedClusters" + // ManagedClusters ... + ManagedClusters ExtensionsClusterResourceName = "managedClusters" +) + +// PossibleExtensionsClusterResourceNameValues returns an array of possible values for the ExtensionsClusterResourceName const type. +func PossibleExtensionsClusterResourceNameValues() []ExtensionsClusterResourceName { + return []ExtensionsClusterResourceName{ConnectedClusters, ManagedClusters} +} + +// ExtensionsClusterRp enumerates the values for extensions cluster rp. +type ExtensionsClusterRp string + +const ( + // MicrosoftContainerService ... + MicrosoftContainerService ExtensionsClusterRp = "Microsoft.ContainerService" + // MicrosoftKubernetes ... + MicrosoftKubernetes ExtensionsClusterRp = "Microsoft.Kubernetes" +) + +// PossibleExtensionsClusterRpValues returns an array of possible values for the ExtensionsClusterRp const type. +func PossibleExtensionsClusterRpValues() []ExtensionsClusterRp { + return []ExtensionsClusterRp{MicrosoftContainerService, MicrosoftKubernetes} +} + +// FluxComplianceState enumerates the values for flux compliance state. +type FluxComplianceState string + +const ( + // FluxComplianceStateCompliant ... + FluxComplianceStateCompliant FluxComplianceState = "Compliant" + // FluxComplianceStateNonCompliant ... + FluxComplianceStateNonCompliant FluxComplianceState = "Non-Compliant" + // FluxComplianceStatePending ... + FluxComplianceStatePending FluxComplianceState = "Pending" + // FluxComplianceStateSuspended ... + FluxComplianceStateSuspended FluxComplianceState = "Suspended" + // FluxComplianceStateUnknown ... + FluxComplianceStateUnknown FluxComplianceState = "Unknown" +) + +// PossibleFluxComplianceStateValues returns an array of possible values for the FluxComplianceState const type. +func PossibleFluxComplianceStateValues() []FluxComplianceState { + return []FluxComplianceState{FluxComplianceStateCompliant, FluxComplianceStateNonCompliant, FluxComplianceStatePending, FluxComplianceStateSuspended, FluxComplianceStateUnknown} +} + +// KustomizationValidationType enumerates the values for kustomization validation type. +type KustomizationValidationType string + +const ( + // Client ... + Client KustomizationValidationType = "client" + // None ... + None KustomizationValidationType = "none" + // Server ... + Server KustomizationValidationType = "server" +) + +// PossibleKustomizationValidationTypeValues returns an array of possible values for the KustomizationValidationType const type. +func PossibleKustomizationValidationTypeValues() []KustomizationValidationType { + return []KustomizationValidationType{Client, None, Server} +} + +// LevelType enumerates the values for level type. +type LevelType string + +const ( + // Error ... + Error LevelType = "Error" + // Information ... + Information LevelType = "Information" + // Warning ... + Warning LevelType = "Warning" +) + +// PossibleLevelTypeValues returns an array of possible values for the LevelType const type. +func PossibleLevelTypeValues() []LevelType { + return []LevelType{Error, Information, Warning} +} + +// MessageLevelType enumerates the values for message level type. +type MessageLevelType string + +const ( + // MessageLevelTypeError ... + MessageLevelTypeError MessageLevelType = "Error" + // MessageLevelTypeInformation ... + MessageLevelTypeInformation MessageLevelType = "Information" + // MessageLevelTypeWarning ... + MessageLevelTypeWarning MessageLevelType = "Warning" +) + +// PossibleMessageLevelTypeValues returns an array of possible values for the MessageLevelType const type. +func PossibleMessageLevelTypeValues() []MessageLevelType { + return []MessageLevelType{MessageLevelTypeError, MessageLevelTypeInformation, MessageLevelTypeWarning} +} + +// OperatorScopeType enumerates the values for operator scope type. +type OperatorScopeType string + +const ( + // Cluster ... + Cluster OperatorScopeType = "cluster" + // Namespace ... + Namespace OperatorScopeType = "namespace" +) + +// PossibleOperatorScopeTypeValues returns an array of possible values for the OperatorScopeType const type. +func PossibleOperatorScopeTypeValues() []OperatorScopeType { + return []OperatorScopeType{Cluster, Namespace} +} + +// OperatorType enumerates the values for operator type. +type OperatorType string + +const ( + // Flux ... + Flux OperatorType = "Flux" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{Flux} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ProvisioningStateType enumerates the values for provisioning state type. +type ProvisioningStateType string + +const ( + // ProvisioningStateTypeAccepted ... + ProvisioningStateTypeAccepted ProvisioningStateType = "Accepted" + // ProvisioningStateTypeDeleting ... + ProvisioningStateTypeDeleting ProvisioningStateType = "Deleting" + // ProvisioningStateTypeFailed ... + ProvisioningStateTypeFailed ProvisioningStateType = "Failed" + // ProvisioningStateTypeRunning ... + ProvisioningStateTypeRunning ProvisioningStateType = "Running" + // ProvisioningStateTypeSucceeded ... + ProvisioningStateTypeSucceeded ProvisioningStateType = "Succeeded" +) + +// PossibleProvisioningStateTypeValues returns an array of possible values for the ProvisioningStateType const type. +func PossibleProvisioningStateTypeValues() []ProvisioningStateType { + return []ProvisioningStateType{ProvisioningStateTypeAccepted, ProvisioningStateTypeDeleting, ProvisioningStateTypeFailed, ProvisioningStateTypeRunning, ProvisioningStateTypeSucceeded} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{SystemAssigned} +} + +// ScopeType enumerates the values for scope type. +type ScopeType string + +const ( + // ScopeTypeCluster ... + ScopeTypeCluster ScopeType = "cluster" + // ScopeTypeNamespace ... + ScopeTypeNamespace ScopeType = "namespace" +) + +// PossibleScopeTypeValues returns an array of possible values for the ScopeType const type. +func PossibleScopeTypeValues() []ScopeType { + return []ScopeType{ScopeTypeCluster, ScopeTypeNamespace} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic ... + Basic SkuTier = "Basic" + // Free ... + Free SkuTier = "Free" + // Premium ... + Premium SkuTier = "Premium" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Basic, Free, Premium, Standard} +} + +// SourceKindType enumerates the values for source kind type. +type SourceKindType string + +const ( + // Bucket ... + Bucket SourceKindType = "Bucket" + // GitRepository ... + GitRepository SourceKindType = "GitRepository" +) + +// PossibleSourceKindTypeValues returns an array of possible values for the SourceKindType const type. +func PossibleSourceKindTypeValues() []SourceKindType { + return []SourceKindType{Bucket, GitRepository} +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/extensions.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/extensions.go new file mode 100644 index 000000000000..58d8447bcc65 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/extensions.go @@ -0,0 +1,555 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionsClient is the kubernetesConfiguration Client +type ExtensionsClient struct { + BaseClient +} + +// NewExtensionsClient creates an instance of the ExtensionsClient client. +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient 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 NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a new Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// extension - properties necessary to Create an Extension. +func (client ExtensionsClient) Create(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, extension Extension) (result ExtensionsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExtensionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, extension Extension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(extension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) CreateSender(req *http.Request) (future ExtensionsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) CreateResponder(resp *http.Response) (result Extension, 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 Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, forceDelete *bool) (result ExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) DeleteSender(req *http.Request) (future ExtensionsDeleteFuture, 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 ExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string) (result Extension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) 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 ExtensionsClient) GetResponder(resp *http.Response) (result Extension, 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 Extensions in the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ExtensionsClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.List") + defer func() { + sc := -1 + if result.el.Response.Response != nil { + sc = result.el.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.el.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure sending request") + return + } + + result.el, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure responding to request") + return + } + if result.el.hasNextLink() && result.el.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions", 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 ExtensionsClient) 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 ExtensionsClient) ListResponder(resp *http.Response) (result ExtensionsList, 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 ExtensionsClient) listNextResults(ctx context.Context, lastResults ExtensionsList) (result ExtensionsList, err error) { + req, err := lastResults.extensionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "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, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.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, clusterRp, clusterResourceName, clusterName) + return +} + +// Update patch an existing Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// patchExtension - properties to Patch in an existing Extension. +func (client ExtensionsClient) Update(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, patchExtension PatchExtension) (result ExtensionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, patchExtension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, patchExtension PatchExtension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(patchExtension), + 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 ExtensionsClient) UpdateSender(req *http.Request) (future ExtensionsUpdateFuture, 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 ExtensionsClient) UpdateResponder(resp *http.Response) (result Extension, 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/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/extensiontypeversions.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/extensiontypeversions.go new file mode 100644 index 000000000000..8707df9f18bb --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/extensiontypeversions.go @@ -0,0 +1,157 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionTypeVersionsClient is the kubernetesConfiguration Client +type ExtensionTypeVersionsClient struct { + BaseClient +} + +// NewExtensionTypeVersionsClient creates an instance of the ExtensionTypeVersionsClient client. +func NewExtensionTypeVersionsClient(subscriptionID string) ExtensionTypeVersionsClient { + return NewExtensionTypeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionTypeVersionsClientWithBaseURI creates an instance of the ExtensionTypeVersionsClient 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 NewExtensionTypeVersionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTypeVersionsClient { + return ExtensionTypeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list available versions for an Extension Type +// Parameters: +// location - extension location +// extensionTypeName - extension type name +func (client ExtensionTypeVersionsClient) List(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.List") + defer func() { + sc := -1 + if result.evl.Response.Response != nil { + sc = result.evl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.ExtensionTypeVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.evl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure sending request") + return + } + + result.evl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.evl.hasNextLink() && result.evl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionTypeVersionsClient) ListPreparer(ctx context.Context, location string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions", 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 ExtensionTypeVersionsClient) 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 ExtensionTypeVersionsClient) ListResponder(resp *http.Response) (result ExtensionVersionList, 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 ExtensionTypeVersionsClient) listNextResults(ctx context.Context, lastResults ExtensionVersionList) (result ExtensionVersionList, err error) { + req, err := lastResults.extensionVersionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "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, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionTypeVersionsClient) ListComplete(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.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, location, extensionTypeName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/fluxconfigoperationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/fluxconfigoperationstatus.go new file mode 100644 index 000000000000..a4229db101c7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/fluxconfigoperationstatus.go @@ -0,0 +1,128 @@ +package kubernetesconfiguration + +// 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" +) + +// FluxConfigOperationStatusClient is the kubernetesConfiguration Client +type FluxConfigOperationStatusClient struct { + BaseClient +} + +// NewFluxConfigOperationStatusClient creates an instance of the FluxConfigOperationStatusClient client. +func NewFluxConfigOperationStatusClient(subscriptionID string) FluxConfigOperationStatusClient { + return NewFluxConfigOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFluxConfigOperationStatusClientWithBaseURI creates an instance of the FluxConfigOperationStatusClient 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 NewFluxConfigOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) FluxConfigOperationStatusClient { + return FluxConfigOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// operationID - operation Id +func (client FluxConfigOperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigOperationStatusClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FluxConfigOperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}", 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 FluxConfigOperationStatusClient) 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 FluxConfigOperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, 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/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/fluxconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/fluxconfigurations.go new file mode 100644 index 000000000000..220ed8904bc7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/fluxconfigurations.go @@ -0,0 +1,557 @@ +package kubernetesconfiguration + +// 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" +) + +// FluxConfigurationsClient is the kubernetesConfiguration Client +type FluxConfigurationsClient struct { + BaseClient +} + +// NewFluxConfigurationsClient creates an instance of the FluxConfigurationsClient client. +func NewFluxConfigurationsClient(subscriptionID string) FluxConfigurationsClient { + return NewFluxConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFluxConfigurationsClientWithBaseURI creates an instance of the FluxConfigurationsClient 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 NewFluxConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) FluxConfigurationsClient { + return FluxConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// fluxConfiguration - properties necessary to Create a FluxConfiguration. +func (client FluxConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration) (result FluxConfigurationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FluxConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", pathParameters), + autorest.WithJSON(fluxConfiguration), + 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 FluxConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future FluxConfigurationsCreateOrUpdateFuture, 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 FluxConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result FluxConfiguration, 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 this will delete the YAML file used to set up the Flux Configuration, thus stopping future sync from the +// source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client FluxConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, forceDelete *bool) (result FluxConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FluxConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", 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 FluxConfigurationsClient) DeleteSender(req *http.Request) (future FluxConfigurationsDeleteFuture, 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 FluxConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details of the Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +func (client FluxConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string) (result FluxConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FluxConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", 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 FluxConfigurationsClient) 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 FluxConfigurationsClient) GetResponder(resp *http.Response) (result FluxConfiguration, 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 Flux Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client FluxConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result FluxConfigurationsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.List") + defer func() { + sc := -1 + if result.fcl.Response.Response != nil { + sc = result.fcl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.fcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.fcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.fcl.hasNextLink() && result.fcl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FluxConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations", 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 FluxConfigurationsClient) 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 FluxConfigurationsClient) ListResponder(resp *http.Response) (result FluxConfigurationsList, 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 FluxConfigurationsClient) listNextResults(ctx context.Context, lastResults FluxConfigurationsList) (result FluxConfigurationsList, err error) { + req, err := lastResults.fluxConfigurationsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "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, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client FluxConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result FluxConfigurationsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.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, clusterRp, clusterResourceName, clusterName) + return +} + +// Update update an existing Kubernetes Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// fluxConfigurationPatch - properties to Patch in an existing Flux Configuration. +func (client FluxConfigurationsClient) Update(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch) (result FluxConfigurationsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.FluxConfigurationsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfigurationPatch) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FluxConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", pathParameters), + autorest.WithJSON(fluxConfigurationPatch), + 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 FluxConfigurationsClient) UpdateSender(req *http.Request) (future FluxConfigurationsUpdateFuture, 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 FluxConfigurationsClient) UpdateResponder(resp *http.Response) (result FluxConfiguration, 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/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go new file mode 100644 index 000000000000..2dcbabc1759e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go @@ -0,0 +1,102 @@ +package kubernetesconfigurationapi + +// 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/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration" +) + +// ClusterExtensionTypeClientAPI contains the set of methods on the ClusterExtensionTypeClient type. +type ClusterExtensionTypeClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionTypeName string) (result kubernetesconfiguration.ExtensionType, err error) +} + +var _ ClusterExtensionTypeClientAPI = (*kubernetesconfiguration.ClusterExtensionTypeClient)(nil) + +// ClusterExtensionTypesClientAPI contains the set of methods on the ClusterExtensionTypesClient type. +type ClusterExtensionTypesClientAPI interface { + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ ClusterExtensionTypesClientAPI = (*kubernetesconfiguration.ClusterExtensionTypesClient)(nil) + +// ExtensionTypeVersionsClientAPI contains the set of methods on the ExtensionTypeVersionsClient type. +type ExtensionTypeVersionsClientAPI interface { + List(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListPage, err error) + ListComplete(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListIterator, err error) +} + +var _ ExtensionTypeVersionsClientAPI = (*kubernetesconfiguration.ExtensionTypeVersionsClient)(nil) + +// LocationExtensionTypesClientAPI contains the set of methods on the LocationExtensionTypesClient type. +type LocationExtensionTypesClientAPI interface { + List(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ LocationExtensionTypesClientAPI = (*kubernetesconfiguration.LocationExtensionTypesClient)(nil) + +// ExtensionsClientAPI contains the set of methods on the ExtensionsClient type. +type ExtensionsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, extension kubernetesconfiguration.Extension) (result kubernetesconfiguration.ExtensionsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, forceDelete *bool) (result kubernetesconfiguration.ExtensionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string) (result kubernetesconfiguration.Extension, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionsListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, patchExtension kubernetesconfiguration.PatchExtension) (result kubernetesconfiguration.ExtensionsUpdateFuture, err error) +} + +var _ ExtensionsClientAPI = (*kubernetesconfiguration.ExtensionsClient)(nil) + +// OperationStatusClientAPI contains the set of methods on the OperationStatusClient type. +type OperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.OperationStatusListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.OperationStatusListIterator, err error) +} + +var _ OperationStatusClientAPI = (*kubernetesconfiguration.OperationStatusClient)(nil) + +// FluxConfigurationsClientAPI contains the set of methods on the FluxConfigurationsClient type. +type FluxConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfiguration kubernetesconfiguration.FluxConfiguration) (result kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, forceDelete *bool) (result kubernetesconfiguration.FluxConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string) (result kubernetesconfiguration.FluxConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.FluxConfigurationsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.FluxConfigurationsListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfigurationPatch kubernetesconfiguration.FluxConfigurationPatch) (result kubernetesconfiguration.FluxConfigurationsUpdateFuture, err error) +} + +var _ FluxConfigurationsClientAPI = (*kubernetesconfiguration.FluxConfigurationsClient)(nil) + +// FluxConfigOperationStatusClientAPI contains the set of methods on the FluxConfigOperationStatusClient type. +type FluxConfigOperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) +} + +var _ FluxConfigOperationStatusClientAPI = (*kubernetesconfiguration.FluxConfigOperationStatusClient)(nil) + +// SourceControlConfigurationsClientAPI contains the set of methods on the SourceControlConfigurationsClient type. +type SourceControlConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration kubernetesconfiguration.SourceControlConfiguration) (result kubernetesconfiguration.SourceControlConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListIterator, err error) +} + +var _ SourceControlConfigurationsClientAPI = (*kubernetesconfiguration.SourceControlConfigurationsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListPage, err error) + ListComplete(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListIterator, err error) +} + +var _ OperationsClientAPI = (*kubernetesconfiguration.OperationsClient)(nil) diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/locationextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/locationextensiontypes.go new file mode 100644 index 000000000000..f791ecbfefb3 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/locationextensiontypes.go @@ -0,0 +1,155 @@ +package kubernetesconfiguration + +// 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" +) + +// LocationExtensionTypesClient is the kubernetesConfiguration Client +type LocationExtensionTypesClient struct { + BaseClient +} + +// NewLocationExtensionTypesClient creates an instance of the LocationExtensionTypesClient client. +func NewLocationExtensionTypesClient(subscriptionID string) LocationExtensionTypesClient { + return NewLocationExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationExtensionTypesClientWithBaseURI creates an instance of the LocationExtensionTypesClient 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 NewLocationExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) LocationExtensionTypesClient { + return LocationExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all Extension Types +// Parameters: +// location - extension location +func (client LocationExtensionTypesClient) List(ctx context.Context, location string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.LocationExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LocationExtensionTypesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes", 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 LocationExtensionTypesClient) 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 LocationExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, 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 LocationExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "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, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocationExtensionTypesClient) ListComplete(ctx context.Context, location string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.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, location) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/models.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/models.go new file mode 100644 index 000000000000..4adfcedd4c0a --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/models.go @@ -0,0 +1,2841 @@ +package kubernetesconfiguration + +// 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/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration" + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BucketDefinition parameters to reconcile to the GitRepository source kind type. +type BucketDefinition struct { + // URL - The URL to sync for the flux configuration S3 bucket. + URL *string `json:"url,omitempty"` + // BucketName - The bucket name to sync from the url endpoint for the flux configuration. + BucketName *string `json:"bucketName,omitempty"` + // Insecure - Specify whether to use insecure communication when puling data from the S3 bucket. + Insecure *bool `json:"insecure,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // AccessKey - Plaintext access key used to securely access the S3 bucket + AccessKey *string `json:"accessKey,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// BucketPatchDefinition parameters to reconcile to the GitRepository source kind type. +type BucketPatchDefinition struct { + // URL - The URL to sync for the flux configuration S3 bucket. + URL *string `json:"url,omitempty"` + // BucketName - The bucket name to sync from the url endpoint for the flux configuration. + BucketName *string `json:"bucketName,omitempty"` + // Insecure - Specify whether to use insecure communication when puling data from the S3 bucket. + Insecure *bool `json:"insecure,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // AccessKey - Plaintext access key used to securely access the S3 bucket + AccessKey *string `json:"accessKey,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// ClusterScopeSettings extension scope settings +type ClusterScopeSettings struct { + // AllowMultipleInstances - Describes if multiple instances of the extension are allowed + AllowMultipleInstances *bool `json:"allowMultipleInstances,omitempty"` + // DefaultReleaseNamespace - Default extension release namespace + DefaultReleaseNamespace *string `json:"defaultReleaseNamespace,omitempty"` +} + +// ComplianceStatus compliance Status details +type ComplianceStatus struct { + // ComplianceState - READ-ONLY; The compliance state of the configuration. Possible values include: 'Pending', 'Compliant', 'Noncompliant', 'Installed', 'Failed' + ComplianceState ComplianceStateType `json:"complianceState,omitempty"` + // LastConfigApplied - Datetime the configuration was last applied. + LastConfigApplied *date.Time `json:"lastConfigApplied,omitempty"` + // Message - Message from when the configuration was applied. + Message *string `json:"message,omitempty"` + // MessageLevel - Level of the message. Possible values include: 'MessageLevelTypeError', 'MessageLevelTypeWarning', 'MessageLevelTypeInformation' + MessageLevel MessageLevelType `json:"messageLevel,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComplianceStatus. +func (cs ComplianceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.LastConfigApplied != nil { + objectMap["lastConfigApplied"] = cs.LastConfigApplied + } + if cs.Message != nil { + objectMap["message"] = cs.Message + } + if cs.MessageLevel != "" { + objectMap["messageLevel"] = cs.MessageLevel + } + return json.Marshal(objectMap) +} + +// DependsOnDefinition specify which kustomizations must succeed reconciliation on the cluster prior to +// reconciling this kustomization +type DependsOnDefinition struct { + // KustomizationName - Name of the kustomization to claim dependency on + KustomizationName *string `json:"kustomizationName,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// Extension the Extension object. +type Extension struct { + autorest.Response `json:"-"` + // ExtensionProperties - Properties of an Extension resource + *ExtensionProperties `json:"properties,omitempty"` + // Identity - Identity of the Extension resource + Identity *Identity `json:"identity,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Extension. +func (e Extension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionProperties != nil { + objectMap["properties"] = e.ExtensionProperties + } + if e.Identity != nil { + objectMap["identity"] = e.Identity + } + if e.SystemData != nil { + objectMap["systemData"] = e.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Extension struct. +func (e *Extension) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var extensionProperties ExtensionProperties + err = json.Unmarshal(*v, &extensionProperties) + if err != nil { + return err + } + e.ExtensionProperties = &extensionProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + e.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + e.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + } + } + + return nil +} + +// ExtensionProperties properties of an Extension resource +type ExtensionProperties struct { + // ExtensionType - Type of the Extension, of which this resource is an instance of. It must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + ExtensionType *string `json:"extensionType,omitempty"` + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // Scope - Scope at which the extension is installed. + Scope *Scope `json:"scope,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // ProvisioningState - READ-ONLY; Status of installation of this extension. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Statuses - Status from this extension. + Statuses *[]ExtensionStatus `json:"statuses,omitempty"` + // ErrorInfo - READ-ONLY; Error information from the Agent - e.g. errors during installation. + ErrorInfo *ErrorDetail `json:"errorInfo,omitempty"` + // CustomLocationSettings - READ-ONLY; Custom Location settings properties. + CustomLocationSettings map[string]*string `json:"customLocationSettings"` + // PackageURI - READ-ONLY; Uri of the Helm package + PackageURI *string `json:"packageUri,omitempty"` + // AksAssignedIdentity - Identity of the Extension resource in an AKS cluster + AksAssignedIdentity *ExtensionPropertiesAksAssignedIdentity `json:"aksAssignedIdentity,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionProperties. +func (e ExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionType != nil { + objectMap["extensionType"] = e.ExtensionType + } + if e.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = e.AutoUpgradeMinorVersion + } + if e.ReleaseTrain != nil { + objectMap["releaseTrain"] = e.ReleaseTrain + } + if e.Version != nil { + objectMap["version"] = e.Version + } + if e.Scope != nil { + objectMap["scope"] = e.Scope + } + if e.ConfigurationSettings != nil { + objectMap["configurationSettings"] = e.ConfigurationSettings + } + if e.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = e.ConfigurationProtectedSettings + } + if e.Statuses != nil { + objectMap["statuses"] = e.Statuses + } + if e.AksAssignedIdentity != nil { + objectMap["aksAssignedIdentity"] = e.AksAssignedIdentity + } + return json.Marshal(objectMap) +} + +// ExtensionPropertiesAksAssignedIdentity identity of the Extension resource in an AKS cluster +type ExtensionPropertiesAksAssignedIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionPropertiesAksAssignedIdentity. +func (eAi ExtensionPropertiesAksAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eAi.Type != "" { + objectMap["type"] = eAi.Type + } + return json.Marshal(objectMap) +} + +// ExtensionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsCreateFuture) 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 ExtensionsCreateFuture.Result. +func (future *ExtensionsCreateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsDeleteFuture) 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 ExtensionsDeleteFuture.Result. +func (future *ExtensionsDeleteFuture) result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExtensionsList result of the request to list Extensions. It contains a list of Extension objects and a +// URL link to get the next set of results. +type ExtensionsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Extensions within a Kubernetes cluster. + Value *[]Extension `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of extension objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionsList. +func (el ExtensionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionsListIterator provides access to a complete listing of Extension values. +type ExtensionsListIterator struct { + i int + page ExtensionsListPage +} + +// 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 *ExtensionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListIterator.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 *ExtensionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionsListIterator) 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 ExtensionsListIterator) Response() ExtensionsList { + 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 ExtensionsListIterator) Value() Extension { + if !iter.page.NotDone() { + return Extension{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionsListIterator type. +func NewExtensionsListIterator(page ExtensionsListPage) ExtensionsListIterator { + return ExtensionsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (el ExtensionsList) IsEmpty() bool { + return el.Value == nil || len(*el.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (el ExtensionsList) hasNextLink() bool { + return el.NextLink != nil && len(*el.NextLink) != 0 +} + +// extensionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (el ExtensionsList) extensionsListPreparer(ctx context.Context) (*http.Request, error) { + if !el.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(el.NextLink))) +} + +// ExtensionsListPage contains a page of Extension values. +type ExtensionsListPage struct { + fn func(context.Context, ExtensionsList) (ExtensionsList, error) + el ExtensionsList +} + +// 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 *ExtensionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListPage.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.el) + if err != nil { + return err + } + page.el = 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 *ExtensionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionsListPage) NotDone() bool { + return !page.el.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionsListPage) Response() ExtensionsList { + return page.el +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionsListPage) Values() []Extension { + if page.el.IsEmpty() { + return nil + } + return *page.el.Value +} + +// Creates a new instance of the ExtensionsListPage type. +func NewExtensionsListPage(cur ExtensionsList, getNextPage func(context.Context, ExtensionsList) (ExtensionsList, error)) ExtensionsListPage { + return ExtensionsListPage{ + fn: getNextPage, + el: cur, + } +} + +// ExtensionStatus status from the extension. +type ExtensionStatus struct { + // Code - Status code provided by the Extension + Code *string `json:"code,omitempty"` + // DisplayStatus - Short description of status of the extension. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Level - Level of the status. Possible values include: 'Error', 'Warning', 'Information' + Level LevelType `json:"level,omitempty"` + // Message - Detailed message of the status from the Extension. + Message *string `json:"message,omitempty"` + // Time - DateLiteral (per ISO8601) noting the time of installation status. + Time *string `json:"time,omitempty"` +} + +// ExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsUpdateFuture) 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 ExtensionsUpdateFuture.Result. +func (future *ExtensionsUpdateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.UpdateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsUpdateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionType represents an Extension Type. +type ExtensionType struct { + autorest.Response `json:"-"` + // ExtensionTypeProperties - Describes the Resource Type properties. + *ExtensionTypeProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionType. +func (et ExtensionType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if et.ExtensionTypeProperties != nil { + objectMap["properties"] = et.ExtensionTypeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExtensionType struct. +func (et *ExtensionType) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var extensionTypeProperties ExtensionTypeProperties + err = json.Unmarshal(*v, &extensionTypeProperties) + if err != nil { + return err + } + et.ExtensionTypeProperties = &extensionTypeProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + et.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + et.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + et.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + et.Type = &typeVar + } + } + } + + return nil +} + +// ExtensionTypeList list Extension Types +type ExtensionTypeList struct { + autorest.Response `json:"-"` + // Value - The list of Extension Types + Value *[]ExtensionType `json:"value,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` +} + +// ExtensionTypeListIterator provides access to a complete listing of ExtensionType values. +type ExtensionTypeListIterator struct { + i int + page ExtensionTypeListPage +} + +// 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 *ExtensionTypeListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListIterator.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 *ExtensionTypeListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionTypeListIterator) 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 ExtensionTypeListIterator) Response() ExtensionTypeList { + 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 ExtensionTypeListIterator) Value() ExtensionType { + if !iter.page.NotDone() { + return ExtensionType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionTypeListIterator type. +func NewExtensionTypeListIterator(page ExtensionTypeListPage) ExtensionTypeListIterator { + return ExtensionTypeListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (etl ExtensionTypeList) IsEmpty() bool { + return etl.Value == nil || len(*etl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (etl ExtensionTypeList) hasNextLink() bool { + return etl.NextLink != nil && len(*etl.NextLink) != 0 +} + +// extensionTypeListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (etl ExtensionTypeList) extensionTypeListPreparer(ctx context.Context) (*http.Request, error) { + if !etl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(etl.NextLink))) +} + +// ExtensionTypeListPage contains a page of ExtensionType values. +type ExtensionTypeListPage struct { + fn func(context.Context, ExtensionTypeList) (ExtensionTypeList, error) + etl ExtensionTypeList +} + +// 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 *ExtensionTypeListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListPage.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.etl) + if err != nil { + return err + } + page.etl = 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 *ExtensionTypeListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionTypeListPage) NotDone() bool { + return !page.etl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionTypeListPage) Response() ExtensionTypeList { + return page.etl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionTypeListPage) Values() []ExtensionType { + if page.etl.IsEmpty() { + return nil + } + return *page.etl.Value +} + +// Creates a new instance of the ExtensionTypeListPage type. +func NewExtensionTypeListPage(cur ExtensionTypeList, getNextPage func(context.Context, ExtensionTypeList) (ExtensionTypeList, error)) ExtensionTypeListPage { + return ExtensionTypeListPage{ + fn: getNextPage, + etl: cur, + } +} + +// ExtensionTypeProperties properties of the connected cluster. +type ExtensionTypeProperties struct { + // ReleaseTrains - READ-ONLY; Extension release train: preview or stable + ReleaseTrains *[]string `json:"releaseTrains,omitempty"` + // ClusterTypes - READ-ONLY; Cluster types + ClusterTypes *[]string `json:"clusterTypes,omitempty"` + // SupportedScopes - READ-ONLY; Extension scopes + SupportedScopes *SupportedScopes `json:"supportedScopes,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionTypeProperties. +func (etp ExtensionTypeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionVersionList list versions for an Extension +type ExtensionVersionList struct { + autorest.Response `json:"-"` + // Value - Versions available for this Extension Type + Value *[]ExtensionVersionListValueItem `json:"value,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionVersionList. +func (evl ExtensionVersionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if evl.Value != nil { + objectMap["value"] = evl.Value + } + if evl.NextLink != nil { + objectMap["nextLink"] = evl.NextLink + } + return json.Marshal(objectMap) +} + +// ExtensionVersionListIterator provides access to a complete listing of ExtensionVersionListValueItem +// values. +type ExtensionVersionListIterator struct { + i int + page ExtensionVersionListPage +} + +// 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 *ExtensionVersionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListIterator.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 *ExtensionVersionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionVersionListIterator) 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 ExtensionVersionListIterator) Response() ExtensionVersionList { + 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 ExtensionVersionListIterator) Value() ExtensionVersionListValueItem { + if !iter.page.NotDone() { + return ExtensionVersionListValueItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionVersionListIterator type. +func NewExtensionVersionListIterator(page ExtensionVersionListPage) ExtensionVersionListIterator { + return ExtensionVersionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (evl ExtensionVersionList) IsEmpty() bool { + return evl.Value == nil || len(*evl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (evl ExtensionVersionList) hasNextLink() bool { + return evl.NextLink != nil && len(*evl.NextLink) != 0 +} + +// extensionVersionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (evl ExtensionVersionList) extensionVersionListPreparer(ctx context.Context) (*http.Request, error) { + if !evl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(evl.NextLink))) +} + +// ExtensionVersionListPage contains a page of ExtensionVersionListValueItem values. +type ExtensionVersionListPage struct { + fn func(context.Context, ExtensionVersionList) (ExtensionVersionList, error) + evl ExtensionVersionList +} + +// 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 *ExtensionVersionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListPage.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.evl) + if err != nil { + return err + } + page.evl = 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 *ExtensionVersionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionVersionListPage) NotDone() bool { + return !page.evl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionVersionListPage) Response() ExtensionVersionList { + return page.evl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionVersionListPage) Values() []ExtensionVersionListValueItem { + if page.evl.IsEmpty() { + return nil + } + return *page.evl.Value +} + +// Creates a new instance of the ExtensionVersionListPage type. +func NewExtensionVersionListPage(cur ExtensionVersionList, getNextPage func(context.Context, ExtensionVersionList) (ExtensionVersionList, error)) ExtensionVersionListPage { + return ExtensionVersionListPage{ + fn: getNextPage, + evl: cur, + } +} + +// ExtensionVersionListValueItem ... +type ExtensionVersionListValueItem struct { + // ReleaseTrain - The release train for this Extension Type + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Versions - Versions available for this Extension Type and release train + Versions *[]string `json:"versions,omitempty"` +} + +// FluxConfiguration the Flux Configuration object returned in Get & Put response. +type FluxConfiguration struct { + autorest.Response `json:"-"` + // FluxConfigurationProperties - Properties to create a Flux Configuration resource + *FluxConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfiguration. +func (fc FluxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fc.FluxConfigurationProperties != nil { + objectMap["properties"] = fc.FluxConfigurationProperties + } + if fc.SystemData != nil { + objectMap["systemData"] = fc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FluxConfiguration struct. +func (fc *FluxConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fluxConfigurationProperties FluxConfigurationProperties + err = json.Unmarshal(*v, &fluxConfigurationProperties) + if err != nil { + return err + } + fc.FluxConfigurationProperties = &fluxConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + fc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fc.Type = &typeVar + } + } + } + + return nil +} + +// FluxConfigurationPatch the Flux Configuration Patch Request object. +type FluxConfigurationPatch struct { + // FluxConfigurationPatchProperties - Updatable properties of an Flux Configuration Patch Request + *FluxConfigurationPatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationPatch. +func (fcp FluxConfigurationPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.FluxConfigurationPatchProperties != nil { + objectMap["properties"] = fcp.FluxConfigurationPatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FluxConfigurationPatch struct. +func (fcp *FluxConfigurationPatch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var fluxConfigurationPatchProperties FluxConfigurationPatchProperties + err = json.Unmarshal(*v, &fluxConfigurationPatchProperties) + if err != nil { + return err + } + fcp.FluxConfigurationPatchProperties = &fluxConfigurationPatchProperties + } + } + } + + return nil +} + +// FluxConfigurationPatchProperties updatable properties of an Flux Configuration Patch Request +type FluxConfigurationPatchProperties struct { + // SourceKind - Source Kind to pull the configuration data from. Possible values include: 'GitRepository', 'Bucket' + SourceKind SourceKindType `json:"sourceKind,omitempty"` + // Suspend - Whether this configuration should suspend its reconciliation of its kustomizations and sources. + Suspend *bool `json:"suspend,omitempty"` + // GitRepository - Parameters to reconcile to the GitRepository source kind type. + GitRepository *GitRepositoryPatchDefinition `json:"gitRepository,omitempty"` + // Bucket - Parameters to reconcile to the Bucket source kind type. + Bucket *BucketDefinition `json:"bucket,omitempty"` + // Kustomizations - Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. + Kustomizations map[string]*KustomizationPatchDefinition `json:"kustomizations"` + // ConfigurationProtectedSettings - Key-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationPatchProperties. +func (fcp FluxConfigurationPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.SourceKind != "" { + objectMap["sourceKind"] = fcp.SourceKind + } + if fcp.Suspend != nil { + objectMap["suspend"] = fcp.Suspend + } + if fcp.GitRepository != nil { + objectMap["gitRepository"] = fcp.GitRepository + } + if fcp.Bucket != nil { + objectMap["bucket"] = fcp.Bucket + } + if fcp.Kustomizations != nil { + objectMap["kustomizations"] = fcp.Kustomizations + } + if fcp.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = fcp.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// FluxConfigurationProperties properties to create a Flux Configuration resource +type FluxConfigurationProperties struct { + // Scope - Scope at which the operator will be installed. Possible values include: 'ScopeTypeCluster', 'ScopeTypeNamespace' + Scope ScopeType `json:"scope,omitempty"` + // Namespace - The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + Namespace *string `json:"namespace,omitempty"` + // SourceKind - Source Kind to pull the configuration data from. Possible values include: 'GitRepository', 'Bucket' + SourceKind SourceKindType `json:"sourceKind,omitempty"` + // Suspend - Whether this configuration should suspend its reconciliation of its kustomizations and sources. + Suspend *bool `json:"suspend,omitempty"` + // GitRepository - Parameters to reconcile to the GitRepository source kind type. + GitRepository *GitRepositoryDefinition `json:"gitRepository,omitempty"` + // Bucket - Parameters to reconcile to the Bucket source kind type. + Bucket *BucketDefinition `json:"bucket,omitempty"` + // Kustomizations - Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. + Kustomizations map[string]*KustomizationDefinition `json:"kustomizations"` + // ConfigurationProtectedSettings - Key-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // Statuses - READ-ONLY; Statuses of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects provisioned by the fluxConfiguration. + Statuses *[]ObjectStatusDefinition `json:"statuses,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this fluxConfiguration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // LastSourceUpdatedCommitID - READ-ONLY; Branch and SHA of the last source commit synced with the cluster. + LastSourceUpdatedCommitID *string `json:"lastSourceUpdatedCommitId,omitempty"` + // LastSourceUpdatedAt - READ-ONLY; Datetime the fluxConfiguration last synced its source on the cluster. + LastSourceUpdatedAt *date.Time `json:"lastSourceUpdatedAt,omitempty"` + // ComplianceState - READ-ONLY; Combined status of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects. Possible values include: 'FluxComplianceStateCompliant', 'FluxComplianceStateNonCompliant', 'FluxComplianceStatePending', 'FluxComplianceStateSuspended', 'FluxComplianceStateUnknown' + ComplianceState FluxComplianceState `json:"complianceState,omitempty"` + // ProvisioningState - READ-ONLY; Status of the creation of the fluxConfiguration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ErrorMessage - READ-ONLY; Error message returned to the user in the case of provisioning failure. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationProperties. +func (fc FluxConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fc.Scope != "" { + objectMap["scope"] = fc.Scope + } + if fc.Namespace != nil { + objectMap["namespace"] = fc.Namespace + } + if fc.SourceKind != "" { + objectMap["sourceKind"] = fc.SourceKind + } + if fc.Suspend != nil { + objectMap["suspend"] = fc.Suspend + } + if fc.GitRepository != nil { + objectMap["gitRepository"] = fc.GitRepository + } + if fc.Bucket != nil { + objectMap["bucket"] = fc.Bucket + } + if fc.Kustomizations != nil { + objectMap["kustomizations"] = fc.Kustomizations + } + if fc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = fc.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// FluxConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (FluxConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsCreateOrUpdateFuture) 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 FluxConfigurationsCreateOrUpdateFuture.Result. +func (future *FluxConfigurationsCreateOrUpdateFuture) result(client FluxConfigurationsClient) (fc FluxConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fc.Response.Response, err = future.GetResult(sender); err == nil && fc.Response.Response.StatusCode != http.StatusNoContent { + fc, err = client.CreateOrUpdateResponder(fc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture", "Result", fc.Response.Response, "Failure responding to request") + } + } + return +} + +// FluxConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsDeleteFuture) 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 FluxConfigurationsDeleteFuture.Result. +func (future *FluxConfigurationsDeleteFuture) result(client FluxConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// FluxConfigurationsList result of the request to list Flux Configurations. It contains a list of +// FluxConfiguration objects and a URL link to get the next set of results. +type FluxConfigurationsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Flux Configurations within a Kubernetes cluster. + Value *[]FluxConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationsList. +func (fcl FluxConfigurationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FluxConfigurationsListIterator provides access to a complete listing of FluxConfiguration values. +type FluxConfigurationsListIterator struct { + i int + page FluxConfigurationsListPage +} + +// 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 *FluxConfigurationsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsListIterator.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 *FluxConfigurationsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FluxConfigurationsListIterator) 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 FluxConfigurationsListIterator) Response() FluxConfigurationsList { + 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 FluxConfigurationsListIterator) Value() FluxConfiguration { + if !iter.page.NotDone() { + return FluxConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FluxConfigurationsListIterator type. +func NewFluxConfigurationsListIterator(page FluxConfigurationsListPage) FluxConfigurationsListIterator { + return FluxConfigurationsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fcl FluxConfigurationsList) IsEmpty() bool { + return fcl.Value == nil || len(*fcl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fcl FluxConfigurationsList) hasNextLink() bool { + return fcl.NextLink != nil && len(*fcl.NextLink) != 0 +} + +// fluxConfigurationsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fcl FluxConfigurationsList) fluxConfigurationsListPreparer(ctx context.Context) (*http.Request, error) { + if !fcl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fcl.NextLink))) +} + +// FluxConfigurationsListPage contains a page of FluxConfiguration values. +type FluxConfigurationsListPage struct { + fn func(context.Context, FluxConfigurationsList) (FluxConfigurationsList, error) + fcl FluxConfigurationsList +} + +// 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 *FluxConfigurationsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsListPage.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.fcl) + if err != nil { + return err + } + page.fcl = 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 *FluxConfigurationsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FluxConfigurationsListPage) NotDone() bool { + return !page.fcl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FluxConfigurationsListPage) Response() FluxConfigurationsList { + return page.fcl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FluxConfigurationsListPage) Values() []FluxConfiguration { + if page.fcl.IsEmpty() { + return nil + } + return *page.fcl.Value +} + +// Creates a new instance of the FluxConfigurationsListPage type. +func NewFluxConfigurationsListPage(cur FluxConfigurationsList, getNextPage func(context.Context, FluxConfigurationsList) (FluxConfigurationsList, error)) FluxConfigurationsListPage { + return FluxConfigurationsListPage{ + fn: getNextPage, + fcl: cur, + } +} + +// FluxConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (FluxConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsUpdateFuture) 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 FluxConfigurationsUpdateFuture.Result. +func (future *FluxConfigurationsUpdateFuture) result(client FluxConfigurationsClient) (fc FluxConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fc.Response.Response, err = future.GetResult(sender); err == nil && fc.Response.Response.StatusCode != http.StatusNoContent { + fc, err = client.UpdateResponder(fc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsUpdateFuture", "Result", fc.Response.Response, "Failure responding to request") + } + } + return +} + +// GitRepositoryDefinition parameters to reconcile to the GitRepository source kind type. +type GitRepositoryDefinition struct { + // URL - The URL to sync for the flux configuration git repository. + URL *string `json:"url,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RepositoryRef - The source reference for the GitRepository object. + RepositoryRef *RepositoryRefDefinition `json:"repositoryRef,omitempty"` + // SSHKnownHosts - Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH + SSHKnownHosts *string `json:"sshKnownHosts,omitempty"` + // HTTPSUser - Plaintext HTTPS username used to access private git repositories over HTTPS + HTTPSUser *string `json:"httpsUser,omitempty"` + // HTTPSCACert - Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS + HTTPSCACert *string `json:"httpsCACert,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// GitRepositoryPatchDefinition parameters to reconcile to the GitRepository source kind type. +type GitRepositoryPatchDefinition struct { + // URL - The URL to sync for the flux configuration git repository. + URL *string `json:"url,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RepositoryRef - The source reference for the GitRepository object. + RepositoryRef *RepositoryRefDefinition `json:"repositoryRef,omitempty"` + // SSHKnownHosts - Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH + SSHKnownHosts *string `json:"sshKnownHosts,omitempty"` + // HTTPSUser - Plaintext HTTPS username used to access private git repositories over HTTPS + HTTPSUser *string `json:"httpsUser,omitempty"` + // HTTPSCACert - Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS + HTTPSCACert *string `json:"httpsCACert,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// HelmOperatorProperties properties for Helm operator. +type HelmOperatorProperties struct { + // ChartVersion - Version of the operator Helm chart. + ChartVersion *string `json:"chartVersion,omitempty"` + // ChartValues - Values override for the operator Helm chart. + ChartValues *string `json:"chartValues,omitempty"` +} + +// HelmReleasePropertiesDefinition ... +type HelmReleasePropertiesDefinition struct { + // LastRevisionApplied - The revision number of the last released object change + LastRevisionApplied *int64 `json:"lastRevisionApplied,omitempty"` + // HelmChartRef - The reference to the HelmChart object used as the source to this HelmRelease + HelmChartRef *ObjectReferenceDefinition `json:"helmChartRef,omitempty"` + // FailureCount - Total number of times that the HelmRelease failed to install or upgrade + FailureCount *int64 `json:"failureCount,omitempty"` + // InstallFailureCount - Number of times that the HelmRelease failed to install + InstallFailureCount *int64 `json:"installFailureCount,omitempty"` + // UpgradeFailureCount - Number of times that the HelmRelease failed to upgrade + UpgradeFailureCount *int64 `json:"upgradeFailureCount,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + +// KustomizationDefinition the Kustomization defining how to reconcile the artifact pulled by the source +// type on the cluster. +type KustomizationDefinition struct { + // Path - The path in the source reference to reconcile on the cluster. + Path *string `json:"path,omitempty"` + // DependsOn - Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. + DependsOn *[]DependsOnDefinition `json:"dependsOn,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the Kustomization on the cluster. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RetryIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster in the event of failure on reconciliation. + RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` + // Prune - Enable/disable garbage collections of Kubernetes objects created by this Kustomization. + Prune *bool `json:"prune,omitempty"` + // Force - Enable/disable re-creating Kubernetes resources on the cluster when patching fails due to an immutable field change. + Force *bool `json:"force,omitempty"` +} + +// KustomizationPatchDefinition the Kustomization defining how to reconcile the artifact pulled by the +// source type on the cluster. +type KustomizationPatchDefinition struct { + // Path - The path in the source reference to reconcile on the cluster. + Path *string `json:"path,omitempty"` + // DependsOn - Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. + DependsOn *[]DependsOnDefinition `json:"dependsOn,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the Kustomization on the cluster. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RetryIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster in the event of failure on reconciliation. + RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` + // Prune - Enable/disable garbage collections of Kubernetes objects created by this Kustomization. + Prune *bool `json:"prune,omitempty"` + // Force - Enable/disable re-creating Kubernetes resources on the cluster when patching fails due to an immutable field change. + Force *bool `json:"force,omitempty"` +} + +// ObjectReferenceDefinition object reference to a Kubernetes object on a cluster +type ObjectReferenceDefinition struct { + // Name - Name of the object + Name *string `json:"name,omitempty"` + // Namespace - Namespace of the object + Namespace *string `json:"namespace,omitempty"` +} + +// ObjectStatusConditionDefinition status condition of Kubernetes object +type ObjectStatusConditionDefinition struct { + // LastTransitionTime - Last time this status condition has changed + LastTransitionTime *date.Time `json:"lastTransitionTime,omitempty"` + // Message - A more verbose description of the object status condition + Message *string `json:"message,omitempty"` + // Reason - Reason for the specified status condition type status + Reason *string `json:"reason,omitempty"` + // Status - Status of the Kubernetes object condition type + Status *string `json:"status,omitempty"` + // Type - Object status condition type for this object + Type *string `json:"type,omitempty"` +} + +// ObjectStatusDefinition statuses of objects deployed by the user-specified kustomizations from the git +// repository. +type ObjectStatusDefinition struct { + // Name - Name of the applied object + Name *string `json:"name,omitempty"` + // Namespace - Namespace of the applied object + Namespace *string `json:"namespace,omitempty"` + // Kind - Kind of the applied object + Kind *string `json:"kind,omitempty"` + // ComplianceState - Compliance state of the applied object showing whether the applied object has come into a ready state on the cluster. Possible values include: 'FluxComplianceStateCompliant', 'FluxComplianceStateNonCompliant', 'FluxComplianceStatePending', 'FluxComplianceStateSuspended', 'FluxComplianceStateUnknown' + ComplianceState FluxComplianceState `json:"complianceState,omitempty"` + // AppliedBy - Object reference to the Kustomization that applied this object + AppliedBy *ObjectReferenceDefinition `json:"appliedBy,omitempty"` + // StatusConditions - List of Kubernetes object status conditions present on the cluster + StatusConditions *[]ObjectStatusConditionDefinition `json:"statusConditions,omitempty"` + // HelmReleaseProperties - Additional properties that are provided from objects of the HelmRelease kind + HelmReleaseProperties *HelmReleasePropertiesDefinition `json:"helmReleaseProperties,omitempty"` +} + +// OperationStatusList the async operations in progress, in the cluster. +type OperationStatusList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of async operations in progress, in the cluster. + Value *[]OperationStatusResult `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of Operation Result objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusList. +func (osl OperationStatusList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationStatusListIterator provides access to a complete listing of OperationStatusResult values. +type OperationStatusListIterator struct { + i int + page OperationStatusListPage +} + +// 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 *OperationStatusListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListIterator.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 *OperationStatusListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationStatusListIterator) 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 OperationStatusListIterator) Response() OperationStatusList { + 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 OperationStatusListIterator) Value() OperationStatusResult { + if !iter.page.NotDone() { + return OperationStatusResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationStatusListIterator type. +func NewOperationStatusListIterator(page OperationStatusListPage) OperationStatusListIterator { + return OperationStatusListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (osl OperationStatusList) IsEmpty() bool { + return osl.Value == nil || len(*osl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (osl OperationStatusList) hasNextLink() bool { + return osl.NextLink != nil && len(*osl.NextLink) != 0 +} + +// operationStatusListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (osl OperationStatusList) operationStatusListPreparer(ctx context.Context) (*http.Request, error) { + if !osl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(osl.NextLink))) +} + +// OperationStatusListPage contains a page of OperationStatusResult values. +type OperationStatusListPage struct { + fn func(context.Context, OperationStatusList) (OperationStatusList, error) + osl OperationStatusList +} + +// 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 *OperationStatusListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListPage.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.osl) + if err != nil { + return err + } + page.osl = 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 *OperationStatusListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationStatusListPage) NotDone() bool { + return !page.osl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationStatusListPage) Response() OperationStatusList { + return page.osl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationStatusListPage) Values() []OperationStatusResult { + if page.osl.IsEmpty() { + return nil + } + return *page.osl.Value +} + +// Creates a new instance of the OperationStatusListPage type. +func NewOperationStatusListPage(cur OperationStatusList, getNextPage func(context.Context, OperationStatusList) (OperationStatusList, error)) OperationStatusListPage { + return OperationStatusListPage{ + fn: getNextPage, + osl: cur, + } +} + +// OperationStatusResult the current status of an async operation. +type OperationStatusResult struct { + autorest.Response `json:"-"` + // ID - Fully qualified ID for the async operation. + ID *string `json:"id,omitempty"` + // Name - Name of the async operation. + Name *string `json:"name,omitempty"` + // Status - Operation status. + Status *string `json:"status,omitempty"` + // Properties - Additional information, if available. + Properties map[string]*string `json:"properties"` + // Error - READ-ONLY; If present, details of the operation error. + Error *ErrorDetail `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusResult. +func (osr OperationStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if osr.ID != nil { + objectMap["id"] = osr.ID + } + if osr.Name != nil { + objectMap["name"] = osr.Name + } + if osr.Status != nil { + objectMap["status"] = osr.Status + } + if osr.Properties != nil { + objectMap["properties"] = osr.Properties + } + return json.Marshal(objectMap) +} + +// PatchExtension the Extension Patch Request object. +type PatchExtension struct { + // PatchExtensionProperties - Updatable properties of an Extension Patch Request + *PatchExtensionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PatchExtension. +func (peVar PatchExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.PatchExtensionProperties != nil { + objectMap["properties"] = peVar.PatchExtensionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PatchExtension struct. +func (peVar *PatchExtension) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var patchExtensionProperties PatchExtensionProperties + err = json.Unmarshal(*v, &patchExtensionProperties) + if err != nil { + return err + } + peVar.PatchExtensionProperties = &patchExtensionProperties + } + } + } + + return nil +} + +// PatchExtensionProperties updatable properties of an Extension Patch Request +type PatchExtensionProperties struct { + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` +} + +// MarshalJSON is the custom marshaler for PatchExtensionProperties. +func (peVar PatchExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = peVar.AutoUpgradeMinorVersion + } + if peVar.ReleaseTrain != nil { + objectMap["releaseTrain"] = peVar.ReleaseTrain + } + if peVar.Version != nil { + objectMap["version"] = peVar.Version + } + if peVar.ConfigurationSettings != nil { + objectMap["configurationSettings"] = peVar.ConfigurationSettings + } + if peVar.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = peVar.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// Plan plan for the resource. +type Plan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RepositoryRefDefinition the source reference for the GitRepository object. +type RepositoryRefDefinition struct { + // Branch - The git repository branch name to checkout. + Branch *string `json:"branch,omitempty"` + // Tag - The git repository tag name to checkout. This takes precedence over branch. + Tag *string `json:"tag,omitempty"` + // Semver - The semver range used to match against git repository tags. This takes precedence over tag. + Semver *string `json:"semver,omitempty"` + // Commit - The commit SHA to checkout. This value must be combined with the branch name to be valid. This takes precedence over semver. + Commit *string `json:"commit,omitempty"` +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed +// properties for a resource. Except properties bag, there cannot be a top level property outside of this +// set. +type ResourceModelWithAllowedPropertySet struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + ManagedBy *string `json:"managedBy,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` + Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. +func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Location != nil { + objectMap["location"] = rmwaps.Location + } + if rmwaps.ManagedBy != nil { + objectMap["managedBy"] = rmwaps.ManagedBy + } + if rmwaps.Kind != nil { + objectMap["kind"] = rmwaps.Kind + } + if rmwaps.Tags != nil { + objectMap["tags"] = rmwaps.Tags + } + if rmwaps.Identity != nil { + objectMap["identity"] = rmwaps.Identity + } + if rmwaps.Sku != nil { + objectMap["sku"] = rmwaps.Sku + } + if rmwaps.Plan != nil { + objectMap["plan"] = rmwaps.Plan + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetIdentity ... +type ResourceModelWithAllowedPropertySetIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. +func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Type != "" { + objectMap["type"] = rmwaps.Type + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetPlan ... +type ResourceModelWithAllowedPropertySetPlan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ResourceModelWithAllowedPropertySetSku ... +type ResourceModelWithAllowedPropertySetSku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// ResourceProviderOperation supported operation of this resource provider. +type ResourceProviderOperation struct { + // Name - Operation name, in format of {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *ResourceProviderOperationDisplay `json:"display,omitempty"` + // IsDataAction - READ-ONLY; The flag that indicates whether the operation applies to data plane. + IsDataAction *bool `json:"isDataAction,omitempty"` + // Origin - READ-ONLY; Origin of the operation + Origin *string `json:"origin,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperation. +func (rpo ResourceProviderOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpo.Name != nil { + objectMap["name"] = rpo.Name + } + if rpo.Display != nil { + objectMap["display"] = rpo.Display + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationDisplay display metadata associated with the operation. +type ResourceProviderOperationDisplay struct { + // Provider - Resource provider: Microsoft KubernetesConfiguration. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of this operation. + Description *string `json:"description,omitempty"` +} + +// ResourceProviderOperationList result of the request to list operations. +type ResourceProviderOperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by this resource provider. + Value *[]ResourceProviderOperation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperationList. +func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpol.Value != nil { + objectMap["value"] = rpol.Value + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation +// values. +type ResourceProviderOperationListIterator struct { + i int + page ResourceProviderOperationListPage +} + +// 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 *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.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 *ResourceProviderOperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceProviderOperationListIterator) 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 ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { + 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 ResourceProviderOperationListIterator) Value() ResourceProviderOperation { + if !iter.page.NotDone() { + return ResourceProviderOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceProviderOperationListIterator type. +func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { + return ResourceProviderOperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rpol ResourceProviderOperationList) IsEmpty() bool { + return rpol.Value == nil || len(*rpol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rpol ResourceProviderOperationList) hasNextLink() bool { + return rpol.NextLink != nil && len(*rpol.NextLink) != 0 +} + +// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { + if !rpol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rpol.NextLink))) +} + +// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. +type ResourceProviderOperationListPage struct { + fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) + rpol ResourceProviderOperationList +} + +// 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 *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.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.rpol) + if err != nil { + return err + } + page.rpol = 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 *ResourceProviderOperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceProviderOperationListPage) NotDone() bool { + return !page.rpol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { + return page.rpol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { + if page.rpol.IsEmpty() { + return nil + } + return *page.rpol.Value +} + +// Creates a new instance of the ResourceProviderOperationListPage type. +func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { + return ResourceProviderOperationListPage{ + fn: getNextPage, + rpol: cur, + } +} + +// Scope scope of the extension. It can be either Cluster or Namespace; but not both. +type Scope struct { + // Cluster - Specifies that the scope of the extension is Cluster + Cluster *ScopeCluster `json:"cluster,omitempty"` + // Namespace - Specifies that the scope of the extension is Namespace + Namespace *ScopeNamespace `json:"namespace,omitempty"` +} + +// ScopeCluster specifies that the scope of the extension is Cluster +type ScopeCluster struct { + // ReleaseNamespace - Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created + ReleaseNamespace *string `json:"releaseNamespace,omitempty"` +} + +// ScopeNamespace specifies that the scope of the extension is Namespace +type ScopeNamespace struct { + // TargetNamespace - Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +// Sku the resource model definition representing SKU +type Sku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// SourceControlConfiguration the SourceControl Configuration object returned in Get & Put response. +type SourceControlConfiguration struct { + autorest.Response `json:"-"` + // SourceControlConfigurationProperties - Properties to create a Source Control Configuration resource + *SourceControlConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfiguration. +func (scc SourceControlConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.SourceControlConfigurationProperties != nil { + objectMap["properties"] = scc.SourceControlConfigurationProperties + } + if scc.SystemData != nil { + objectMap["systemData"] = scc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SourceControlConfiguration struct. +func (scc *SourceControlConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var sourceControlConfigurationProperties SourceControlConfigurationProperties + err = json.Unmarshal(*v, &sourceControlConfigurationProperties) + if err != nil { + return err + } + scc.SourceControlConfigurationProperties = &sourceControlConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + scc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scc.Type = &typeVar + } + } + } + + return nil +} + +// SourceControlConfigurationList result of the request to list Source Control Configurations. It contains +// a list of SourceControlConfiguration objects and a URL link to get the next set of results. +type SourceControlConfigurationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Source Control Configurations within a Kubernetes cluster. + Value *[]SourceControlConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationList. +func (sccl SourceControlConfigurationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SourceControlConfigurationListIterator provides access to a complete listing of +// SourceControlConfiguration values. +type SourceControlConfigurationListIterator struct { + i int + page SourceControlConfigurationListPage +} + +// 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 *SourceControlConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListIterator.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 *SourceControlConfigurationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SourceControlConfigurationListIterator) 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 SourceControlConfigurationListIterator) Response() SourceControlConfigurationList { + 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 SourceControlConfigurationListIterator) Value() SourceControlConfiguration { + if !iter.page.NotDone() { + return SourceControlConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SourceControlConfigurationListIterator type. +func NewSourceControlConfigurationListIterator(page SourceControlConfigurationListPage) SourceControlConfigurationListIterator { + return SourceControlConfigurationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sccl SourceControlConfigurationList) IsEmpty() bool { + return sccl.Value == nil || len(*sccl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sccl SourceControlConfigurationList) hasNextLink() bool { + return sccl.NextLink != nil && len(*sccl.NextLink) != 0 +} + +// sourceControlConfigurationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sccl SourceControlConfigurationList) sourceControlConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if !sccl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sccl.NextLink))) +} + +// SourceControlConfigurationListPage contains a page of SourceControlConfiguration values. +type SourceControlConfigurationListPage struct { + fn func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error) + sccl SourceControlConfigurationList +} + +// 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 *SourceControlConfigurationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListPage.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.sccl) + if err != nil { + return err + } + page.sccl = 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 *SourceControlConfigurationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SourceControlConfigurationListPage) NotDone() bool { + return !page.sccl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SourceControlConfigurationListPage) Response() SourceControlConfigurationList { + return page.sccl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SourceControlConfigurationListPage) Values() []SourceControlConfiguration { + if page.sccl.IsEmpty() { + return nil + } + return *page.sccl.Value +} + +// Creates a new instance of the SourceControlConfigurationListPage type. +func NewSourceControlConfigurationListPage(cur SourceControlConfigurationList, getNextPage func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error)) SourceControlConfigurationListPage { + return SourceControlConfigurationListPage{ + fn: getNextPage, + sccl: cur, + } +} + +// SourceControlConfigurationProperties properties to create a Source Control Configuration resource +type SourceControlConfigurationProperties struct { + // RepositoryURL - Url of the SourceControl Repository. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // OperatorNamespace - The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + OperatorNamespace *string `json:"operatorNamespace,omitempty"` + // OperatorInstanceName - Instance name of the operator - identifying the specific configuration. + OperatorInstanceName *string `json:"operatorInstanceName,omitempty"` + // OperatorType - Type of the operator. Possible values include: 'Flux' + OperatorType OperatorType `json:"operatorType,omitempty"` + // OperatorParams - Any Parameters for the Operator instance in string format. + OperatorParams *string `json:"operatorParams,omitempty"` + // ConfigurationProtectedSettings - Name-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // OperatorScope - Scope at which the operator will be installed. Possible values include: 'Cluster', 'Namespace' + OperatorScope OperatorScopeType `json:"operatorScope,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // SSHKnownHostsContents - Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances + SSHKnownHostsContents *string `json:"sshKnownHostsContents,omitempty"` + // EnableHelmOperator - Option to enable Helm Operator for this git configuration. + EnableHelmOperator *bool `json:"enableHelmOperator,omitempty"` + // HelmOperatorProperties - Properties for Helm operator. + HelmOperatorProperties *HelmOperatorProperties `json:"helmOperatorProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource provider. Possible values include: 'ProvisioningStateTypeAccepted', 'ProvisioningStateTypeDeleting', 'ProvisioningStateTypeRunning', 'ProvisioningStateTypeSucceeded', 'ProvisioningStateTypeFailed' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // ComplianceStatus - READ-ONLY; Compliance Status of the Configuration + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationProperties. +func (scc SourceControlConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.RepositoryURL != nil { + objectMap["repositoryUrl"] = scc.RepositoryURL + } + if scc.OperatorNamespace != nil { + objectMap["operatorNamespace"] = scc.OperatorNamespace + } + if scc.OperatorInstanceName != nil { + objectMap["operatorInstanceName"] = scc.OperatorInstanceName + } + if scc.OperatorType != "" { + objectMap["operatorType"] = scc.OperatorType + } + if scc.OperatorParams != nil { + objectMap["operatorParams"] = scc.OperatorParams + } + if scc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = scc.ConfigurationProtectedSettings + } + if scc.OperatorScope != "" { + objectMap["operatorScope"] = scc.OperatorScope + } + if scc.SSHKnownHostsContents != nil { + objectMap["sshKnownHostsContents"] = scc.SSHKnownHostsContents + } + if scc.EnableHelmOperator != nil { + objectMap["enableHelmOperator"] = scc.EnableHelmOperator + } + if scc.HelmOperatorProperties != nil { + objectMap["helmOperatorProperties"] = scc.HelmOperatorProperties + } + return json.Marshal(objectMap) +} + +// SourceControlConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SourceControlConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SourceControlConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SourceControlConfigurationsDeleteFuture) 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 SourceControlConfigurationsDeleteFuture.Result. +func (future *SourceControlConfigurationsDeleteFuture) result(client SourceControlConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.SourceControlConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SupportedScopes extension scopes +type SupportedScopes struct { + // DefaultScope - Default extension scopes: cluster or namespace + DefaultScope *string `json:"defaultScope,omitempty"` + // ClusterScopeSettings - Scope settings + ClusterScopeSettings *ClusterScopeSettings `json:"clusterScopeSettings,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/operations.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/operations.go new file mode 100644 index 000000000000..b08a45c050b4 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/operations.go @@ -0,0 +1,140 @@ +package kubernetesconfiguration + +// 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 kubernetesConfiguration Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all the available operations the KubernetesConfiguration resource provider supports. +func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.rpol.Response.Response != nil { + sc = result.rpol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rpol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.rpol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.rpol.hasNextLink() && result.rpol.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-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.KubernetesConfiguration/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 ResourceProviderOperationList, 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 ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { + req, err := lastResults.resourceProviderOperationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.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, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.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 ResourceProviderOperationListIterator, 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/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/operationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/operationstatus.go new file mode 100644 index 000000000000..0a88f703e9e9 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/operationstatus.go @@ -0,0 +1,260 @@ +package kubernetesconfiguration + +// 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" +) + +// OperationStatusClient is the kubernetesConfiguration Client +type OperationStatusClient struct { + BaseClient +} + +// NewOperationStatusClient creates an instance of the OperationStatusClient client. +func NewOperationStatusClient(subscriptionID string) OperationStatusClient { + return NewOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationStatusClientWithBaseURI creates an instance of the OperationStatusClient 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 NewOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) OperationStatusClient { + return OperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// operationID - operation Id +func (client OperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.OperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}", 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 OperationStatusClient) 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 OperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list Async Operations, currently in progress, in a cluster +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client OperationStatusClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result OperationStatusListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.List") + defer func() { + sc := -1 + if result.osl.Response.Response != nil { + sc = result.osl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.OperationStatusClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.osl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure sending request") + return + } + + result.osl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure responding to request") + return + } + if result.osl.hasNextLink() && result.osl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations", 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 OperationStatusClient) 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 OperationStatusClient) ListResponder(resp *http.Response) (result OperationStatusList, 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 OperationStatusClient) listNextResults(ctx context.Context, lastResults OperationStatusList) (result OperationStatusList, err error) { + req, err := lastResults.operationStatusListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "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, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationStatusClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result OperationStatusListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/sourcecontrolconfigurations.go new file mode 100644 index 000000000000..bf36d87ae8b2 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -0,0 +1,451 @@ +package kubernetesconfiguration + +// 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" +) + +// SourceControlConfigurationsClient is the kubernetesConfiguration Client +type SourceControlConfigurationsClient struct { + BaseClient +} + +// NewSourceControlConfigurationsClient creates an instance of the SourceControlConfigurationsClient client. +func NewSourceControlConfigurationsClient(subscriptionID string) SourceControlConfigurationsClient { + return NewSourceControlConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSourceControlConfigurationsClientWithBaseURI creates an instance of the SourceControlConfigurationsClient 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 NewSourceControlConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlConfigurationsClient { + return SourceControlConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +// sourceControlConfiguration - properties necessary to Create KubernetesConfiguration. +func (client SourceControlConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, sourceControlConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SourceControlConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", pathParameters), + autorest.WithJSON(sourceControlConfiguration), + 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 SourceControlConfigurationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result SourceControlConfiguration, 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 this will delete the YAML file used to set up the Source control configuration, thus stopping future sync +// from the source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result SourceControlConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SourceControlConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) DeleteSender(req *http.Request) (future SourceControlConfigurationsDeleteFuture, 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 SourceControlConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details of the Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SourceControlConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) GetResponder(resp *http.Response) (result SourceControlConfiguration, 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 Source Control Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client SourceControlConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result SourceControlConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.sccl.Response.Response != nil { + sc = result.sccl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("kubernetesconfiguration.SourceControlConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sccl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.sccl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.sccl.hasNextLink() && result.sccl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SourceControlConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) ListResponder(resp *http.Response) (result SourceControlConfigurationList, 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 SourceControlConfigurationsClient) listNextResults(ctx context.Context, lastResults SourceControlConfigurationList) (result SourceControlConfigurationList, err error) { + req, err := lastResults.sourceControlConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "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, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SourceControlConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result SourceControlConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/version.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/version.go new file mode 100644 index 000000000000..32a827004e3e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/version.go @@ -0,0 +1,19 @@ +package kubernetesconfiguration + +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() + " kubernetesconfiguration/2022-01-15-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/CHANGELOG.md index 52911e4cc5e4..27e39b27707d 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/CHANGELOG.md +++ b/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/CHANGELOG.md @@ -1,2 +1,9 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Struct Fields + +1. ResourceModelWithAllowedPropertySet.SystemData diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/_meta.json index 5bc03d55769e..cd5a759fc5d5 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/_meta.json +++ b/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "9d8640319ef481ae301b67b033d6ae0bd30422c3", + "commit": "62dc7865a18791290f282ed54bcb1d4b1517af16", "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", "tag": "package-preview-2022-04", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/models.go b/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/models.go index 057c0bd032eb..c8d70f872bf3 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/models.go +++ b/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/models.go @@ -2260,42 +2260,38 @@ func (r Resource) MarshalJSON() ([]byte, error) { // properties for a resource. Except properties bag, there cannot be a top level property outside of this // set. type ResourceModelWithAllowedPropertySet struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. ManagedBy *string `json:"managedBy,omitempty"` // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. Kind *string `json:"kind,omitempty"` // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` + Etag *string `json:"etag,omitempty"` Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` } // MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if rmwaps.Location != nil { - objectMap["location"] = rmwaps.Location - } if rmwaps.ManagedBy != nil { objectMap["managedBy"] = rmwaps.ManagedBy } if rmwaps.Kind != nil { objectMap["kind"] = rmwaps.Kind } - if rmwaps.Tags != nil { - objectMap["tags"] = rmwaps.Tags - } if rmwaps.Identity != nil { objectMap["identity"] = rmwaps.Identity } @@ -2305,6 +2301,12 @@ func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) if rmwaps.Plan != nil { objectMap["plan"] = rmwaps.Plan } + if rmwaps.Tags != nil { + objectMap["tags"] = rmwaps.Tags + } + if rmwaps.Location != nil { + objectMap["location"] = rmwaps.Location + } return json.Marshal(objectMap) }