From 9fcc5e98199fbfc671667d109b1f09438df4895e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 22 Oct 2024 16:53:56 +0000 Subject: [PATCH] CodeGen from PR 30956 in Azure/azure-rest-api-specs Merge 271ecf2f71475ee9f484abcdbe25f32be09f9a26 into d1dc8a3c92c2725c4854f9c4189b08fe3c0ca4c8 --- .../armkubernetesconfiguration/CHANGELOG.md | 29 + .../armkubernetesconfiguration/README.md | 6 +- .../armkubernetesconfiguration/autorest.md | 7 +- .../client_factory.go | 44 +- .../armkubernetesconfiguration/constants.go | 21 +- .../extensions_client_example_test.go | 480 --------- .../fake/extensions_server.go | 2 +- .../fake/fluxconfigoperationstatus_server.go | 2 +- .../fake/fluxconfigurations_server.go | 2 +- .../fake/operations_server.go | 2 +- .../fake/operationstatus_server.go | 2 +- .../sourcecontrolconfigurations_server.go | 2 +- .../fake/time_rfc3339.go | 42 +- .../fluxconfigoperationstatus_client.go | 4 +- ...nfigoperationstatus_client_example_test.go | 45 - .../fluxconfigurations_client.go | 26 +- .../fluxconfigurations_client_example_test.go | 912 ------------------ .../armkubernetesconfiguration/go.mod | 14 +- .../armkubernetesconfiguration/go.sum | 17 - .../armkubernetesconfiguration/models.go | 221 ++++- .../models_serde.go | 552 ++++++++++- .../operations_client_example_test.go | 189 ---- .../operationstatus_client_example_test.go | 87 -- .../{response_types.go => responses.go} | 0 ...ntrolconfigurations_client_example_test.go | 245 ----- .../time_rfc3339.go | 42 +- 26 files changed, 942 insertions(+), 2053 deletions(-) delete mode 100644 sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/extensions_client_example_test.go delete mode 100644 sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigoperationstatus_client_example_test.go delete mode 100644 sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigurations_client_example_test.go delete mode 100644 sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/operationstatus_client_example_test.go rename sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/{response_types.go => responses.go} (100%) delete mode 100644 sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/sourcecontrolconfigurations_client_example_test.go diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/CHANGELOG.md b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/CHANGELOG.md index 96bfb859e261..150bb389cce7 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/CHANGELOG.md +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/CHANGELOG.md @@ -1,5 +1,34 @@ # Release History +## 3.0.0 (2024-10-22) +### Breaking Changes + +- Type of `KustomizationPatchDefinition.PostBuild` has been changed from `*PostBuildDefinition` to `*PostBuildPatchDefinition` + +### Features Added + +- New value `SourceKindTypeOCIRepository` added to enum type `SourceKindType` +- New enum type `OperationType` with values `OperationTypeCopy`, `OperationTypeExtract` +- New struct `LayerSelectorDefinition` +- New struct `LayerSelectorPatchDefinition` +- New struct `MatchOidcIdentityDefinition` +- New struct `MatchOidcIdentityPatchDefinition` +- New struct `OCIRepositoryDefinition` +- New struct `OCIRepositoryPatchDefinition` +- New struct `OCIRepositoryRefDefinition` +- New struct `OCIRepositoryRefPatchDefinition` +- New struct `PostBuildPatchDefinition` +- New struct `SubstituteFromPatchDefinition` +- New struct `TLSConfigDefinition` +- New struct `TLSConfigPatchDefinition` +- New struct `VerifyDefinition` +- New struct `VerifyPatchDefinition` +- New field `OciRepository` in struct `FluxConfigurationPatchProperties` +- New field `OciRepository` in struct `FluxConfigurationProperties` +- New field `Provider` in struct `GitRepositoryDefinition` +- New field `Provider` in struct `GitRepositoryPatchDefinition` + + ## 2.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/README.md b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/README.md index b6d14648ef8d..74de18186403 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/README.md +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/README.md @@ -1,6 +1,6 @@ # Azure Kubernetes Configuration Module for Go -[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v3)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v3) The `armkubernetesconfiguration` module provides operations for working with Azure Kubernetes Configuration. @@ -20,7 +20,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Kubernetes Configuration module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2 +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v3 ``` ## Authorization @@ -57,7 +57,7 @@ clientFactory, err := armkubernetesconfiguration.NewClientFactory(", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginCreate(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", armkubernetesconfiguration.Extension{ - Properties: &armkubernetesconfiguration.ExtensionProperties{ - AutoUpgradeMinorVersion: to.Ptr(true), - ConfigurationProtectedSettings: map[string]*string{ - "omsagent.secret.key": to.Ptr("secretKeyValue01"), - }, - ConfigurationSettings: map[string]*string{ - "omsagent.env.clusterName": to.Ptr("clusterName1"), - "omsagent.secret.wsid": to.Ptr("00000000-0000-0000-0000-000000000000"), - }, - ExtensionType: to.Ptr("azuremonitor-containers"), - ReleaseTrain: to.Ptr("Preview"), - Scope: &armkubernetesconfiguration.Scope{ - Cluster: &armkubernetesconfiguration.ScopeCluster{ - ReleaseNamespace: to.Ptr("kube-system"), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Extension = armkubernetesconfiguration.Extension{ - // Name: to.Ptr("ClusterMonitor"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/extensions"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/extensions/ClusterMonitor"), - // Properties: &armkubernetesconfiguration.ExtensionProperties{ - // AutoUpgradeMinorVersion: to.Ptr(false), - // ConfigurationSettings: map[string]*string{ - // "omsagent.env.clusterName": to.Ptr("clusterName1"), - // "omsagent.secret.wsid": to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // CurrentVersion: to.Ptr("0.1.4"), - // ExtensionType: to.Ptr("azuremonitor-containers"), - // IsSystemExtension: to.Ptr(false), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // ReleaseTrain: to.Ptr("Preview"), - // Scope: &armkubernetesconfiguration.Scope{ - // Cluster: &armkubernetesconfiguration.ScopeCluster{ - // ReleaseNamespace: to.Ptr("kube-system"), - // }, - // }, - // Statuses: []*armkubernetesconfiguration.ExtensionStatus{ - // }, - // Version: to.Ptr("0.1.4"), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateExtensionWithPlan.json -func ExampleExtensionsClient_BeginCreate_createExtensionWithPlan() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginCreate(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "azureVote", armkubernetesconfiguration.Extension{ - Plan: &armkubernetesconfiguration.Plan{ - Name: to.Ptr("azure-vote-standard"), - Product: to.Ptr("azure-vote-standard-offer-id"), - Publisher: to.Ptr("Microsoft"), - }, - Properties: &armkubernetesconfiguration.ExtensionProperties{ - AutoUpgradeMinorVersion: to.Ptr(true), - ExtensionType: to.Ptr("azure-vote"), - ReleaseTrain: to.Ptr("Preview"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Extension = armkubernetesconfiguration.Extension{ - // Name: to.Ptr("azureVote"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/extensions"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/extensions/azureVote"), - // Plan: &armkubernetesconfiguration.Plan{ - // Name: to.Ptr("azure-vote-standard"), - // Product: to.Ptr("azure-vote-standard-offer-id"), - // Publisher: to.Ptr("Microsoft"), - // }, - // Properties: &armkubernetesconfiguration.ExtensionProperties{ - // AutoUpgradeMinorVersion: to.Ptr(true), - // CurrentVersion: to.Ptr("0.1.4"), - // ExtensionType: to.Ptr("azure-vote"), - // IsSystemExtension: to.Ptr(false), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // ReleaseTrain: to.Ptr("Preview"), - // Scope: &armkubernetesconfiguration.Scope{ - // Cluster: &armkubernetesconfiguration.ScopeCluster{ - // ReleaseNamespace: to.Ptr("kube-system"), - // }, - // }, - // Statuses: []*armkubernetesconfiguration.ExtensionStatus{ - // }, - // Version: to.Ptr("0.1.4"), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetExtension.json -func ExampleExtensionsClient_Get_getExtension() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtensionsClient().Get(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Extension = armkubernetesconfiguration.Extension{ - // Name: to.Ptr("ClusterMonitor"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/extensions"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/extensions/ClusterMonitor"), - // Properties: &armkubernetesconfiguration.ExtensionProperties{ - // AutoUpgradeMinorVersion: to.Ptr(false), - // ConfigurationSettings: map[string]*string{ - // "omsagent.env.clusterName": to.Ptr("clusterName1"), - // "omsagent.secret.wsid": to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // CurrentVersion: to.Ptr("0.1.4"), - // ExtensionType: to.Ptr("azuremonitor-containers"), - // IsSystemExtension: to.Ptr(false), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // ReleaseTrain: to.Ptr("Preview"), - // Scope: &armkubernetesconfiguration.Scope{ - // Cluster: &armkubernetesconfiguration.ScopeCluster{ - // ReleaseNamespace: to.Ptr("kube-system"), - // }, - // }, - // Statuses: []*armkubernetesconfiguration.ExtensionStatus{ - // }, - // Version: to.Ptr("0.1.4"), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetExtensionWithPlan.json -func ExampleExtensionsClient_Get_getExtensionWithPlan() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtensionsClient().Get(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "azureVote", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Extension = armkubernetesconfiguration.Extension{ - // Name: to.Ptr("azureVote"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/extensions"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/extensions/azureVote"), - // Plan: &armkubernetesconfiguration.Plan{ - // Name: to.Ptr("azure-vote-standard"), - // Product: to.Ptr("azure-vote-standard-offer-id"), - // Publisher: to.Ptr("Microsoft"), - // }, - // Properties: &armkubernetesconfiguration.ExtensionProperties{ - // AutoUpgradeMinorVersion: to.Ptr(false), - // ConfigurationSettings: map[string]*string{ - // "omsagent.env.clusterName": to.Ptr("clusterName1"), - // "omsagent.secret.wsid": to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // CurrentVersion: to.Ptr("0.1.4"), - // ExtensionType: to.Ptr("azure-vote"), - // IsSystemExtension: to.Ptr(false), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // ReleaseTrain: to.Ptr("Preview"), - // Scope: &armkubernetesconfiguration.Scope{ - // Cluster: &armkubernetesconfiguration.ScopeCluster{ - // ReleaseNamespace: to.Ptr("kube-system"), - // }, - // }, - // Statuses: []*armkubernetesconfiguration.ExtensionStatus{ - // }, - // Version: to.Ptr("0.1.4"), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/DeleteExtension.json -func ExampleExtensionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginDelete(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", &armkubernetesconfiguration.ExtensionsClientBeginDeleteOptions{ForceDelete: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/PatchExtension.json -func ExampleExtensionsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginUpdate(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", armkubernetesconfiguration.PatchExtension{ - Properties: &armkubernetesconfiguration.PatchExtensionProperties{ - AutoUpgradeMinorVersion: to.Ptr(true), - ConfigurationProtectedSettings: map[string]*string{ - "omsagent.secret.key": to.Ptr("secretKeyValue01"), - }, - ConfigurationSettings: map[string]*string{ - "omsagent.env.clusterName": to.Ptr("clusterName1"), - "omsagent.secret.wsid": to.Ptr("00000000-0000-0000-0000-000000000000"), - }, - ReleaseTrain: to.Ptr("Preview"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Extension = armkubernetesconfiguration.Extension{ - // Properties: &armkubernetesconfiguration.ExtensionProperties{ - // AutoUpgradeMinorVersion: to.Ptr(true), - // ConfigurationSettings: map[string]*string{ - // "omsagent.env.clusterName": to.Ptr("clusterName1"), - // "omsagent.secret.wsid": to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // ExtensionType: to.Ptr("azuremonitor-containers"), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // ReleaseTrain: to.Ptr("Preview"), - // Scope: &armkubernetesconfiguration.Scope{ - // Cluster: &armkubernetesconfiguration.ScopeCluster{ - // ReleaseNamespace: to.Ptr("kube-system"), - // }, - // }, - // Statuses: []*armkubernetesconfiguration.ExtensionStatus{ - // }, - // Version: to.Ptr("0.1.4"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/ListExtensions.json -func ExampleExtensionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExtensionsClient().NewListPager("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExtensionsList = armkubernetesconfiguration.ExtensionsList{ - // Value: []*armkubernetesconfiguration.Extension{ - // { - // Name: to.Ptr("ClusterMonitor"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/extensions"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/extensions/ClusterMonitor"), - // Properties: &armkubernetesconfiguration.ExtensionProperties{ - // AutoUpgradeMinorVersion: to.Ptr(false), - // ConfigurationSettings: map[string]*string{ - // "omsagent.env.clusterName": to.Ptr("clusterName1"), - // "omsagent.secret.wsid": to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // CurrentVersion: to.Ptr("0.1.4"), - // ExtensionType: to.Ptr("azuremonitor-containers"), - // IsSystemExtension: to.Ptr(false), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // ReleaseTrain: to.Ptr("Preview"), - // Scope: &armkubernetesconfiguration.Scope{ - // Cluster: &armkubernetesconfiguration.ScopeCluster{ - // ReleaseNamespace: to.Ptr("kube-system"), - // }, - // }, - // Statuses: []*armkubernetesconfiguration.ExtensionStatus{ - // }, - // Version: to.Ptr("0.1.4"), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // }, - // { - // Name: to.Ptr("App1Monitor"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/extensions"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/extensions/BackupVault01"), - // Properties: &armkubernetesconfiguration.ExtensionProperties{ - // AutoUpgradeMinorVersion: to.Ptr(true), - // ConfigurationSettings: map[string]*string{ - // }, - // CurrentVersion: to.Ptr("1.0.1"), - // ExtensionType: to.Ptr("Microsoft.RecoveryServices/recoveryVault"), - // IsSystemExtension: to.Ptr(false), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // ReleaseTrain: to.Ptr("Stable"), - // Scope: &armkubernetesconfiguration.Scope{ - // Cluster: &armkubernetesconfiguration.ScopeCluster{ - // ReleaseNamespace: to.Ptr("myKVNamespace"), - // }, - // }, - // Statuses: []*armkubernetesconfiguration.ExtensionStatus{ - // }, - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T04:09:23.011Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T04:09:23.011Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // }, - // { - // Name: to.Ptr("azureVote"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/extensions"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/extensions/azureVote"), - // Plan: &armkubernetesconfiguration.Plan{ - // Name: to.Ptr("azure-vote-standard"), - // Product: to.Ptr("azure-vote-standard-offer-id"), - // Publisher: to.Ptr("Microsoft"), - // }, - // Properties: &armkubernetesconfiguration.ExtensionProperties{ - // AutoUpgradeMinorVersion: to.Ptr(false), - // ConfigurationSettings: map[string]*string{ - // "omsagent.env.clusterName": to.Ptr("clusterName1"), - // "omsagent.secret.wsid": to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // CurrentVersion: to.Ptr("0.1.4"), - // ExtensionType: to.Ptr("azure-vote"), - // IsSystemExtension: to.Ptr(false), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // ReleaseTrain: to.Ptr("Preview"), - // Scope: &armkubernetesconfiguration.Scope{ - // Cluster: &armkubernetesconfiguration.ScopeCluster{ - // ReleaseNamespace: to.Ptr("kube-system"), - // }, - // }, - // Statuses: []*armkubernetesconfiguration.ExtensionStatus{ - // }, - // Version: to.Ptr("0.1.4"), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-08T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/extensions_server.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/extensions_server.go index 7c031ea9ec88..38f4a8fa4dfd 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/extensions_server.go +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/extensions_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/fluxconfigoperationstatus_server.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/fluxconfigoperationstatus_server.go index d9848430a106..f7dea4ed9fa9 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/fluxconfigoperationstatus_server.go +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/fluxconfigoperationstatus_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/fluxconfigurations_server.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/fluxconfigurations_server.go index 14895f5a07c3..c0a31b4d7d80 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/fluxconfigurations_server.go +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/fluxconfigurations_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/operations_server.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/operations_server.go index 2c1425a3394a..85eab55aec71 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/operations_server.go +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/operations_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v3" "net/http" ) diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/operationstatus_server.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/operationstatus_server.go index cb60bb9cf009..7484f8bcc886 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/operationstatus_server.go +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/operationstatus_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/sourcecontrolconfigurations_server.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/sourcecontrolconfigurations_server.go index cd7a466bcb40..a7322399abf1 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/sourcecontrolconfigurations_server.go +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/sourcecontrolconfigurations_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v3" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/time_rfc3339.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/time_rfc3339.go +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigoperationstatus_client.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigoperationstatus_client.go index b75bced7a001..ddae81f4b22a 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigoperationstatus_client.go +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigoperationstatus_client.go @@ -46,7 +46,7 @@ func NewFluxConfigOperationStatusClient(subscriptionID string, credential azcore // Get - Get Async Operation status // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterRp - The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. // - clusterResourceName - The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. @@ -113,7 +113,7 @@ func (client *FluxConfigOperationStatusClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigoperationstatus_client_example_test.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigoperationstatus_client_example_test.go deleted file mode 100644 index 8ea1ea8069f8..000000000000 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armkubernetesconfiguration_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetFluxConfigurationAsyncOperationStatus.json -func ExampleFluxConfigOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFluxConfigOperationStatusClient().Get(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "srs-fluxconfig", "99999999-9999-9999-9999-999999999999", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatusResult = armkubernetesconfiguration.OperationStatusResult{ - // Name: to.Ptr("99999999-9999-9999-9999-999999999999"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/srs-fluxconfig/operations/99999999-9999-9999-9999-999999999999"), - // Properties: map[string]*string{ - // }, - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigurations_client.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigurations_client.go index 859edd1d1f8b..7979b1513ce4 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigurations_client.go +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigurations_client.go @@ -47,7 +47,7 @@ func NewFluxConfigurationsClient(subscriptionID string, credential azcore.TokenC // BeginCreateOrUpdate - Create a new Kubernetes Flux Configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterRp - The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. // - clusterResourceName - The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. @@ -77,7 +77,7 @@ func (client *FluxConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Create a new Kubernetes Flux Configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2024-11-01 func (client *FluxConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration, options *FluxConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "FluxConfigurationsClient.BeginCreateOrUpdate" @@ -131,7 +131,7 @@ func (client *FluxConfigurationsClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, fluxConfiguration); err != nil { @@ -144,7 +144,7 @@ func (client *FluxConfigurationsClient) createOrUpdateCreateRequest(ctx context. // source repo. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterRp - The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. // - clusterResourceName - The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. @@ -174,7 +174,7 @@ func (client *FluxConfigurationsClient) BeginDelete(ctx context.Context, resourc // repo. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2024-11-01 func (client *FluxConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, options *FluxConfigurationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "FluxConfigurationsClient.BeginDelete" @@ -228,7 +228,7 @@ func (client *FluxConfigurationsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2024-11-01") if options != nil && options.ForceDelete != nil { reqQP.Set("forceDelete", strconv.FormatBool(*options.ForceDelete)) } @@ -240,7 +240,7 @@ func (client *FluxConfigurationsClient) deleteCreateRequest(ctx context.Context, // Get - Gets details of the Flux Configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterRp - The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. // - clusterResourceName - The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. @@ -301,7 +301,7 @@ func (client *FluxConfigurationsClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -318,7 +318,7 @@ func (client *FluxConfigurationsClient) getHandleResponse(resp *http.Response) ( // NewListPager - List all Flux Configurations. // -// Generated from API version 2023-05-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterRp - The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. // - clusterResourceName - The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. @@ -376,7 +376,7 @@ func (client *FluxConfigurationsClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -394,7 +394,7 @@ func (client *FluxConfigurationsClient) listHandleResponse(resp *http.Response) // BeginUpdate - Update an existing Kubernetes Flux Configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2024-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterRp - The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. // - clusterResourceName - The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. @@ -424,7 +424,7 @@ func (client *FluxConfigurationsClient) BeginUpdate(ctx context.Context, resourc // Update - Update an existing Kubernetes Flux Configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-05-01 +// Generated from API version 2024-11-01 func (client *FluxConfigurationsClient) update(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch, options *FluxConfigurationsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "FluxConfigurationsClient.BeginUpdate" @@ -478,7 +478,7 @@ func (client *FluxConfigurationsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-05-01") + reqQP.Set("api-version", "2024-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, fluxConfigurationPatch); err != nil { diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigurations_client_example_test.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigurations_client_example_test.go deleted file mode 100644 index acdff00dd174..000000000000 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/fluxconfigurations_client_example_test.go +++ /dev/null @@ -1,912 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armkubernetesconfiguration_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetFluxConfiguration.json -func ExampleFluxConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFluxConfigurationsClient().Get(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "srs-fluxconfig", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FluxConfiguration = armkubernetesconfiguration.FluxConfiguration{ - // Name: to.Ptr("srs-fluxconfig"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/fluxConfigurations"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/srs-fluxconfig"), - // Properties: &armkubernetesconfiguration.FluxConfigurationProperties{ - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // ErrorMessage: to.Ptr(""), - // GitRepository: &armkubernetesconfiguration.GitRepositoryDefinition{ - // RepositoryRef: &armkubernetesconfiguration.RepositoryRefDefinition{ - // Branch: to.Ptr("master"), - // }, - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // URL: to.Ptr("https://github.com/Azure/arc-k8s-demo"), - // }, - // Kustomizations: map[string]*armkubernetesconfiguration.KustomizationDefinition{ - // "srs-kustomization1": &armkubernetesconfiguration.KustomizationDefinition{ - // Name: to.Ptr("srs-kustomization1"), - // Path: to.Ptr("./test/path"), - // DependsOn: []*string{ - // }, - // PostBuild: &armkubernetesconfiguration.PostBuildDefinition{ - // Substitute: map[string]*string{ - // "cluster_env": to.Ptr("prod"), - // "replica_count": to.Ptr("2"), - // }, - // SubstituteFrom: []*armkubernetesconfiguration.SubstituteFromDefinition{ - // { - // Name: to.Ptr("cluster-test"), - // Kind: to.Ptr("ConfigMap"), - // Optional: to.Ptr(true), - // }}, - // }, - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // Wait: to.Ptr(true), - // }, - // "srs-kustomization2": &armkubernetesconfiguration.KustomizationDefinition{ - // Name: to.Ptr("srs-kustomization2"), - // Path: to.Ptr("./other/test/path"), - // DependsOn: []*string{ - // to.Ptr("srs-kustomization1")}, - // PostBuild: &armkubernetesconfiguration.PostBuildDefinition{ - // SubstituteFrom: []*armkubernetesconfiguration.SubstituteFromDefinition{ - // { - // Name: to.Ptr("cluster-values"), - // Kind: to.Ptr("ConfigMap"), - // Optional: to.Ptr(true), - // }, - // { - // Name: to.Ptr("secret-name"), - // Kind: to.Ptr("Secret"), - // Optional: to.Ptr(false), - // }}, - // }, - // Prune: to.Ptr(false), - // RetryIntervalInSeconds: to.Ptr[int64](600), - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // Wait: to.Ptr(false), - // }, - // }, - // Namespace: to.Ptr("srs-namespace"), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // RepositoryPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiNkrANrhtRy+02Xc7b5bwvgOKvQMbqUQaXeB6FCDkbLaavw/zO/vIhIBEQu+vbBt6IlI/Pui0rMFr5JjA8Vwwd85oabzU07TPzbFvKSU9eCXqWRKWf0DHNQj/kxPJNtyPYFv3lGoiZZ6QzejOxlW/lPPokUePN0oI10daWwqznm2q0Cmh1EgPUYveq3J5KCWncZXCdwY36zWYulCWFaqazoaGy4kxcqlVy+mPjE/UJthaoLm3mq+23uhlmmfCc1j7W6+H6fcOwTyOtcbimxz2Ug8HlTzSTXBPtEe7qyllMyk62EPNUUq4bVoVsex9sKBK6/hW0Cn2P5i5jslUPCQF"), - // Scope: to.Ptr(armkubernetesconfiguration.ScopeTypeCluster), - // SourceKind: to.Ptr(armkubernetesconfiguration.SourceKindTypeGitRepository), - // SourceSyncedCommitID: to.Ptr("master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590"), - // SourceUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:17:12.000Z"); return t}()), - // StatusUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:17:12.000Z"); return t}()), - // Statuses: []*armkubernetesconfiguration.ObjectStatusDefinition{ - // { - // Name: to.Ptr("srs-fluxconfig"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // Kind: to.Ptr("GitRepository"), - // StatusConditions: []*armkubernetesconfiguration.ObjectStatusConditionDefinition{ - // { - // Type: to.Ptr("Ready"), - // LastTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:12:40.000Z"); return t}()), - // Message: to.Ptr("'Fetched revision: master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590'"), - // Reason: to.Ptr("GitOperationSucceed"), - // Status: to.Ptr("True"), - // }}, - // }, - // { - // Name: to.Ptr("srs-fluxconfig-srs-kustomization1"), - // AppliedBy: &armkubernetesconfiguration.ObjectReferenceDefinition{ - // Name: to.Ptr("my-name"), - // Namespace: to.Ptr("my-namespace"), - // }, - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // HelmReleaseProperties: &armkubernetesconfiguration.HelmReleasePropertiesDefinition{ - // HelmChartRef: &armkubernetesconfiguration.ObjectReferenceDefinition{ - // Name: to.Ptr("myname"), - // Namespace: to.Ptr("mynamespace"), - // }, - // LastRevisionApplied: to.Ptr[int64](1), - // }, - // Kind: to.Ptr("Kustomization"), - // StatusConditions: []*armkubernetesconfiguration.ObjectStatusConditionDefinition{ - // { - // Type: to.Ptr("Ready"), - // LastTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:12:40.000Z"); return t}()), - // Message: to.Ptr("'Applied revision: master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590'"), - // Reason: to.Ptr("ReconciliationSucceeded"), - // Status: to.Ptr("True"), - // }}, - // }, - // { - // Name: to.Ptr("srs-fluxconfig-srs-kustomization2"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // HelmReleaseProperties: &armkubernetesconfiguration.HelmReleasePropertiesDefinition{ - // HelmChartRef: &armkubernetesconfiguration.ObjectReferenceDefinition{ - // Name: to.Ptr("myname"), - // Namespace: to.Ptr("mynamespace"), - // }, - // LastRevisionApplied: to.Ptr[int64](1), - // }, - // Kind: to.Ptr("Kustomization"), - // StatusConditions: []*armkubernetesconfiguration.ObjectStatusConditionDefinition{ - // { - // Type: to.Ptr("Ready"), - // LastTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:12:40.000Z"); return t}()), - // Message: to.Ptr("'Applied revision: master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590'"), - // Reason: to.Ptr("ReconciliationSucceeded"), - // Status: to.Ptr("True"), - // }}, - // }}, - // Suspend: to.Ptr(false), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-19T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateFluxConfiguration.json -func ExampleFluxConfigurationsClient_BeginCreateOrUpdate_createFluxConfiguration() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFluxConfigurationsClient().BeginCreateOrUpdate(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "srs-fluxconfig", armkubernetesconfiguration.FluxConfiguration{ - Properties: &armkubernetesconfiguration.FluxConfigurationProperties{ - GitRepository: &armkubernetesconfiguration.GitRepositoryDefinition{ - HTTPSCACert: to.Ptr("ZXhhbXBsZWNlcnRpZmljYXRl"), - RepositoryRef: &armkubernetesconfiguration.RepositoryRefDefinition{ - Branch: to.Ptr("master"), - }, - SyncIntervalInSeconds: to.Ptr[int64](600), - TimeoutInSeconds: to.Ptr[int64](600), - URL: to.Ptr("https://github.com/Azure/arc-k8s-demo"), - }, - Kustomizations: map[string]*armkubernetesconfiguration.KustomizationDefinition{ - "srs-kustomization1": { - Path: to.Ptr("./test/path"), - DependsOn: []*string{}, - PostBuild: &armkubernetesconfiguration.PostBuildDefinition{ - Substitute: map[string]*string{ - "cluster_env": to.Ptr("prod"), - "replica_count": to.Ptr("2"), - }, - SubstituteFrom: []*armkubernetesconfiguration.SubstituteFromDefinition{ - { - Name: to.Ptr("cluster-test"), - Kind: to.Ptr("ConfigMap"), - Optional: to.Ptr(true), - }}, - }, - SyncIntervalInSeconds: to.Ptr[int64](600), - TimeoutInSeconds: to.Ptr[int64](600), - Wait: to.Ptr(true), - }, - "srs-kustomization2": { - Path: to.Ptr("./other/test/path"), - DependsOn: []*string{ - to.Ptr("srs-kustomization1")}, - PostBuild: &armkubernetesconfiguration.PostBuildDefinition{ - SubstituteFrom: []*armkubernetesconfiguration.SubstituteFromDefinition{ - { - Name: to.Ptr("cluster-values"), - Kind: to.Ptr("ConfigMap"), - Optional: to.Ptr(true), - }, - { - Name: to.Ptr("secret-name"), - Kind: to.Ptr("Secret"), - Optional: to.Ptr(false), - }}, - }, - Prune: to.Ptr(false), - RetryIntervalInSeconds: to.Ptr[int64](600), - SyncIntervalInSeconds: to.Ptr[int64](600), - TimeoutInSeconds: to.Ptr[int64](600), - Wait: to.Ptr(false), - }, - }, - Namespace: to.Ptr("srs-namespace"), - ReconciliationWaitDuration: to.Ptr("PT30M"), - Scope: to.Ptr(armkubernetesconfiguration.ScopeTypeCluster), - SourceKind: to.Ptr(armkubernetesconfiguration.SourceKindTypeGitRepository), - Suspend: to.Ptr(false), - WaitForReconciliation: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FluxConfiguration = armkubernetesconfiguration.FluxConfiguration{ - // Name: to.Ptr("srs-fluxconfig"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/fluxConfigurations"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/srs-fluxconfig"), - // Properties: &armkubernetesconfiguration.FluxConfigurationProperties{ - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // ErrorMessage: to.Ptr(""), - // GitRepository: &armkubernetesconfiguration.GitRepositoryDefinition{ - // HTTPSCACert: to.Ptr("ZXhhbXBsZWNlcnRpZmljYXRl"), - // RepositoryRef: &armkubernetesconfiguration.RepositoryRefDefinition{ - // Branch: to.Ptr("master"), - // }, - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // URL: to.Ptr("https://github.com/Azure/arc-k8s-demo"), - // }, - // Kustomizations: map[string]*armkubernetesconfiguration.KustomizationDefinition{ - // "srs-kustomization1": &armkubernetesconfiguration.KustomizationDefinition{ - // Name: to.Ptr("srs-kustomization1"), - // Path: to.Ptr("./test/path"), - // DependsOn: []*string{ - // }, - // PostBuild: &armkubernetesconfiguration.PostBuildDefinition{ - // Substitute: map[string]*string{ - // "cluster_env": to.Ptr("prod"), - // "replica_count": to.Ptr("2"), - // }, - // SubstituteFrom: []*armkubernetesconfiguration.SubstituteFromDefinition{ - // { - // Name: to.Ptr("cluster-test"), - // Kind: to.Ptr("ConfigMap"), - // Optional: to.Ptr(true), - // }}, - // }, - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // Wait: to.Ptr(true), - // }, - // "srs-kustomization2": &armkubernetesconfiguration.KustomizationDefinition{ - // Name: to.Ptr("srs-kustomization2"), - // Path: to.Ptr("./other/test/path"), - // DependsOn: []*string{ - // to.Ptr("srs-kustomization1")}, - // PostBuild: &armkubernetesconfiguration.PostBuildDefinition{ - // SubstituteFrom: []*armkubernetesconfiguration.SubstituteFromDefinition{ - // { - // Name: to.Ptr("cluster-values"), - // Kind: to.Ptr("ConfigMap"), - // Optional: to.Ptr(true), - // }, - // { - // Name: to.Ptr("secret-name"), - // Kind: to.Ptr("Secret"), - // Optional: to.Ptr(false), - // }}, - // }, - // Prune: to.Ptr(false), - // RetryIntervalInSeconds: to.Ptr[int64](600), - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // Wait: to.Ptr(false), - // }, - // }, - // Namespace: to.Ptr("srs-namespace"), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // RepositoryPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiNkrANrhtRy+02Xc7b5bwvgOKvQMbqUQaXeB6FCDkbLaavw/zO/vIhIBEQu+vbBt6IlI/Pui0rMFr5JjA8Vwwd85oabzU07TPzbFvKSU9eCXqWRKWf0DHNQj/kxPJNtyPYFv3lGoiZZ6QzejOxlW/lPPokUePN0oI10daWwqznm2q0Cmh1EgPUYveq3J5KCWncZXCdwY36zWYulCWFaqazoaGy4kxcqlVy+mPjE/UJthaoLm3mq+23uhlmmfCc1j7W6+H6fcOwTyOtcbimxz2Ug8HlTzSTXBPtEe7qyllMyk62EPNUUq4bVoVsex9sKBK6/hW0Cn2P5i5jslUPCQF"), - // Scope: to.Ptr(armkubernetesconfiguration.ScopeTypeCluster), - // SourceKind: to.Ptr(armkubernetesconfiguration.SourceKindTypeGitRepository), - // SourceSyncedCommitID: to.Ptr("master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590"), - // SourceUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:17:12.000Z"); return t}()), - // StatusUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:17:12.000Z"); return t}()), - // Statuses: []*armkubernetesconfiguration.ObjectStatusDefinition{ - // { - // Name: to.Ptr("srs-fluxconfig"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // Kind: to.Ptr("GitRepository"), - // StatusConditions: []*armkubernetesconfiguration.ObjectStatusConditionDefinition{ - // { - // Type: to.Ptr("Ready"), - // LastTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:12:40.000Z"); return t}()), - // Message: to.Ptr("'Fetched revision: master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590'"), - // Reason: to.Ptr("GitOperationSucceed"), - // Status: to.Ptr("True"), - // }}, - // }, - // { - // Name: to.Ptr("srs-fluxconfig-srs-kustomization1"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // HelmReleaseProperties: &armkubernetesconfiguration.HelmReleasePropertiesDefinition{ - // HelmChartRef: &armkubernetesconfiguration.ObjectReferenceDefinition{ - // Name: to.Ptr("myname"), - // Namespace: to.Ptr("mynamespace"), - // }, - // LastRevisionApplied: to.Ptr[int64](1), - // }, - // Kind: to.Ptr("Kustomization"), - // StatusConditions: []*armkubernetesconfiguration.ObjectStatusConditionDefinition{ - // { - // Type: to.Ptr("Ready"), - // LastTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:12:40.000Z"); return t}()), - // Message: to.Ptr("'Applied revision: master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590'"), - // Reason: to.Ptr("ReconciliationSucceeded"), - // Status: to.Ptr("True"), - // }}, - // }, - // { - // Name: to.Ptr("srs-fluxconfig-srs-kustomization2"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // HelmReleaseProperties: &armkubernetesconfiguration.HelmReleasePropertiesDefinition{ - // HelmChartRef: &armkubernetesconfiguration.ObjectReferenceDefinition{ - // Name: to.Ptr("myname"), - // Namespace: to.Ptr("mynamespace"), - // }, - // LastRevisionApplied: to.Ptr[int64](1), - // }, - // Kind: to.Ptr("Kustomization"), - // StatusConditions: []*armkubernetesconfiguration.ObjectStatusConditionDefinition{ - // { - // Type: to.Ptr("Ready"), - // LastTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:12:40.000Z"); return t}()), - // Message: to.Ptr("'Applied revision: master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590'"), - // Reason: to.Ptr("ReconciliationSucceeded"), - // Status: to.Ptr("True"), - // }}, - // }}, - // Suspend: to.Ptr(false), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-19T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateFluxConfigurationWithBucket.json -func ExampleFluxConfigurationsClient_BeginCreateOrUpdate_createFluxConfigurationWithBucketSourceKind() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFluxConfigurationsClient().BeginCreateOrUpdate(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "srs-fluxconfig", armkubernetesconfiguration.FluxConfiguration{ - Properties: &armkubernetesconfiguration.FluxConfigurationProperties{ - Bucket: &armkubernetesconfiguration.BucketDefinition{ - AccessKey: to.Ptr("fluxminiotest"), - BucketName: to.Ptr("flux"), - SyncIntervalInSeconds: to.Ptr[int64](1000), - TimeoutInSeconds: to.Ptr[int64](1000), - URL: to.Ptr("https://fluxminiotest.az.minio.io"), - }, - Kustomizations: map[string]*armkubernetesconfiguration.KustomizationDefinition{ - "srs-kustomization1": { - Path: to.Ptr("./test/path"), - DependsOn: []*string{}, - SyncIntervalInSeconds: to.Ptr[int64](600), - TimeoutInSeconds: to.Ptr[int64](600), - }, - "srs-kustomization2": { - Path: to.Ptr("./other/test/path"), - DependsOn: []*string{ - to.Ptr("srs-kustomization1")}, - Prune: to.Ptr(false), - RetryIntervalInSeconds: to.Ptr[int64](600), - SyncIntervalInSeconds: to.Ptr[int64](600), - TimeoutInSeconds: to.Ptr[int64](600), - }, - }, - Namespace: to.Ptr("srs-namespace"), - Scope: to.Ptr(armkubernetesconfiguration.ScopeTypeCluster), - SourceKind: to.Ptr(armkubernetesconfiguration.SourceKindTypeBucket), - Suspend: to.Ptr(false), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FluxConfiguration = armkubernetesconfiguration.FluxConfiguration{ - // Name: to.Ptr("srs-fluxconfig"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/fluxConfigurations"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/srs-fluxconfig"), - // Properties: &armkubernetesconfiguration.FluxConfigurationProperties{ - // Bucket: &armkubernetesconfiguration.BucketDefinition{ - // AccessKey: to.Ptr("fluxminiotest"), - // BucketName: to.Ptr("flux"), - // SyncIntervalInSeconds: to.Ptr[int64](1000), - // TimeoutInSeconds: to.Ptr[int64](1000), - // URL: to.Ptr("https://fluxminiotest.az.minio.io"), - // }, - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // ErrorMessage: to.Ptr(""), - // Kustomizations: map[string]*armkubernetesconfiguration.KustomizationDefinition{ - // "srs-kustomization1": &armkubernetesconfiguration.KustomizationDefinition{ - // Name: to.Ptr("srs-kustomization1"), - // Path: to.Ptr("./test/path"), - // DependsOn: []*string{ - // }, - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // }, - // "srs-kustomization2": &armkubernetesconfiguration.KustomizationDefinition{ - // Name: to.Ptr("srs-kustomization2"), - // Path: to.Ptr("./other/test/path"), - // DependsOn: []*string{ - // to.Ptr("srs-kustomization1")}, - // Prune: to.Ptr(false), - // RetryIntervalInSeconds: to.Ptr[int64](600), - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // }, - // }, - // Namespace: to.Ptr("srs-namespace"), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // RepositoryPublicKey: to.Ptr(""), - // Scope: to.Ptr(armkubernetesconfiguration.ScopeTypeCluster), - // SourceKind: to.Ptr(armkubernetesconfiguration.SourceKindTypeBucket), - // SourceSyncedCommitID: to.Ptr("0ba6f0d30760d567de0bac86c8c4eec13ce1a590"), - // SourceUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:17:12.000Z"); return t}()), - // StatusUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:17:12.000Z"); return t}()), - // Statuses: []*armkubernetesconfiguration.ObjectStatusDefinition{ - // { - // Name: to.Ptr("srs-fluxconfig"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // Kind: to.Ptr("Bucket"), - // StatusConditions: []*armkubernetesconfiguration.ObjectStatusConditionDefinition{ - // { - // Type: to.Ptr("Ready"), - // LastTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-05-04T07:17:30.000Z"); return t}()), - // Message: to.Ptr("stored artifact for revision '55396be14f18fa2b977c1f22becef26a94d1d9a7ccb1e19d12f9cac52d757a84'"), - // Reason: to.Ptr("Succeeded"), - // Status: to.Ptr("True"), - // }}, - // }, - // { - // Name: to.Ptr("srs-fluxconfig-srs-kustomization1"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // HelmReleaseProperties: &armkubernetesconfiguration.HelmReleasePropertiesDefinition{ - // HelmChartRef: &armkubernetesconfiguration.ObjectReferenceDefinition{ - // Name: to.Ptr("myname"), - // Namespace: to.Ptr("mynamespace"), - // }, - // LastRevisionApplied: to.Ptr[int64](1), - // }, - // Kind: to.Ptr("Kustomization"), - // StatusConditions: []*armkubernetesconfiguration.ObjectStatusConditionDefinition{ - // { - // Type: to.Ptr("Ready"), - // LastTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:12:40.000Z"); return t}()), - // Message: to.Ptr("'Applied revision: 0ba6f0d30760d567de0bac86c8c4eec13ce1a590'"), - // Reason: to.Ptr("ReconciliationSucceeded"), - // Status: to.Ptr("True"), - // }}, - // }, - // { - // Name: to.Ptr("srs-fluxconfig-srs-kustomization2"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // HelmReleaseProperties: &armkubernetesconfiguration.HelmReleasePropertiesDefinition{ - // HelmChartRef: &armkubernetesconfiguration.ObjectReferenceDefinition{ - // Name: to.Ptr("myname"), - // Namespace: to.Ptr("mynamespace"), - // }, - // LastRevisionApplied: to.Ptr[int64](1), - // }, - // Kind: to.Ptr("Kustomization"), - // StatusConditions: []*armkubernetesconfiguration.ObjectStatusConditionDefinition{ - // { - // Type: to.Ptr("Ready"), - // LastTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:12:40.000Z"); return t}()), - // Message: to.Ptr("'Applied revision: 0ba6f0d30760d567de0bac86c8c4eec13ce1a590'"), - // Reason: to.Ptr("ReconciliationSucceeded"), - // Status: to.Ptr("True"), - // }}, - // }}, - // Suspend: to.Ptr(false), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-19T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/PatchFluxConfiguration.json -func ExampleFluxConfigurationsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFluxConfigurationsClient().BeginUpdate(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "srs-fluxconfig", armkubernetesconfiguration.FluxConfigurationPatch{ - Properties: &armkubernetesconfiguration.FluxConfigurationPatchProperties{ - GitRepository: &armkubernetesconfiguration.GitRepositoryPatchDefinition{ - URL: to.Ptr("https://github.com/jonathan-innis/flux2-kustomize-helm-example.git"), - }, - Kustomizations: map[string]*armkubernetesconfiguration.KustomizationPatchDefinition{ - "srs-kustomization1": nil, - "srs-kustomization2": { - Path: to.Ptr("./test/alt-path"), - SyncIntervalInSeconds: to.Ptr[int64](300), - }, - "srs-kustomization3": { - Path: to.Ptr("./test/another-path"), - SyncIntervalInSeconds: to.Ptr[int64](300), - }, - }, - Suspend: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FluxConfiguration = armkubernetesconfiguration.FluxConfiguration{ - // Properties: &armkubernetesconfiguration.FluxConfigurationProperties{ - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // ErrorMessage: to.Ptr(""), - // GitRepository: &armkubernetesconfiguration.GitRepositoryDefinition{ - // RepositoryRef: &armkubernetesconfiguration.RepositoryRefDefinition{ - // Branch: to.Ptr("master"), - // }, - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // URL: to.Ptr("https://github.com/jonathan-innis/flux2-kustomize-helm-example.git"), - // }, - // Kustomizations: map[string]*armkubernetesconfiguration.KustomizationDefinition{ - // "srs-kustomization2": &armkubernetesconfiguration.KustomizationDefinition{ - // Path: to.Ptr("./test/alt-path"), - // Prune: to.Ptr(false), - // RetryIntervalInSeconds: to.Ptr[int64](600), - // SyncIntervalInSeconds: to.Ptr[int64](300), - // TimeoutInSeconds: to.Ptr[int64](600), - // }, - // "srs-kustomization3": &armkubernetesconfiguration.KustomizationDefinition{ - // Path: to.Ptr("./test/another-path"), - // Prune: to.Ptr(false), - // SyncIntervalInSeconds: to.Ptr[int64](300), - // TimeoutInSeconds: to.Ptr[int64](600), - // }, - // }, - // Namespace: to.Ptr("srs-namespace"), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // RepositoryPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiNkrANrhtRy+02Xc7b5bwvgOKvQMbqUQaXeB6FCDkbLaavw/zO/vIhIBEQu+vbBt6IlI/Pui0rMFr5JjA8Vwwd85oabzU07TPzbFvKSU9eCXqWRKWf0DHNQj/kxPJNtyPYFv3lGoiZZ6QzejOxlW/lPPokUePN0oI10daWwqznm2q0Cmh1EgPUYveq3J5KCWncZXCdwY36zWYulCWFaqazoaGy4kxcqlVy+mPjE/UJthaoLm3mq+23uhlmmfCc1j7W6+H6fcOwTyOtcbimxz2Ug8HlTzSTXBPtEe7qyllMyk62EPNUUq4bVoVsex9sKBK6/hW0Cn2P5i5jslUPCQF"), - // Scope: to.Ptr(armkubernetesconfiguration.ScopeTypeCluster), - // SourceKind: to.Ptr(armkubernetesconfiguration.SourceKindTypeGitRepository), - // SourceSyncedCommitID: to.Ptr("master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590"), - // SourceUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:17:12.000Z"); return t}()), - // StatusUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:17:12.000Z"); return t}()), - // Statuses: []*armkubernetesconfiguration.ObjectStatusDefinition{ - // { - // Name: to.Ptr("srs-fluxconfig"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // Kind: to.Ptr("GitRepository"), - // StatusConditions: []*armkubernetesconfiguration.ObjectStatusConditionDefinition{ - // { - // Type: to.Ptr("Ready"), - // LastTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:12:40.000Z"); return t}()), - // Message: to.Ptr("'Fetched revision: master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590'"), - // Reason: to.Ptr("GitOperationSucceed"), - // Status: to.Ptr("True"), - // }}, - // }, - // { - // Name: to.Ptr("srs-fluxconfig-srs-kustomization1"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // HelmReleaseProperties: &armkubernetesconfiguration.HelmReleasePropertiesDefinition{ - // HelmChartRef: &armkubernetesconfiguration.ObjectReferenceDefinition{ - // Name: to.Ptr("myname"), - // Namespace: to.Ptr("mynamespace"), - // }, - // LastRevisionApplied: to.Ptr[int64](1), - // }, - // Kind: to.Ptr("Kustomization"), - // StatusConditions: []*armkubernetesconfiguration.ObjectStatusConditionDefinition{ - // { - // Type: to.Ptr("Ready"), - // LastTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:12:40.000Z"); return t}()), - // Message: to.Ptr("'Applied revision: master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590'"), - // Reason: to.Ptr("ReconciliationSucceeded"), - // Status: to.Ptr("True"), - // }}, - // }, - // { - // Name: to.Ptr("srs-fluxconfig-srs-kustomization2"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // HelmReleaseProperties: &armkubernetesconfiguration.HelmReleasePropertiesDefinition{ - // HelmChartRef: &armkubernetesconfiguration.ObjectReferenceDefinition{ - // Name: to.Ptr("myname"), - // Namespace: to.Ptr("mynamespace"), - // }, - // LastRevisionApplied: to.Ptr[int64](1), - // }, - // Kind: to.Ptr("Kustomization"), - // StatusConditions: []*armkubernetesconfiguration.ObjectStatusConditionDefinition{ - // { - // Type: to.Ptr("Ready"), - // LastTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:12:40.000Z"); return t}()), - // Message: to.Ptr("'Applied revision: master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590'"), - // Reason: to.Ptr("ReconciliationSucceeded"), - // Status: to.Ptr("True"), - // }}, - // }}, - // Suspend: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/DeleteFluxConfiguration.json -func ExampleFluxConfigurationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFluxConfigurationsClient().BeginDelete(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "srs-fluxconfig", &armkubernetesconfiguration.FluxConfigurationsClientBeginDeleteOptions{ForceDelete: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/ListFluxConfigurations.json -func ExampleFluxConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFluxConfigurationsClient().NewListPager("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FluxConfigurationsList = armkubernetesconfiguration.FluxConfigurationsList{ - // Value: []*armkubernetesconfiguration.FluxConfiguration{ - // { - // Name: to.Ptr("srs-fluxconfig"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/fluxConfigurations"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/srs-fluxconfig"), - // Properties: &armkubernetesconfiguration.FluxConfigurationProperties{ - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // ErrorMessage: to.Ptr(""), - // GitRepository: &armkubernetesconfiguration.GitRepositoryDefinition{ - // RepositoryRef: &armkubernetesconfiguration.RepositoryRefDefinition{ - // Branch: to.Ptr("master"), - // }, - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // URL: to.Ptr("https://github.com/Azure/arc-k8s-demo"), - // }, - // Kustomizations: map[string]*armkubernetesconfiguration.KustomizationDefinition{ - // "srs-kustomization1": &armkubernetesconfiguration.KustomizationDefinition{ - // Name: to.Ptr("srs-kustomization1"), - // Path: to.Ptr("./test/path"), - // DependsOn: []*string{ - // }, - // PostBuild: &armkubernetesconfiguration.PostBuildDefinition{ - // Substitute: map[string]*string{ - // "cluster_env": to.Ptr("prod"), - // "replica_count": to.Ptr("2"), - // }, - // SubstituteFrom: []*armkubernetesconfiguration.SubstituteFromDefinition{ - // { - // Name: to.Ptr("cluster-test"), - // Kind: to.Ptr("ConfigMap"), - // Optional: to.Ptr(true), - // }}, - // }, - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // Wait: to.Ptr(true), - // }, - // "srs-kustomization2": &armkubernetesconfiguration.KustomizationDefinition{ - // Name: to.Ptr("srs-kustomization2"), - // Path: to.Ptr("./other/test/path"), - // DependsOn: []*string{ - // to.Ptr("srs-kustomization1")}, - // PostBuild: &armkubernetesconfiguration.PostBuildDefinition{ - // SubstituteFrom: []*armkubernetesconfiguration.SubstituteFromDefinition{ - // { - // Name: to.Ptr("cluster-values"), - // Kind: to.Ptr("ConfigMap"), - // Optional: to.Ptr(true), - // }, - // { - // Name: to.Ptr("secret-name"), - // Kind: to.Ptr("Secret"), - // Optional: to.Ptr(false), - // }}, - // }, - // Prune: to.Ptr(false), - // RetryIntervalInSeconds: to.Ptr[int64](600), - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // Wait: to.Ptr(false), - // }, - // }, - // Namespace: to.Ptr("srs-namespace"), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // RepositoryPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiNkrANrhtRy+02Xc7b5bwvgOKvQMbqUQaXeB6FCDkbLaavw/zO/vIhIBEQu+vbBt6IlI/Pui0rMFr5JjA8Vwwd85oabzU07TPzbFvKSU9eCXqWRKWf0DHNQj/kxPJNtyPYFv3lGoiZZ6QzejOxlW/lPPokUePN0oI10daWwqznm2q0Cmh1EgPUYveq3J5KCWncZXCdwY36zWYulCWFaqazoaGy4kxcqlVy+mPjE/UJthaoLm3mq+23uhlmmfCc1j7W6+H6fcOwTyOtcbimxz2Ug8HlTzSTXBPtEe7qyllMyk62EPNUUq4bVoVsex9sKBK6/hW0Cn2P5i5jslUPCQF"), - // Scope: to.Ptr(armkubernetesconfiguration.ScopeTypeCluster), - // SourceKind: to.Ptr(armkubernetesconfiguration.SourceKindTypeGitRepository), - // SourceSyncedCommitID: to.Ptr("master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590"), - // SourceUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:17:12.000Z"); return t}()), - // StatusUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:17:12.000Z"); return t}()), - // Statuses: []*armkubernetesconfiguration.ObjectStatusDefinition{ - // { - // Name: to.Ptr("srs-fluxconfig"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // Kind: to.Ptr("GitRepository"), - // }, - // { - // Name: to.Ptr("srs-fluxconfig-srs-kustomization1"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // Kind: to.Ptr("Kustomization"), - // }, - // { - // Name: to.Ptr("srs-fluxconfig-srs-kustomization2"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // Kind: to.Ptr("Kustomization"), - // }}, - // Suspend: to.Ptr(false), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-19T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // }, - // { - // Name: to.Ptr("srs-fluxconfig"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/fluxConfigurations"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/srs-fluxconfig"), - // Properties: &armkubernetesconfiguration.FluxConfigurationProperties{ - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // ErrorMessage: to.Ptr(""), - // GitRepository: &armkubernetesconfiguration.GitRepositoryDefinition{ - // RepositoryRef: &armkubernetesconfiguration.RepositoryRefDefinition{ - // Branch: to.Ptr("master"), - // }, - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // URL: to.Ptr("https://github.com/Azure/arc-k8s-demo"), - // }, - // Kustomizations: map[string]*armkubernetesconfiguration.KustomizationDefinition{ - // "srs-kustomization1": &armkubernetesconfiguration.KustomizationDefinition{ - // Name: to.Ptr("srs-kustomization1"), - // Path: to.Ptr("./test/path"), - // DependsOn: []*string{ - // }, - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // }, - // "srs-kustomization2": &armkubernetesconfiguration.KustomizationDefinition{ - // Name: to.Ptr("srs-kustomization2"), - // Path: to.Ptr("./other/test/path"), - // DependsOn: []*string{ - // to.Ptr("srs-kustomization1")}, - // Prune: to.Ptr(false), - // RetryIntervalInSeconds: to.Ptr[int64](600), - // SyncIntervalInSeconds: to.Ptr[int64](600), - // TimeoutInSeconds: to.Ptr[int64](600), - // }, - // }, - // Namespace: to.Ptr("srs-namespace"), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateSucceeded), - // RepositoryPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDiNkrANrhtRy+02Xc7b5bwvgOKvQMbqUQaXeB6FCDkbLaavw/zO/vIhIBEQu+vbBt6IlI/Pui0rMFr5JjA8Vwwd85oabzU07TPzbFvKSU9eCXqWRKWf0DHNQj/kxPJNtyPYFv3lGoiZZ6QzejOxlW/lPPokUePN0oI10daWwqznm2q0Cmh1EgPUYveq3J5KCWncZXCdwY36zWYulCWFaqazoaGy4kxcqlVy+mPjE/UJthaoLm3mq+23uhlmmfCc1j7W6+H6fcOwTyOtcbimxz2Ug8HlTzSTXBPtEe7qyllMyk62EPNUUq4bVoVsex9sKBK6/hW0Cn2P5i5jslUPCQF"), - // Scope: to.Ptr(armkubernetesconfiguration.ScopeTypeCluster), - // SourceKind: to.Ptr(armkubernetesconfiguration.SourceKindTypeGitRepository), - // SourceSyncedCommitID: to.Ptr("master/0ba6f0d30760d567de0bac86c8c4eec13ce1a590"), - // SourceUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:17:12.000Z"); return t}()), - // StatusUpdatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T18:17:12.000Z"); return t}()), - // Statuses: []*armkubernetesconfiguration.ObjectStatusDefinition{ - // { - // Name: to.Ptr("srs-fluxconfig"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // Kind: to.Ptr("GitRepository"), - // }, - // { - // Name: to.Ptr("srs-fluxconfig-srs-kustomization1"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // Kind: to.Ptr("Kustomization"), - // }, - // { - // Name: to.Ptr("srs-fluxconfig-srs-kustomization2"), - // ComplianceState: to.Ptr(armkubernetesconfiguration.FluxComplianceStateCompliant), - // Kind: to.Ptr("Kustomization"), - // }}, - // Suspend: to.Ptr(false), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-19T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-19T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/go.mod b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/go.mod index fb61091c079a..9500561600d5 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/go.mod +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/go.mod @@ -1,21 +1,11 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2 +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v3 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/go.sum b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/go.sum +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/models.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/models.go index 9aa96ca5d5fc..a3bc24120898 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/models.go +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/models.go @@ -327,6 +327,9 @@ type FluxConfigurationPatchProperties struct { // Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. Kustomizations map[string]*KustomizationPatchDefinition + // Parameters to reconcile to the OCIRepository source kind type. + OciRepository *OCIRepositoryPatchDefinition + // Source Kind to pull the configuration data from. SourceKind *SourceKindType @@ -355,6 +358,9 @@ type FluxConfigurationProperties struct { // period only. Namespace *string + // Parameters to reconcile to the OCIRepository source kind type. + OciRepository *OCIRepositoryDefinition + // Maximum duration to wait for flux configuration reconciliation. E.g PT1H, PT5M, P1D ReconciliationWaitDuration *string @@ -419,6 +425,9 @@ type GitRepositoryDefinition struct { // configuration secrets. LocalAuthRef *string + // Name of the provider used for authentication. + Provider *string + // The source reference for the GitRepository object. RepositoryRef *RepositoryRefDefinition @@ -447,6 +456,9 @@ type GitRepositoryPatchDefinition struct { // configuration secrets. LocalAuthRef *string + // Name of the provider used for authentication. + Provider *string + // The source reference for the GitRepository object. RepositoryRef *RepositoryRefDefinition @@ -550,7 +562,7 @@ type KustomizationPatchDefinition struct { Path *string // Used for variable substitution for this Kustomization after kustomize build. - PostBuild *PostBuildDefinition + PostBuild *PostBuildPatchDefinition // Enable/disable garbage collections of Kubernetes objects created by this Kustomization. Prune *bool @@ -568,6 +580,26 @@ type KustomizationPatchDefinition struct { Wait *bool } +// LayerSelectorDefinition - Parameters to specify which layer to pull from the OCI artifact. By default, the first layer +// in the artifact is pulled. +type LayerSelectorDefinition struct { + // The first layer matching the specified media type will be used. + MediaType *string + + // The operation to be performed on the selected layer. The default value is 'extract', but it can be set to 'copy'. + Operation *OperationType +} + +// LayerSelectorPatchDefinition - Parameters to specify which layer to pull from the OCI artifact. By default, the first layer +// in the artifact is pulled. +type LayerSelectorPatchDefinition struct { + // The first layer matching the specified media type will be used. + MediaType *string + + // The operation to be performed on the selected layer. The default value is 'extract', but it can be set to 'copy'. + Operation *OperationType +} + // ManagedIdentityDefinition - Parameters to authenticate using a Managed Identity. type ManagedIdentityDefinition struct { // The client Id for authenticating a Managed Identity. @@ -580,6 +612,123 @@ type ManagedIdentityPatchDefinition struct { ClientID *string } +// MatchOidcIdentityDefinition - MatchOIDCIdentity defines the criteria for matching the identity while verifying an OCI artifact. +type MatchOidcIdentityDefinition struct { + // The regex pattern to match against to verify the OIDC issuer. + Issuer *string + + // The regex pattern to match against to verify the identity subject. + Subject *string +} + +// MatchOidcIdentityPatchDefinition - MatchOIDCIdentity defines the criteria for matching the identity while verifying an +// OCI artifact. +type MatchOidcIdentityPatchDefinition struct { + // The regex pattern to match against to verify the OIDC issuer. + Issuer *string + + // The regex pattern to match against to verify the identity subject. + Subject *string +} + +// OCIRepositoryDefinition - Parameters to reconcile to the OCIRepository source kind type. +type OCIRepositoryDefinition struct { + // Specify whether to allow connecting to a non-TLS HTTP container registry. + Insecure *bool + + // The layer to be pulled from the OCI artifact. + LayerSelector *LayerSelectorDefinition + + // 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 + + // The source reference for the OCIRepository object. + RepositoryRef *OCIRepositoryRefDefinition + + // The service account name to authenticate with the OCI repository. + ServiceAccountName *string + + // The interval at which to re-reconcile the cluster OCI repository source with the remote. + SyncIntervalInSeconds *int64 + + // Parameters to authenticate using TLS config for OCI repository. + TLSConfig *TLSConfigDefinition + + // The maximum time to attempt to reconcile the cluster OCI repository source with the remote. + TimeoutInSeconds *int64 + + // The URL to sync for the flux configuration OCI repository. + URL *string + + // Specifies whether to use Workload Identity to authenticate with the OCI repository. + UseWorkloadIdentity *bool + + // Verification of the authenticity of an OCI Artifact. + Verify *VerifyDefinition +} + +// OCIRepositoryPatchDefinition - Parameters to reconcile to the OCIRepository source kind type. +type OCIRepositoryPatchDefinition struct { + // Specify whether to allow connecting to a non-TLS HTTP container registry. + Insecure *bool + + // The layer to be pulled from the OCI artifact. + LayerSelector *LayerSelectorPatchDefinition + + // 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 + + // The source reference for the OCIRepository object. + RepositoryRef *OCIRepositoryRefPatchDefinition + + // The service account name to authenticate with the OCI repository. + ServiceAccountName *string + + // The interval at which to re-reconcile the cluster OCI repository source with the remote. + SyncIntervalInSeconds *int64 + + // Parameters to authenticate using TLS config for OCI repository. + TLSConfig *TLSConfigPatchDefinition + + // The maximum time to attempt to reconcile the cluster OCI repository source with the remote. + TimeoutInSeconds *int64 + + // The URL to sync for the flux configuration OCI repository. + URL *string + + // Specifies whether to use Workload Identity to authenticate with the OCI repository. + UseWorkloadIdentity *bool + + // Verification of the authenticity of an OCI Artifact. + Verify *VerifyPatchDefinition +} + +// OCIRepositoryRefDefinition - The source reference for the OCIRepository object. +type OCIRepositoryRefDefinition struct { + // The image digest to pull from OCI repository, the value should be in the format ‘sha256:’. This takes precedence over semver. + Digest *string + + // The semver range used to match against OCI repository tags. This takes precedence over tag. + Semver *string + + // The OCI repository image tag name to pull. This defaults to 'latest'. + Tag *string +} + +// OCIRepositoryRefPatchDefinition - The source reference for the OCIRepository object. +type OCIRepositoryRefPatchDefinition struct { + // The image digest to pull from OCI repository, the value should be in the format ‘sha256:’. This takes precedence over semver. + Digest *string + + // The semver range used to match against OCI repository tags. This takes precedence over tag. + Semver *string + + // The OCI repository image tag name to pull. This defaults to 'latest'. + Tag *string +} + // ObjectReferenceDefinition - Object reference to a Kubernetes object on a cluster type ObjectReferenceDefinition struct { // Name of the object @@ -712,6 +861,16 @@ type PostBuildDefinition struct { SubstituteFrom []*SubstituteFromDefinition } +// PostBuildPatchDefinition - The postBuild definitions defining variable substitutions for this Kustomization after kustomize +// build. +type PostBuildPatchDefinition struct { + // Key/value pairs holding the variables to be substituted in this Kustomization. + Substitute map[string]*string + + // Array of ConfigMaps/Secrets from which the variables are substituted for this Kustomization. + SubstituteFrom []*SubstituteFromPatchDefinition +} + // ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a // location type ProxyResource struct { @@ -942,6 +1101,18 @@ type SubstituteFromDefinition struct { Optional *bool } +// SubstituteFromPatchDefinition - Array of ConfigMaps/Secrets from which the variables are substituted for this Kustomization. +type SubstituteFromPatchDefinition struct { + // Define whether it is ConfigMap or Secret that holds the variables to be used in substitution. + Kind *string + + // Name of the ConfigMap/Secret that holds the variables to be used in substitution. + Name *string + + // Set to True to proceed without ConfigMap/Secret, if it is not present. + Optional *bool +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -962,3 +1133,51 @@ type SystemData struct { // The type of identity that last modified the resource. LastModifiedByType *CreatedByType } + +// TLSConfigDefinition - Parameters to authenticate using TLS config for OCI repository. +type TLSConfigDefinition struct { + // Base64-encoded CA certificate used to verify the server. + CaCertificate *string + + // Base64-encoded certificate used to authenticate a client with the OCI repository. + ClientCertificate *string + + // Base64-encoded private key used to authenticate a client with the OCI repository. + PrivateKey *string +} + +// TLSConfigPatchDefinition - Parameters to authenticate using TLS config for OCI repository. +type TLSConfigPatchDefinition struct { + // Base64-encoded CA certificate used to verify the server. + CaCertificate *string + + // Base64-encoded certificate used to authenticate a client with the OCI repository. + ClientCertificate *string + + // Base64-encoded private key used to authenticate a client with the OCI repository. + PrivateKey *string +} + +// VerifyDefinition - Parameters to verify the authenticity of an OCI Artifact. +type VerifyDefinition struct { + // Array defining the criteria for matching the identity while verifying an OCI artifact. + MatchOidcIdentity []*MatchOidcIdentityDefinition + + // Verification provider name. + Provider *string + + // An object containing trusted public keys of trusted authors. + VerificationConfig map[string]*string +} + +// VerifyPatchDefinition - Parameters to verify the authenticity of an OCI Artifact. +type VerifyPatchDefinition struct { + // Array defining the criteria for matching the OIDC identity while verifying an OCI artifact. + MatchOidcIdentity []*MatchOidcIdentityPatchDefinition + + // Verification provider name. + Provider *string + + // An object containing trusted public keys of trusted authors. + VerificationConfig map[string]*string +} diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/models_serde.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/models_serde.go index 747ad142584d..7bd67ebcc41c 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/models_serde.go +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/models_serde.go @@ -696,6 +696,7 @@ func (f FluxConfigurationPatchProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "configurationProtectedSettings", f.ConfigurationProtectedSettings) populate(objectMap, "gitRepository", f.GitRepository) populate(objectMap, "kustomizations", f.Kustomizations) + populate(objectMap, "ociRepository", f.OciRepository) populate(objectMap, "sourceKind", f.SourceKind) populate(objectMap, "suspend", f.Suspend) return json.Marshal(objectMap) @@ -725,6 +726,9 @@ func (f *FluxConfigurationPatchProperties) UnmarshalJSON(data []byte) error { case "kustomizations": err = unpopulate(val, "Kustomizations", &f.Kustomizations) delete(rawMsg, key) + case "ociRepository": + err = unpopulate(val, "OciRepository", &f.OciRepository) + delete(rawMsg, key) case "sourceKind": err = unpopulate(val, "SourceKind", &f.SourceKind) delete(rawMsg, key) @@ -750,6 +754,7 @@ func (f FluxConfigurationProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "gitRepository", f.GitRepository) populate(objectMap, "kustomizations", f.Kustomizations) populate(objectMap, "namespace", f.Namespace) + populate(objectMap, "ociRepository", f.OciRepository) populate(objectMap, "provisioningState", f.ProvisioningState) populate(objectMap, "reconciliationWaitDuration", f.ReconciliationWaitDuration) populate(objectMap, "repositoryPublicKey", f.RepositoryPublicKey) @@ -797,6 +802,9 @@ func (f *FluxConfigurationProperties) UnmarshalJSON(data []byte) error { case "namespace": err = unpopulate(val, "Namespace", &f.Namespace) delete(rawMsg, key) + case "ociRepository": + err = unpopulate(val, "OciRepository", &f.OciRepository) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) delete(rawMsg, key) @@ -875,6 +883,7 @@ func (g GitRepositoryDefinition) MarshalJSON() ([]byte, error) { populate(objectMap, "httpsCACert", g.HTTPSCACert) populate(objectMap, "httpsUser", g.HTTPSUser) populate(objectMap, "localAuthRef", g.LocalAuthRef) + populate(objectMap, "provider", g.Provider) populate(objectMap, "repositoryRef", g.RepositoryRef) populate(objectMap, "sshKnownHosts", g.SSHKnownHosts) populate(objectMap, "syncIntervalInSeconds", g.SyncIntervalInSeconds) @@ -901,6 +910,9 @@ func (g *GitRepositoryDefinition) UnmarshalJSON(data []byte) error { case "localAuthRef": err = unpopulate(val, "LocalAuthRef", &g.LocalAuthRef) delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &g.Provider) + delete(rawMsg, key) case "repositoryRef": err = unpopulate(val, "RepositoryRef", &g.RepositoryRef) delete(rawMsg, key) @@ -930,6 +942,7 @@ func (g GitRepositoryPatchDefinition) MarshalJSON() ([]byte, error) { populate(objectMap, "httpsCACert", g.HTTPSCACert) populate(objectMap, "httpsUser", g.HTTPSUser) populate(objectMap, "localAuthRef", g.LocalAuthRef) + populate(objectMap, "provider", g.Provider) populate(objectMap, "repositoryRef", g.RepositoryRef) populate(objectMap, "sshKnownHosts", g.SSHKnownHosts) populate(objectMap, "syncIntervalInSeconds", g.SyncIntervalInSeconds) @@ -956,6 +969,9 @@ func (g *GitRepositoryPatchDefinition) UnmarshalJSON(data []byte) error { case "localAuthRef": err = unpopulate(val, "LocalAuthRef", &g.LocalAuthRef) delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &g.Provider) + delete(rawMsg, key) case "repositoryRef": err = unpopulate(val, "RepositoryRef", &g.RepositoryRef) delete(rawMsg, key) @@ -1210,6 +1226,68 @@ func (k *KustomizationPatchDefinition) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type LayerSelectorDefinition. +func (l LayerSelectorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "mediaType", l.MediaType) + populate(objectMap, "operation", l.Operation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LayerSelectorDefinition. +func (l *LayerSelectorDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "mediaType": + err = unpopulate(val, "MediaType", &l.MediaType) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &l.Operation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LayerSelectorPatchDefinition. +func (l LayerSelectorPatchDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "mediaType", l.MediaType) + populate(objectMap, "operation", l.Operation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LayerSelectorPatchDefinition. +func (l *LayerSelectorPatchDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "mediaType": + err = unpopulate(val, "MediaType", &l.MediaType) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &l.Operation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ManagedIdentityDefinition. func (m ManagedIdentityDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1264,6 +1342,272 @@ func (m *ManagedIdentityPatchDefinition) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MatchOidcIdentityDefinition. +func (m MatchOidcIdentityDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "issuer", m.Issuer) + populate(objectMap, "subject", m.Subject) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MatchOidcIdentityDefinition. +func (m *MatchOidcIdentityDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "issuer": + err = unpopulate(val, "Issuer", &m.Issuer) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &m.Subject) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MatchOidcIdentityPatchDefinition. +func (m MatchOidcIdentityPatchDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "issuer", m.Issuer) + populate(objectMap, "subject", m.Subject) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MatchOidcIdentityPatchDefinition. +func (m *MatchOidcIdentityPatchDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "issuer": + err = unpopulate(val, "Issuer", &m.Issuer) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &m.Subject) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OCIRepositoryDefinition. +func (o OCIRepositoryDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "insecure", o.Insecure) + populate(objectMap, "layerSelector", o.LayerSelector) + populate(objectMap, "localAuthRef", o.LocalAuthRef) + populate(objectMap, "repositoryRef", o.RepositoryRef) + populate(objectMap, "serviceAccountName", o.ServiceAccountName) + populate(objectMap, "syncIntervalInSeconds", o.SyncIntervalInSeconds) + populate(objectMap, "tlsConfig", o.TLSConfig) + populate(objectMap, "timeoutInSeconds", o.TimeoutInSeconds) + populate(objectMap, "url", o.URL) + populate(objectMap, "useWorkloadIdentity", o.UseWorkloadIdentity) + populate(objectMap, "verify", o.Verify) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OCIRepositoryDefinition. +func (o *OCIRepositoryDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "insecure": + err = unpopulate(val, "Insecure", &o.Insecure) + delete(rawMsg, key) + case "layerSelector": + err = unpopulate(val, "LayerSelector", &o.LayerSelector) + delete(rawMsg, key) + case "localAuthRef": + err = unpopulate(val, "LocalAuthRef", &o.LocalAuthRef) + delete(rawMsg, key) + case "repositoryRef": + err = unpopulate(val, "RepositoryRef", &o.RepositoryRef) + delete(rawMsg, key) + case "serviceAccountName": + err = unpopulate(val, "ServiceAccountName", &o.ServiceAccountName) + delete(rawMsg, key) + case "syncIntervalInSeconds": + err = unpopulate(val, "SyncIntervalInSeconds", &o.SyncIntervalInSeconds) + delete(rawMsg, key) + case "tlsConfig": + err = unpopulate(val, "TLSConfig", &o.TLSConfig) + delete(rawMsg, key) + case "timeoutInSeconds": + err = unpopulate(val, "TimeoutInSeconds", &o.TimeoutInSeconds) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &o.URL) + delete(rawMsg, key) + case "useWorkloadIdentity": + err = unpopulate(val, "UseWorkloadIdentity", &o.UseWorkloadIdentity) + delete(rawMsg, key) + case "verify": + err = unpopulate(val, "Verify", &o.Verify) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OCIRepositoryPatchDefinition. +func (o OCIRepositoryPatchDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "insecure", o.Insecure) + populate(objectMap, "layerSelector", o.LayerSelector) + populate(objectMap, "localAuthRef", o.LocalAuthRef) + populate(objectMap, "repositoryRef", o.RepositoryRef) + populate(objectMap, "serviceAccountName", o.ServiceAccountName) + populate(objectMap, "syncIntervalInSeconds", o.SyncIntervalInSeconds) + populate(objectMap, "tlsConfig", o.TLSConfig) + populate(objectMap, "timeoutInSeconds", o.TimeoutInSeconds) + populate(objectMap, "url", o.URL) + populate(objectMap, "useWorkloadIdentity", o.UseWorkloadIdentity) + populate(objectMap, "verify", o.Verify) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OCIRepositoryPatchDefinition. +func (o *OCIRepositoryPatchDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "insecure": + err = unpopulate(val, "Insecure", &o.Insecure) + delete(rawMsg, key) + case "layerSelector": + err = unpopulate(val, "LayerSelector", &o.LayerSelector) + delete(rawMsg, key) + case "localAuthRef": + err = unpopulate(val, "LocalAuthRef", &o.LocalAuthRef) + delete(rawMsg, key) + case "repositoryRef": + err = unpopulate(val, "RepositoryRef", &o.RepositoryRef) + delete(rawMsg, key) + case "serviceAccountName": + err = unpopulate(val, "ServiceAccountName", &o.ServiceAccountName) + delete(rawMsg, key) + case "syncIntervalInSeconds": + err = unpopulate(val, "SyncIntervalInSeconds", &o.SyncIntervalInSeconds) + delete(rawMsg, key) + case "tlsConfig": + err = unpopulate(val, "TLSConfig", &o.TLSConfig) + delete(rawMsg, key) + case "timeoutInSeconds": + err = unpopulate(val, "TimeoutInSeconds", &o.TimeoutInSeconds) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &o.URL) + delete(rawMsg, key) + case "useWorkloadIdentity": + err = unpopulate(val, "UseWorkloadIdentity", &o.UseWorkloadIdentity) + delete(rawMsg, key) + case "verify": + err = unpopulate(val, "Verify", &o.Verify) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OCIRepositoryRefDefinition. +func (o OCIRepositoryRefDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "digest", o.Digest) + populate(objectMap, "semver", o.Semver) + populate(objectMap, "tag", o.Tag) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OCIRepositoryRefDefinition. +func (o *OCIRepositoryRefDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "digest": + err = unpopulate(val, "Digest", &o.Digest) + delete(rawMsg, key) + case "semver": + err = unpopulate(val, "Semver", &o.Semver) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &o.Tag) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OCIRepositoryRefPatchDefinition. +func (o OCIRepositoryRefPatchDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "digest", o.Digest) + populate(objectMap, "semver", o.Semver) + populate(objectMap, "tag", o.Tag) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OCIRepositoryRefPatchDefinition. +func (o *OCIRepositoryRefPatchDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "digest": + err = unpopulate(val, "Digest", &o.Digest) + delete(rawMsg, key) + case "semver": + err = unpopulate(val, "Semver", &o.Semver) + delete(rawMsg, key) + case "tag": + err = unpopulate(val, "Tag", &o.Tag) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ObjectReferenceDefinition. func (o ObjectReferenceDefinition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1607,6 +1951,37 @@ func (p *PostBuildDefinition) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PostBuildPatchDefinition. +func (p PostBuildPatchDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "substitute", p.Substitute) + populate(objectMap, "substituteFrom", p.SubstituteFrom) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PostBuildPatchDefinition. +func (p *PostBuildPatchDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "substitute": + err = unpopulate(val, "Substitute", &p.Substitute) + delete(rawMsg, key) + case "substituteFrom": + err = unpopulate(val, "SubstituteFrom", &p.SubstituteFrom) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ProxyResource. func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2188,6 +2563,41 @@ func (s *SubstituteFromDefinition) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SubstituteFromPatchDefinition. +func (s SubstituteFromPatchDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "name", s.Name) + populate(objectMap, "optional", s.Optional) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubstituteFromPatchDefinition. +func (s *SubstituteFromPatchDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "optional": + err = unpopulate(val, "Optional", &s.Optional) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2235,6 +2645,146 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TLSConfigDefinition. +func (t TLSConfigDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "caCertificate", t.CaCertificate) + populate(objectMap, "clientCertificate", t.ClientCertificate) + populate(objectMap, "privateKey", t.PrivateKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TLSConfigDefinition. +func (t *TLSConfigDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caCertificate": + err = unpopulate(val, "CaCertificate", &t.CaCertificate) + delete(rawMsg, key) + case "clientCertificate": + err = unpopulate(val, "ClientCertificate", &t.ClientCertificate) + delete(rawMsg, key) + case "privateKey": + err = unpopulate(val, "PrivateKey", &t.PrivateKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TLSConfigPatchDefinition. +func (t TLSConfigPatchDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "caCertificate", t.CaCertificate) + populate(objectMap, "clientCertificate", t.ClientCertificate) + populate(objectMap, "privateKey", t.PrivateKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TLSConfigPatchDefinition. +func (t *TLSConfigPatchDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "caCertificate": + err = unpopulate(val, "CaCertificate", &t.CaCertificate) + delete(rawMsg, key) + case "clientCertificate": + err = unpopulate(val, "ClientCertificate", &t.ClientCertificate) + delete(rawMsg, key) + case "privateKey": + err = unpopulate(val, "PrivateKey", &t.PrivateKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VerifyDefinition. +func (v VerifyDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "matchOidcIdentity", v.MatchOidcIdentity) + populate(objectMap, "provider", v.Provider) + populate(objectMap, "verificationConfig", v.VerificationConfig) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VerifyDefinition. +func (v *VerifyDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "matchOidcIdentity": + err = unpopulate(val, "MatchOidcIdentity", &v.MatchOidcIdentity) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &v.Provider) + delete(rawMsg, key) + case "verificationConfig": + err = unpopulate(val, "VerificationConfig", &v.VerificationConfig) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VerifyPatchDefinition. +func (v VerifyPatchDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "matchOidcIdentity", v.MatchOidcIdentity) + populate(objectMap, "provider", v.Provider) + populate(objectMap, "verificationConfig", v.VerificationConfig) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VerifyPatchDefinition. +func (v *VerifyPatchDefinition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "matchOidcIdentity": + err = unpopulate(val, "MatchOidcIdentity", &v.MatchOidcIdentity) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &v.Provider) + delete(rawMsg, key) + case "verificationConfig": + err = unpopulate(val, "VerificationConfig", &v.VerificationConfig) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return @@ -2256,7 +2806,7 @@ func populateAny(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/operations_client_example_test.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/operations_client_example_test.go deleted file mode 100644 index 1375956591f3..000000000000 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/operations_client_example_test.go +++ /dev/null @@ -1,189 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armkubernetesconfiguration_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/OperationsList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceProviderOperationList = armkubernetesconfiguration.ResourceProviderOperationList{ - // Value: []*armkubernetesconfiguration.ResourceProviderOperation{ - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations/write"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Creates or updates source control configuration."), - // Operation: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations/write"), - // Provider: to.Ptr("Microsoft Kubernetes Configuration"), - // Resource: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations/read"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Gets source control configuration."), - // Operation: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations/read"), - // Provider: to.Ptr("Microsoft Kubernetes Configuration"), - // Resource: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations/delete"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Deletes source control configuration."), - // Operation: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations/delete"), - // Provider: to.Ptr("Microsoft Kubernetes Configuration"), - // Resource: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/extensions/read"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Get the specified Extension."), - // Operation: to.Ptr("Get extension"), - // Provider: to.Ptr("Microsoft KubernetesConfiguration"), - // Resource: to.Ptr("extensions"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/extensions/write"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Create the Extension specified."), - // Operation: to.Ptr("Create a Extension"), - // Provider: to.Ptr("Microsoft KubernetesConfiguration"), - // Resource: to.Ptr("extensions"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/extensions/delete"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Delete the specified Extension."), - // Operation: to.Ptr("Delete Extension"), - // Provider: to.Ptr("Microsoft KubernetesConfiguration"), - // Resource: to.Ptr("extensions"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/extensions/operations/read"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Get the Status of the Extension Async Operation."), - // Operation: to.Ptr("Get Extension Async Operation Status"), - // Provider: to.Ptr("Microsoft KubernetesConfiguration"), - // Resource: to.Ptr("extensions"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/fluxConfigurations/read"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Get the specified Flux Configuration."), - // Operation: to.Ptr("Get fluxConfiguration"), - // Provider: to.Ptr("Microsoft KubernetesConfiguration"), - // Resource: to.Ptr("fluxConfigurations"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/fluxConfigurations/write"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Create the Flux Configuration specified."), - // Operation: to.Ptr("Create a fluxConfiguration"), - // Provider: to.Ptr("Microsoft KubernetesConfiguration"), - // Resource: to.Ptr("fluxConfigurations"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/fluxConfigurations/delete"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Delete the specified Flux Configuration."), - // Operation: to.Ptr("Delete Flux Configuration"), - // Provider: to.Ptr("Microsoft KubernetesConfiguration"), - // Resource: to.Ptr("fluxConfigurations"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/fluxConfigurations/operations/read"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Get the Status of the Flux Configuration Async Operation."), - // Operation: to.Ptr("Get Flux Configuration Async Operation Status"), - // Provider: to.Ptr("Microsoft KubernetesConfiguration"), - // Resource: to.Ptr("fluxConfigurations"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/register/action"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Registers subscription to Microsoft.KubernetesConfiguration resource provider."), - // Operation: to.Ptr("Microsoft.KubernetesConfiguration/register/action"), - // Provider: to.Ptr("Microsoft Kubernetes Configuration"), - // Resource: to.Ptr("Register"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }, - // { - // Name: to.Ptr("Microsoft.KubernetesConfiguration/extensionTypes/read"), - // Display: &armkubernetesconfiguration.ResourceProviderOperationDisplay{ - // Description: to.Ptr("Get Kubernetes Configuration Available Extensions"), - // Operation: to.Ptr("Microsoft.KubernetesConfiguration/extensionTypes/read"), - // Provider: to.Ptr("Microsoft KubernetesConfiguration"), - // Resource: to.Ptr("extensionTypes"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr("user,system"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/operationstatus_client_example_test.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/operationstatus_client_example_test.go deleted file mode 100644 index 375d21d1b773..000000000000 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/operationstatus_client_example_test.go +++ /dev/null @@ -1,87 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armkubernetesconfiguration_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetExtensionAsyncOperationStatus.json -func ExampleOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationStatusClient().Get(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", "99999999-9999-9999-9999-999999999999", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatusResult = armkubernetesconfiguration.OperationStatusResult{ - // Name: to.Ptr("99999999-9999-9999-9999-999999999999"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/extensions/ClusterMonitor/operations/99999999-9999-9999-9999-999999999999"), - // Properties: map[string]*string{ - // }, - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/ListAsyncOperationStatus.json -func ExampleOperationStatusClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationStatusClient().NewListPager("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationStatusList = armkubernetesconfiguration.OperationStatusList{ - // Value: []*armkubernetesconfiguration.OperationStatusResult{ - // { - // Name: to.Ptr("99999999-9999-9999-9999-999999999999"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/extensions/ClusterMonitor/operations/99999999-9999-9999-9999-999999999999"), - // Properties: map[string]*string{ - // }, - // Status: to.Ptr("Deleting"), - // }, - // { - // Name: to.Ptr("88888888-8888-8888-8888-888888888888"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/extensions/cassandraExtension1/operations/88888888-8888-8888-8888-888888888888"), - // Properties: map[string]*string{ - // }, - // Status: to.Ptr("Creating"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/response_types.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/responses.go similarity index 100% rename from sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/response_types.go rename to sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/responses.go diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/sourcecontrolconfigurations_client_example_test.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/sourcecontrolconfigurations_client_example_test.go deleted file mode 100644 index 8414624730d4..000000000000 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/sourcecontrolconfigurations_client_example_test.go +++ /dev/null @@ -1,245 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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. -// DO NOT EDIT. - -package armkubernetesconfiguration_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/GetSourceControlConfiguration.json -func ExampleSourceControlConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSourceControlConfigurationsClient().Get(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "SRS_GitHubConfig", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SourceControlConfiguration = armkubernetesconfiguration.SourceControlConfiguration{ - // Name: to.Ptr("SRS_GitHubConfig"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/SRS_GitHubConfig"), - // Properties: &armkubernetesconfiguration.SourceControlConfigurationProperties{ - // ComplianceStatus: &armkubernetesconfiguration.ComplianceStatus{ - // ComplianceState: to.Ptr(armkubernetesconfiguration.ComplianceStateTypePending), - // LastConfigApplied: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-08T05:25:32.122Z"); return t}()), - // Message: to.Ptr("Configuration successfully created"), - // MessageLevel: to.Ptr(armkubernetesconfiguration.MessageLevelType("Info")), - // }, - // HelmOperatorProperties: &armkubernetesconfiguration.HelmOperatorProperties{ - // ChartValues: to.Ptr("--set git.ssh.secretName=flux-git-deploy --set tillerNamespace=kube-system"), - // ChartVersion: to.Ptr("0.3.0"), - // }, - // OperatorInstanceName: to.Ptr("SRSGitHubFluxOp-01"), - // OperatorNamespace: to.Ptr("SRS_Namespace"), - // OperatorParams: to.Ptr("--git-email=xyzgituser@users.srs.github.com"), - // OperatorScope: to.Ptr(armkubernetesconfiguration.OperatorScopeTypeNamespace), - // OperatorType: to.Ptr(armkubernetesconfiguration.OperatorTypeFlux), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateTypeSucceeded), - // RepositoryPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAqvTzeL+BWgcHnC1CTBRMg2ZfCh9khlrvb2avFHiGG24rRvjLHlKqtfiiw+cZNCKskUyVKqamD2RHrhyn/wXvJ9fFRt0LhYLKn4hJhJaPx4IawdWnW1MUv4U+Mr8o3Cxps4EmiZemqri3fOrhzEIlPL272whKpzlDLV7L4W1XQIGmVPwQ93HTzKEd5uHuEuw6JyFftDDLlCnd3Q1kQ7HOabFEfcSSr9cMx2MU4j/Pjuf3Rd/CzeksvKtU009KSXSnWKm8LL1fihSc1H1WDTi8iuZtT63hsNYH1yxrPRpMVScs3ufLViAGO9NEHQSgDdl/OERQQqKisUn2Qm6adgmftw== rsa-key-20190909"), - // RepositoryURL: to.Ptr("git@github.com:k8sdeveloper425/flux-get-started"), - // SSHKnownHostsContents: to.Ptr("c3NoLmRldi5henVyZS5jb20gc3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFCQVFDN0hyMW9UV3FOcU9sekdKT2ZHSjROYWtWeUl6ZjFyWFlkNGQ3d282akJsa0x2Q0E0b2RCbEwwbURVeVowL1FVZlRUcWV1K3RtMjJnT3N2K1ZyVlRNazZ2d1JVNzVnWS95OXV0NU1iM2JSNUJWNThkS1h5cTlBOVVlQjVDYWtlaG41WmdtNngxbUtvVnlmK0ZGbjI2aVlxWEpSZ3pJWlpjWjVWNmhyRTBRZzM5a1ptNGF6NDhvMEFVYmY2U3A0U0xkdm51TWEyc1ZOd0hCYm9TN0VKa201N1hRUFZVMy9RcHlOTEhiV0Rkend0cmxTK2V6MzBTM0FkWWhMS0VPeEFHOHdlT255cnRMSkFVZW45bVRrb2w4b0lJMWVkZjdtV1diV1ZmMG5CbWx5MjErblpjbUNUSVNRQnRkY3lQYUVubzdmRlFNREQyNi9zMGxmS29iNEt3OEg="), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-08T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-08T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/CreateSourceControlConfiguration.json -func ExampleSourceControlConfigurationsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSourceControlConfigurationsClient().CreateOrUpdate(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "SRS_GitHubConfig", armkubernetesconfiguration.SourceControlConfiguration{ - Properties: &armkubernetesconfiguration.SourceControlConfigurationProperties{ - ConfigurationProtectedSettings: map[string]*string{ - "protectedSetting1Key": to.Ptr("protectedSetting1Value"), - }, - EnableHelmOperator: to.Ptr(true), - HelmOperatorProperties: &armkubernetesconfiguration.HelmOperatorProperties{ - ChartValues: to.Ptr("--set git.ssh.secretName=flux-git-deploy --set tillerNamespace=kube-system"), - ChartVersion: to.Ptr("0.3.0"), - }, - OperatorInstanceName: to.Ptr("SRSGitHubFluxOp-01"), - OperatorNamespace: to.Ptr("SRS_Namespace"), - OperatorParams: to.Ptr("--git-email=xyzgituser@users.srs.github.com"), - OperatorScope: to.Ptr(armkubernetesconfiguration.OperatorScopeTypeNamespace), - OperatorType: to.Ptr(armkubernetesconfiguration.OperatorTypeFlux), - RepositoryURL: to.Ptr("git@github.com:k8sdeveloper425/flux-get-started"), - SSHKnownHostsContents: to.Ptr("c3NoLmRldi5henVyZS5jb20gc3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFCQVFDN0hyMW9UV3FOcU9sekdKT2ZHSjROYWtWeUl6ZjFyWFlkNGQ3d282akJsa0x2Q0E0b2RCbEwwbURVeVowL1FVZlRUcWV1K3RtMjJnT3N2K1ZyVlRNazZ2d1JVNzVnWS95OXV0NU1iM2JSNUJWNThkS1h5cTlBOVVlQjVDYWtlaG41WmdtNngxbUtvVnlmK0ZGbjI2aVlxWEpSZ3pJWlpjWjVWNmhyRTBRZzM5a1ptNGF6NDhvMEFVYmY2U3A0U0xkdm51TWEyc1ZOd0hCYm9TN0VKa201N1hRUFZVMy9RcHlOTEhiV0Rkend0cmxTK2V6MzBTM0FkWWhMS0VPeEFHOHdlT255cnRMSkFVZW45bVRrb2w4b0lJMWVkZjdtV1diV1ZmMG5CbWx5MjErblpjbUNUSVNRQnRkY3lQYUVubzdmRlFNREQyNi9zMGxmS29iNEt3OEg="), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SourceControlConfiguration = armkubernetesconfiguration.SourceControlConfiguration{ - // Name: to.Ptr("SRS_GitHubConfig"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/SRS_GitHubConfig"), - // Properties: &armkubernetesconfiguration.SourceControlConfigurationProperties{ - // ComplianceStatus: &armkubernetesconfiguration.ComplianceStatus{ - // ComplianceState: to.Ptr(armkubernetesconfiguration.ComplianceStateTypePending), - // LastConfigApplied: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-08T05:25:32.122Z"); return t}()), - // Message: to.Ptr("Configuration successfully created"), - // MessageLevel: to.Ptr(armkubernetesconfiguration.MessageLevelType("Info")), - // }, - // EnableHelmOperator: to.Ptr(true), - // HelmOperatorProperties: &armkubernetesconfiguration.HelmOperatorProperties{ - // ChartValues: to.Ptr("--set git.ssh.secretName=flux-git-deploy --set tillerNamespace=kube-system"), - // ChartVersion: to.Ptr("0.3.0"), - // }, - // OperatorInstanceName: to.Ptr("SRSGitHubFluxOp-01"), - // OperatorNamespace: to.Ptr("SRS_Namespace"), - // OperatorParams: to.Ptr("--git-email=xyzgituser@users.srs.github.com"), - // OperatorScope: to.Ptr(armkubernetesconfiguration.OperatorScopeTypeNamespace), - // OperatorType: to.Ptr(armkubernetesconfiguration.OperatorTypeFlux), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateTypeSucceeded), - // RepositoryPublicKey: to.Ptr("ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAqvTzeL+BWgcHnC1CTBRMg2ZfCh9khlrvb2avFHiGG24rRvjLHlKqtfiiw+cZNCKskUyVKqamD2RHrhyn/wXvJ9fFRt0LhYLKn4hJhJaPx4IawdWnW1MUv4U+Mr8o3Cxps4EmiZemqri3fOrhzEIlPL272whKpzlDLV7L4W1XQIGmVPwQ93HTzKEd5uHuEuw6JyFftDDLlCnd3Q1kQ7HOabFEfcSSr9cMx2MU4j/Pjuf3Rd/CzeksvKtU009KSXSnWKm8LL1fihSc1H1WDTi8iuZtT63hsNYH1yxrPRpMVScs3ufLViAGO9NEHQSgDdl/OERQQqKisUn2Qm6adgmftw== rsa-key-20190909"), - // RepositoryURL: to.Ptr("git@github.com:k8sdeveloper425/flux-get-started"), - // SSHKnownHostsContents: to.Ptr("c3NoLmRldi5henVyZS5jb20gc3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFCQVFDN0hyMW9UV3FOcU9sekdKT2ZHSjROYWtWeUl6ZjFyWFlkNGQ3d282akJsa0x2Q0E0b2RCbEwwbURVeVowL1FVZlRUcWV1K3RtMjJnT3N2K1ZyVlRNazZ2d1JVNzVnWS95OXV0NU1iM2JSNUJWNThkS1h5cTlBOVVlQjVDYWtlaG41WmdtNngxbUtvVnlmK0ZGbjI2aVlxWEpSZ3pJWlpjWjVWNmhyRTBRZzM5a1ptNGF6NDhvMEFVYmY2U3A0U0xkdm51TWEyc1ZOd0hCYm9TN0VKa201N1hRUFZVMy9RcHlOTEhiV0Rkend0cmxTK2V6MzBTM0FkWWhMS0VPeEFHOHdlT255cnRMSkFVZW45bVRrb2w4b0lJMWVkZjdtV1diV1ZmMG5CbWx5MjErblpjbUNUSVNRQnRkY3lQYUVubzdmRlFNREQyNi9zMGxmS29iNEt3OEg="), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-08T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-08T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/DeleteSourceControlConfiguration.json -func ExampleSourceControlConfigurationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSourceControlConfigurationsClient().BeginDelete(ctx, "rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "SRS_GitHubConfig", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/80c21c17b4a7aa57f637ee594f7cfd653255a7e0/specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/stable/2023-05-01/examples/ListSourceControlConfiguration.json -func ExampleSourceControlConfigurationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkubernetesconfiguration.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSourceControlConfigurationsClient().NewListPager("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SourceControlConfigurationList = armkubernetesconfiguration.SourceControlConfigurationList{ - // Value: []*armkubernetesconfiguration.SourceControlConfiguration{ - // { - // Name: to.Ptr("SRS_GitHubConfig"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/SRS_GitHubConfig"), - // Properties: &armkubernetesconfiguration.SourceControlConfigurationProperties{ - // ComplianceStatus: &armkubernetesconfiguration.ComplianceStatus{ - // ComplianceState: to.Ptr(armkubernetesconfiguration.ComplianceStateTypeCompliant), - // }, - // OperatorInstanceName: to.Ptr("SRSGitHubFluxOp-01"), - // OperatorNamespace: to.Ptr("SRS_Namespace"), - // OperatorScope: to.Ptr(armkubernetesconfiguration.OperatorScopeTypeNamespace), - // OperatorType: to.Ptr(armkubernetesconfiguration.OperatorTypeFlux), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateTypeSucceeded), - // RepositoryURL: to.Ptr("git@github.com:k8sdeveloper425/SRSClusterconfigs"), - // SSHKnownHostsContents: to.Ptr("c3NoLmRldi5henVyZS5jb20gc3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFCQVFDN0hyMW9UV3FOcU9sekdKT2ZHSjROYWtWeUl6ZjFyWFlkNGQ3d282akJsa0x2Q0E0b2RCbEwwbURVeVowL1FVZlRUcWV1K3RtMjJnT3N2K1ZyVlRNazZ2d1JVNzVnWS95OXV0NU1iM2JSNUJWNThkS1h5cTlBOVVlQjVDYWtlaG41WmdtNngxbUtvVnlmK0ZGbjI2aVlxWEpSZ3pJWlpjWjVWNmhyRTBRZzM5a1ptNGF6NDhvMEFVYmY2U3A0U0xkdm51TWEyc1ZOd0hCYm9TN0VKa201N1hRUFZVMy9RcHlOTEhiV0Rkend0cmxTK2V6MzBTM0FkWWhMS0VPeEFHOHdlT255cnRMSkFVZW45bVRrb2w4b0lJMWVkZjdtV1diV1ZmMG5CbWx5MjErblpjbUNUSVNRQnRkY3lQYUVubzdmRlFNREQyNi9zMGxmS29iNEt3OEg="), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-08T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-08T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // }, - // { - // Name: to.Ptr("SCRS_GitHubConfig"), - // Type: to.Ptr("Microsoft.KubernetesConfiguration/sourceControlConfigurations"), - // ID: to.Ptr("/subscriptions/subId1/resourceGroups/rg1/providers/Microsoft.Kubernetes/connectedClusters/clusterName1/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/SCRS_GitHubConfig"), - // Properties: &armkubernetesconfiguration.SourceControlConfigurationProperties{ - // ComplianceStatus: &armkubernetesconfiguration.ComplianceStatus{ - // ComplianceState: to.Ptr(armkubernetesconfiguration.ComplianceStateTypeCompliant), - // }, - // OperatorInstanceName: to.Ptr("SCRSGitHubFluxOp-02"), - // OperatorNamespace: to.Ptr("SCRS_Namespace"), - // OperatorScope: to.Ptr(armkubernetesconfiguration.OperatorScopeTypeCluster), - // OperatorType: to.Ptr(armkubernetesconfiguration.OperatorTypeFlux), - // ProvisioningState: to.Ptr(armkubernetesconfiguration.ProvisioningStateTypeSucceeded), - // RepositoryURL: to.Ptr("git@github.com:k8sdeveloper425/SCRSClusterconfigs"), - // SSHKnownHostsContents: to.Ptr("c3NoLmRldi5henVyZS5jb20gc3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFCQVFDN0hyMW9UV3FOcU9sekdKT2ZHSjROYWtWeUl6ZjFyWFlkNGQ3d282akJsa0x2Q0E0b2RCbEwwbURVeVowL1FVZlRUcWV1K3RtMjJnT3N2K1ZyVlRNazZ2d1JVNzVnWS95OXV0NU1iM2JSNUJWNThkS1h5cTlBOVVlQjVDYWtlaG41WmdtNngxbUtvVnlmK0ZGbjI2aVlxWEpSZ3pJWlpjWjVWNmhyRTBRZzM5a1ptNGF6NDhvMEFVYmY2U3A0U0xkdm51TWEyc1ZOd0hCYm9TN0VKa201N1hRUFZVMy9RcHlOTEhiV0Rkend0cmxTK2V6MzBTM0FkWWhMS0VPeEFHOHdlT255cnRMSkFVZW45bVRrb2w4b0lJMWVkZjdtV1diV1ZmMG5CbWx5MjErblpjbUNUSVNRQnRkY3lQYUVubzdmRlFNREQyNi9zMGxmS29iNEt3OEg="), - // }, - // SystemData: &armkubernetesconfiguration.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-08T05:10:57.027Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-08T05:10:57.027Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armkubernetesconfiguration.CreatedByTypeApplication), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/time_rfc3339.go b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/time_rfc3339.go index fee145427b88..46295dfeaf77 100644 --- a/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/time_rfc3339.go +++ b/sdk/resourcemanager/kubernetesconfiguration/armkubernetesconfiguration/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339