From a74bdf18de52e4b2baa00addaf3006d6415b4f25 Mon Sep 17 00:00:00 2001 From: Jory Horeman Date: Fri, 24 Nov 2023 12:43:46 -0800 Subject: [PATCH 1/4] adding 2023-11-22 stable --- .sha256sum | 1 + Makefile | 2 +- cmd/aro/rp.go | 1 + pkg/api/v20231122/clustermanager.go | 154 + .../clustermanager_validatestatic.go | 37 + .../clustermanager_validatestatic_test.go | 82 + pkg/api/v20231122/generate.go | 6 + pkg/api/v20231122/machinepool_convert.go | 39 + pkg/api/v20231122/machinepool_example.go | 38 + pkg/api/v20231122/openshiftcluster.go | 315 ++ pkg/api/v20231122/openshiftcluster_convert.go | 307 ++ pkg/api/v20231122/openshiftcluster_example.go | 90 + pkg/api/v20231122/openshiftcluster_marshal.go | 20 + .../openshiftcluster_validatestatic.go | 444 +++ .../openshiftcluster_validatestatic_test.go | 1004 +++++++ .../openshiftclusteradminkubeconfig.go | 10 + ...openshiftclusteradminkubeconfig_convert.go | 21 + ...openshiftclusteradminkubeconfig_example.go | 12 + .../v20231122/openshiftclustercredentials.go | 13 + .../openshiftclustercredentials_convert.go | 24 + .../openshiftclustercredentials_example.go | 13 + pkg/api/v20231122/openshiftversion.go | 36 + pkg/api/v20231122/openshiftversion_convert.go | 50 + pkg/api/v20231122/openshiftversion_example.go | 24 + pkg/api/v20231122/register.go | 54 + pkg/api/v20231122/secret_convert.go | 38 + pkg/api/v20231122/secret_example.go | 38 + .../v20231122/syncidentityprovider_convert.go | 39 + .../v20231122/syncidentityprovider_example.go | 38 + pkg/api/v20231122/syncset_convert.go | 39 + pkg/api/v20231122/syncset_example.go | 38 + .../mgmt/2023-11-22/redhatopenshift/client.go | 52 + .../mgmt/2023-11-22/redhatopenshift/enums.go | 137 + .../redhatopenshift/machinepools.go | 561 ++++ .../mgmt/2023-11-22/redhatopenshift/models.go | 2459 +++++++++++++++ .../redhatopenshift/openshiftclusters.go | 814 +++++ .../redhatopenshift/openshiftversions.go | 169 ++ .../2023-11-22/redhatopenshift/operations.go | 152 + .../redhatopenshiftapi/interfaces.go | 106 + .../2023-11-22/redhatopenshift/secrets.go | 561 ++++ .../redhatopenshift/syncidentityproviders.go | 562 ++++ .../2023-11-22/redhatopenshift/syncsets.go | 561 ++++ .../2023-11-22/redhatopenshift/version.go | 28 + pkg/swagger/generator.go | 39 + .../redhatopenshift/v2023_11_22/__init__.py | 23 + .../_azure_red_hat_open_shift_client.py | 131 + .../v2023_11_22/_configuration.py | 83 + .../redhatopenshift/v2023_11_22/_patch.py | 31 + .../redhatopenshift/v2023_11_22/_vendor.py | 35 + .../v2023_11_22/models/__init__.py | 158 + .../_azure_red_hat_open_shift_client_enums.py | 76 + .../v2023_11_22/models/_models.py | 1685 +++++++++++ .../v2023_11_22/models/_models_py3.py | 1832 ++++++++++++ .../v2023_11_22/operations/__init__.py | 33 + .../operations/_machine_pools_operations.py | 621 ++++ .../_open_shift_clusters_operations.py | 1076 +++++++ .../_open_shift_versions_operations.py | 178 ++ .../v2023_11_22/operations/_operations.py | 162 + .../operations/_secrets_operations.py | 619 ++++ .../_sync_identity_providers_operations.py | 624 ++++ .../operations/_sync_sets_operations.py | 620 ++++ .../mgmt/redhatopenshift/v2023_11_22/py.typed | 1 + .../examples/MachinePools_CreateOrUpdate.json | 36 + .../examples/MachinePools_Delete.json | 13 + .../2023-11-22/examples/MachinePools_Get.json | 21 + .../examples/MachinePools_List.json | 24 + .../examples/MachinePools_Update.json | 26 + .../OpenShiftClusters_CreateOrUpdate.json | 188 ++ .../examples/OpenShiftClusters_Delete.json | 16 + .../examples/OpenShiftClusters_Get.json | 83 + .../examples/OpenShiftClusters_List.json | 85 + ...penShiftClusters_ListAdminCredentials.json | 15 + ...OpenShiftClusters_ListByResourceGroup.json | 86 + .../OpenShiftClusters_ListCredentials.json | 16 + .../examples/OpenShiftClusters_Update.json | 187 ++ .../examples/OpenShiftVersions_List.json | 21 + .../2023-11-22/examples/Operations_List.json | 21 + .../examples/Secrets_CreateOrUpdate.json | 30 + .../2023-11-22/examples/Secrets_Delete.json | 13 + .../2023-11-22/examples/Secrets_Get.json | 19 + .../2023-11-22/examples/Secrets_List.json | 22 + .../2023-11-22/examples/Secrets_Update.json | 22 + .../SyncIdentityProviders_CreateOrUpdate.json | 36 + .../SyncIdentityProviders_Delete.json | 13 + .../examples/SyncIdentityProviders_Get.json | 21 + .../examples/SyncIdentityProviders_List.json | 24 + .../SyncIdentityProviders_Update.json | 26 + .../examples/SyncSets_CreateOrUpdate.json | 36 + .../2023-11-22/examples/SyncSets_Delete.json | 13 + .../2023-11-22/examples/SyncSets_Get.json | 21 + .../2023-11-22/examples/SyncSets_List.json | 24 + .../2023-11-22/examples/SyncSets_Update.json | 26 + .../stable/2023-11-22/redhatopenshift.json | 2644 +++++++++++++++++ 93 files changed, 21043 insertions(+), 1 deletion(-) create mode 100644 pkg/api/v20231122/clustermanager.go create mode 100644 pkg/api/v20231122/clustermanager_validatestatic.go create mode 100644 pkg/api/v20231122/clustermanager_validatestatic_test.go create mode 100644 pkg/api/v20231122/generate.go create mode 100644 pkg/api/v20231122/machinepool_convert.go create mode 100644 pkg/api/v20231122/machinepool_example.go create mode 100644 pkg/api/v20231122/openshiftcluster.go create mode 100644 pkg/api/v20231122/openshiftcluster_convert.go create mode 100644 pkg/api/v20231122/openshiftcluster_example.go create mode 100644 pkg/api/v20231122/openshiftcluster_marshal.go create mode 100644 pkg/api/v20231122/openshiftcluster_validatestatic.go create mode 100644 pkg/api/v20231122/openshiftcluster_validatestatic_test.go create mode 100644 pkg/api/v20231122/openshiftclusteradminkubeconfig.go create mode 100644 pkg/api/v20231122/openshiftclusteradminkubeconfig_convert.go create mode 100644 pkg/api/v20231122/openshiftclusteradminkubeconfig_example.go create mode 100644 pkg/api/v20231122/openshiftclustercredentials.go create mode 100644 pkg/api/v20231122/openshiftclustercredentials_convert.go create mode 100644 pkg/api/v20231122/openshiftclustercredentials_example.go create mode 100644 pkg/api/v20231122/openshiftversion.go create mode 100644 pkg/api/v20231122/openshiftversion_convert.go create mode 100644 pkg/api/v20231122/openshiftversion_example.go create mode 100644 pkg/api/v20231122/register.go create mode 100644 pkg/api/v20231122/secret_convert.go create mode 100644 pkg/api/v20231122/secret_example.go create mode 100644 pkg/api/v20231122/syncidentityprovider_convert.go create mode 100644 pkg/api/v20231122/syncidentityprovider_example.go create mode 100644 pkg/api/v20231122/syncset_convert.go create mode 100644 pkg/api/v20231122/syncset_example.go create mode 100644 pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/client.go create mode 100644 pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/enums.go create mode 100644 pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/machinepools.go create mode 100644 pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/models.go create mode 100644 pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/openshiftclusters.go create mode 100644 pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/openshiftversions.go create mode 100644 pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/operations.go create mode 100644 pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/redhatopenshiftapi/interfaces.go create mode 100644 pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/secrets.go create mode 100644 pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/syncidentityproviders.go create mode 100644 pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/syncsets.go create mode 100644 pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/version.go create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/__init__.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/_azure_red_hat_open_shift_client.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/_configuration.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/_patch.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/_vendor.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_azure_red_hat_open_shift_client_enums.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/__init__.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_machine_pools_operations.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_clusters_operations.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_versions_operations.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_operations.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_secrets_operations.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_identity_providers_operations.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_sets_operations.py create mode 100644 python/client/azure/mgmt/redhatopenshift/v2023_11_22/py.typed create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_CreateOrUpdate.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_Delete.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_Get.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_List.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_Update.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_CreateOrUpdate.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_Delete.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_Get.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_List.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_ListAdminCredentials.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_ListByResourceGroup.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_ListCredentials.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_Update.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftVersions_List.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Operations_List.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_CreateOrUpdate.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_Delete.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_Get.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_List.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_Update.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_CreateOrUpdate.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_Delete.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_Get.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_List.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_Update.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_CreateOrUpdate.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_Delete.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_Get.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_List.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_Update.json create mode 100644 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json diff --git a/.sha256sum b/.sha256sum index 48fabe250f3..1f308d74a62 100644 --- a/.sha256sum +++ b/.sha256sum @@ -5,3 +5,4 @@ b1f1de0fe40d05de90742b17928968923b936adc294000f58974f50a297581dd swagger/redhat 01ba9562a8dac2824998ff0ad0d2465f79e6a66597bdb321e9409b9f2d12d222 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-04-01/redhatopenshift.json c023515341196746454c0ae7af077d40d3ec13f6b88b33cb558f0a7ab17a5a24 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2023-07-01-preview/redhatopenshift.json 440748951dd1c3b34b5ccbdcb7cd966e3b89490887a1f1d64429561fad789515 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-09-04/redhatopenshift.json +695bf8dea5e971d23b77e9468f64cbc8abf877b86cd1486b84d6150b5e717ce0 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json diff --git a/Makefile b/Makefile index aca342d263d..af036cf841c 100644 --- a/Makefile +++ b/Makefile @@ -72,7 +72,7 @@ clean: find -type d -name 'gomock_reflect_[0-9]*' -exec rm -rf {} \+ 2>/dev/null client: generate - hack/build-client.sh "${AUTOREST_IMAGE}" 2020-04-30 2021-09-01-preview 2022-04-01 2022-09-04 2023-04-01 2023-07-01-preview 2023-09-04 + hack/build-client.sh "${AUTOREST_IMAGE}" 2020-04-30 2021-09-01-preview 2022-04-01 2022-09-04 2023-04-01 2023-07-01-preview 2023-09-04 2023-11-22 # TODO: hard coding dev-config.yaml is clunky; it is also probably convenient to # override COMMIT. diff --git a/cmd/aro/rp.go b/cmd/aro/rp.go index d338f7a565a..0a25d2e11c7 100644 --- a/cmd/aro/rp.go +++ b/cmd/aro/rp.go @@ -25,6 +25,7 @@ import ( _ "github.com/Azure/ARO-RP/pkg/api/v20230401" _ "github.com/Azure/ARO-RP/pkg/api/v20230701preview" _ "github.com/Azure/ARO-RP/pkg/api/v20230904" + _ "github.com/Azure/ARO-RP/pkg/api/v20231122" "github.com/Azure/ARO-RP/pkg/backend" "github.com/Azure/ARO-RP/pkg/database" "github.com/Azure/ARO-RP/pkg/env" diff --git a/pkg/api/v20231122/clustermanager.go b/pkg/api/v20231122/clustermanager.go new file mode 100644 index 00000000000..362355d4007 --- /dev/null +++ b/pkg/api/v20231122/clustermanager.go @@ -0,0 +1,154 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +// SyncSetList represents a list of SyncSets +type SyncSetList struct { + // The list of syncsets. + SyncSets []*SyncSet `json:"value"` + + // The link used to get the next page of operations. + NextLink string `json:"nextLink,omitempty"` +} + +// SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. +type SyncSet struct { + // This is a flag used during the swagger generation typewalker to + // signal that it should be marked as a proxy resource and + // not a tracked ARM resource. + proxyResource bool + + // The resource ID. + ID string `json:"id,omitempty" mutable:"case"` + + // The resource name. + Name string `json:"name,omitempty" mutable:"case"` + + // The resource type. + Type string `json:"type,omitempty" mutable:"case"` + + // SystemData metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + + // The Syncsets properties + Properties SyncSetProperties `json:"properties,omitempty"` +} + +// SyncSetProperties represents the properties of a SyncSet +type SyncSetProperties struct { + // Resources represents the SyncSets configuration. + Resources string `json:"resources,omitempty"` +} + +// MachinePoolList represents a list of MachinePools +type MachinePoolList struct { + // The list of Machine Pools. + MachinePools []*MachinePool `json:"value"` + + // The link used to get the next page of operations. + NextLink string `json:"nextLink,omitempty"` +} + +// MachinePool represents a MachinePool +type MachinePool struct { + // This is a flag used during the swagger generation typewalker to + // signal that it should be marked as a proxy resource and + // not a tracked ARM resource. + proxyResource bool + + // The Resource ID. + ID string `json:"id,omitempty"` + + // The resource name. + Name string `json:"name,omitempty"` + + // The resource type. + Type string `json:"type,omitempty" mutable:"case"` + + // SystemData metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + + // The MachinePool Properties + Properties MachinePoolProperties `json:"properties,omitempty"` +} + +// MachinePoolProperties represents the properties of a MachinePool +type MachinePoolProperties struct { + Resources string `json:"resources,omitempty"` +} + +// SyncSetList represents a list of SyncSets +type SyncIdentityProviderList struct { + // The list of sync identity providers + SyncIdentityProviders []*SyncIdentityProvider `json:"value"` + + // The link used to get the next page of operations. + NextLink string `json:"nextLink,omitempty"` +} + +// SyncIdentityProvider represents a SyncIdentityProvider +type SyncIdentityProvider struct { + // This is a flag used during the swagger generation typewalker to + // signal that it should be marked as a proxy resource and + // not a tracked ARM resource. + proxyResource bool + + // The Resource ID. + ID string `json:"id,omitempty"` + + // The resource name. + Name string `json:"name,omitempty"` + + // The resource type. + Type string `json:"type,omitempty" mutable:"case"` + + // SystemData metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + + // The SyncIdentityProvider Properties + Properties SyncIdentityProviderProperties `json:"properties,omitempty"` +} + +// SyncSetProperties represents the properties of a SyncSet +type SyncIdentityProviderProperties struct { + Resources string `json:"resources,omitempty"` +} + +// SecretList represents a list of Secrets +type SecretList struct { + // The list of secrets. + Secrets []*Secret `json:"value"` + + // The link used to get the next page of operations. + NextLink string `json:"nextLink,omitempty"` +} + +// Secret represents a secret. +type Secret struct { + // This is a flag used during the swagger generation typewalker to + // signal that it should be marked as a proxy resource and + // not a tracked ARM resource. + proxyResource bool + + // The Resource ID. + ID string `json:"id,omitempty"` + + // The resource name. + Name string `json:"name,omitempty"` + + // The resource type. + Type string `json:"type,omitempty" mutable:"case"` + + // SystemData metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + + // The Secret Properties + Properties SecretProperties `json:"properties,omitempty"` +} + +// SecretProperties represents the properties of a Secret +type SecretProperties struct { + // The Secrets Resources. + SecretResources string `json:"secretResources,omitempty"` +} diff --git a/pkg/api/v20231122/clustermanager_validatestatic.go b/pkg/api/v20231122/clustermanager_validatestatic.go new file mode 100644 index 00000000000..5f114f8c8ba --- /dev/null +++ b/pkg/api/v20231122/clustermanager_validatestatic.go @@ -0,0 +1,37 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "strings" +) + +type clusterManagerStaticValidator struct{} + +func (c clusterManagerStaticValidator) Static(body string, ocmResourceType string) error { + var resource map[string]interface{} + + if decodedBody, err := base64.StdEncoding.DecodeString(body); err == nil { + err = json.Unmarshal(decodedBody, &resource) + if err != nil { + return err + } + } else { + b := []byte(body) + err := json.Unmarshal(b, &resource) + if err != nil { + return err + } + } + + payloadResourceKind := strings.ToLower(resource["kind"].(string)) + if payloadResourceKind != ocmResourceType { + return fmt.Errorf("wanted Kind '%v', resource is Kind '%v'", ocmResourceType, payloadResourceKind) + } + + return nil +} diff --git a/pkg/api/v20231122/clustermanager_validatestatic_test.go b/pkg/api/v20231122/clustermanager_validatestatic_test.go new file mode 100644 index 00000000000..44290853f75 --- /dev/null +++ b/pkg/api/v20231122/clustermanager_validatestatic_test.go @@ -0,0 +1,82 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "fmt" + "testing" +) + +var ocmResource = string(` +{ +"apiVersion": "hive.openshift.io/v1", +"kind": "SyncSet", +"metadata": { +"name": "sample", +"namespace": "aro-f60ae8a2-bca1-4987-9056-f2f6a1837caa" +}, +"spec": { +"clusterDeploymentRefs": [], +"resources": [ +{ +"apiVersion": "v1", +"kind": "ConfigMap", +"metadata": { +"name": "myconfigmap" +} +} +] +} +} +`) + +var ocmResourceEncoded = "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=" + +func TestStatic(t *testing.T) { + for _, tt := range []struct { + name string + ocmResource string + ocmResourceType string + wantErr bool + err string + }{ + { + name: "payload Kind matches", + ocmResource: ocmResource, + ocmResourceType: "syncset", + wantErr: false, + }, + { + name: "payload Kind matches and is a base64 encoded string", + ocmResource: ocmResourceEncoded, + ocmResourceType: "syncset", + wantErr: false, + }, + { + name: "payload Kind does not match", + ocmResource: ocmResource, + ocmResourceType: "route", + wantErr: true, + err: "wanted Kind 'route', resource is Kind 'syncset'", + }, + { + name: "payload Kind does not match and is a base64 encoded string", + ocmResource: ocmResourceEncoded, + ocmResourceType: "route", + wantErr: true, + err: "wanted Kind 'route', resource is Kind 'syncset'", + }, + } { + t.Run(tt.name, func(t *testing.T) { + c := &clusterManagerStaticValidator{} + + err := c.Static(tt.ocmResource, tt.ocmResourceType) + if err != nil && tt.wantErr { + if fmt.Sprint(err) != tt.err { + t.Errorf("wanted '%v', got '%v'", tt.err, err) + } + } + }) + } +} diff --git a/pkg/api/v20231122/generate.go b/pkg/api/v20231122/generate.go new file mode 100644 index 00000000000..126e19d8079 --- /dev/null +++ b/pkg/api/v20231122/generate.go @@ -0,0 +1,6 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +//go:generate go run ../../../hack/swagger github.com/Azure/ARO-RP/pkg/api/v20231122 ../../../swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22 diff --git a/pkg/api/v20231122/machinepool_convert.go b/pkg/api/v20231122/machinepool_convert.go new file mode 100644 index 00000000000..7d7e2af2001 --- /dev/null +++ b/pkg/api/v20231122/machinepool_convert.go @@ -0,0 +1,39 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +type machinePoolConverter struct{} + +func (c machinePoolConverter) ToExternal(mp *api.MachinePool) interface{} { + out := new(MachinePool) + out.proxyResource = true + out.ID = mp.ID + out.Name = mp.Name + out.Type = mp.Type + out.Properties.Resources = mp.Properties.Resources + return out +} + +func (c machinePoolConverter) ToInternal(_mp interface{}, out *api.MachinePool) { + ocm := _mp.(*api.MachinePool) + out.ID = ocm.ID +} + +// ToExternalList returns a slice of external representations of the internal objects +func (c machinePoolConverter) ToExternalList(mp []*api.MachinePool) interface{} { + l := &MachinePoolList{ + MachinePools: make([]*MachinePool, 0, len(mp)), + } + + for _, machinepool := range mp { + c := c.ToExternal(machinepool) + l.MachinePools = append(l.MachinePools, c.(*MachinePool)) + } + + return l +} diff --git a/pkg/api/v20231122/machinepool_example.go b/pkg/api/v20231122/machinepool_example.go new file mode 100644 index 00000000000..36395c76659 --- /dev/null +++ b/pkg/api/v20231122/machinepool_example.go @@ -0,0 +1,38 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +func exampleMachinePool() *MachinePool { + doc := api.ExampleClusterManagerConfigurationDocumentMachinePool() + ext := (&machinePoolConverter{}).ToExternal(doc.MachinePool) + return ext.(*MachinePool) +} + +func ExampleMachinePoolPutParameter() interface{} { + mp := exampleMachinePool() + mp.ID = "" + mp.Type = "" + mp.Name = "" + return mp +} + +func ExampleMachinePoolPatchParameter() interface{} { + return ExampleMachinePoolPutParameter() +} + +func ExampleMachinePoolResponse() interface{} { + return exampleMachinePool() +} + +func ExampleMachinePoolListResponse() interface{} { + return &MachinePoolList{ + MachinePools: []*MachinePool{ + ExampleMachinePoolResponse().(*MachinePool), + }, + } +} diff --git a/pkg/api/v20231122/openshiftcluster.go b/pkg/api/v20231122/openshiftcluster.go new file mode 100644 index 00000000000..73b68fb1d65 --- /dev/null +++ b/pkg/api/v20231122/openshiftcluster.go @@ -0,0 +1,315 @@ +package v20231122 + +import "time" + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +// OpenShiftClusterList represents a list of OpenShift clusters. +type OpenShiftClusterList struct { + // The list of OpenShift clusters. + OpenShiftClusters []*OpenShiftCluster `json:"value"` + + // The link used to get the next page of operations. + NextLink string `json:"nextLink,omitempty"` +} + +// OpenShiftCluster represents an Azure Red Hat OpenShift cluster. +type OpenShiftCluster struct { + // The resource ID. + ID string `json:"id,omitempty" mutable:"case"` + + // The resource name. + Name string `json:"name,omitempty" mutable:"case"` + + // The resource type. + Type string `json:"type,omitempty" mutable:"case"` + + // The resource location. + Location string `json:"location,omitempty"` + + // SystemData - The system metadata relating to this resource + SystemData *SystemData `json:"systemData,omitempty"` + + // The resource tags. + Tags Tags `json:"tags,omitempty" mutable:"true"` + + // The cluster properties. + Properties OpenShiftClusterProperties `json:"properties,omitempty"` +} + +// Tags represents an OpenShift cluster's tags. +type Tags map[string]string + +// OpenShiftClusterProperties represents an OpenShift cluster's properties. +type OpenShiftClusterProperties struct { + // The cluster provisioning state. + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + + // The cluster profile. + ClusterProfile ClusterProfile `json:"clusterProfile,omitempty"` + + // The console profile. + ConsoleProfile ConsoleProfile `json:"consoleProfile,omitempty"` + + // The cluster service principal profile. + ServicePrincipalProfile ServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"` + + // The cluster network profile. + NetworkProfile NetworkProfile `json:"networkProfile,omitempty"` + + // The cluster master profile. + MasterProfile MasterProfile `json:"masterProfile,omitempty"` + + // The cluster worker profiles. + WorkerProfiles []WorkerProfile `json:"workerProfiles,omitempty"` + + // The cluster worker profiles status. + WorkerProfilesStatus []WorkerProfile `json:"workerProfilesStatus,omitempty" swagger:"readOnly"` + + // The cluster API server profile. + APIServerProfile APIServerProfile `json:"apiserverProfile,omitempty"` + + // The cluster ingress profiles. + IngressProfiles []IngressProfile `json:"ingressProfiles,omitempty"` +} + +// ProvisioningState represents a provisioning state. +type ProvisioningState string + +// ProvisioningState constants. +// TODO: ProvisioningStateCancelled is included to pass upstream CI. It is currently unused in ARO. +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateUpdating ProvisioningState = "Updating" + ProvisioningStateCancelled ProvisioningState = "Cancelled" + ProvisioningStateAdminUpdating ProvisioningState = "AdminUpdating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateFailed ProvisioningState = "Failed" +) + +// FipsValidatedModules determines if FIPS is used. +type FipsValidatedModules string + +// FipsValidatedModules constants. +const ( + FipsValidatedModulesEnabled FipsValidatedModules = "Enabled" + FipsValidatedModulesDisabled FipsValidatedModules = "Disabled" +) + +// ClusterProfile represents a cluster profile. +type ClusterProfile struct { + // The pull secret for the cluster. + PullSecret string `json:"pullSecret,omitempty"` + + // The domain for the cluster. + Domain string `json:"domain,omitempty"` + + // The version of the cluster. + Version string `json:"version,omitempty"` + + // The ID of the cluster resource group. + ResourceGroupID string `json:"resourceGroupId,omitempty"` + + // If FIPS validated crypto modules are used + FipsValidatedModules FipsValidatedModules `json:"fipsValidatedModules,omitempty"` +} + +// ConsoleProfile represents a console profile. +type ConsoleProfile struct { + // The URL to access the cluster console. + URL string `json:"url,omitempty"` +} + +// ServicePrincipalProfile represents a service principal profile. +type ServicePrincipalProfile struct { + // The client ID used for the cluster. + ClientID string `json:"clientId,omitempty" mutable:"true"` + + // The client secret used for the cluster. + ClientSecret string `json:"clientSecret,omitempty" mutable:"true"` +} + +// The outbound routing strategy used to provide your cluster egress to the internet. +type OutboundType string + +// OutboundType constants. +const ( + OutboundTypeUserDefinedRouting OutboundType = "UserDefinedRouting" + OutboundTypeLoadbalancer OutboundType = "Loadbalancer" +) + +// ResourceReference represents a reference to an Azure resource. +type ResourceReference struct { + // The fully qualified Azure resource id of an IP address resource. + ID string `json:"id,omitempty"` +} + +// LoadBalancerProfile represents the profile of the cluster public load balancer. +type LoadBalancerProfile struct { + // The desired managed outbound IPs for the cluster public load balancer. + ManagedOutboundIPs *ManagedOutboundIPs `json:"managedOutboundIps,omitempty" mutable:"true"` + // The list of effective outbound IP addresses of the public load balancer. + EffectiveOutboundIPs []EffectiveOutboundIP `json:"effectiveOutboundIps,omitempty" swagger:"readOnly"` + // The desired outbound IP resources for the cluster load balancer. + OutboundIPs []OutboundIP `json:"outboundIps,omitempty" mutable:"true"` + // The desired outbound IP Prefix resources for the cluster load balancer. + OutboundIPPrefixes []OutboundIPPrefix `json:"outboundIpPrefixes,omitempty" mutable:"true"` + // The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 1024. + AllocatedOutboundPorts *int `json:"allocatedOutboundPorts,omitempty" mutable:"true"` +} + +// EffectiveOutboundIP represents an effective outbound IP resource of the cluster public load balancer. +type EffectiveOutboundIP ResourceReference + +// ManagedOutboundIPs represents the desired managed outbound IPs for the cluster public load balancer. +type ManagedOutboundIPs struct { + // Count represents the desired number of IPv4 outbound IPs created and managed by Azure for the cluster public load balancer. Allowed values are in the range of 1 - 20. The default value is 1. + Count int `json:"count,omitempty"` +} + +// OutboundIP represents a desired outbound IP resource for the cluster load balancer. +type OutboundIP ResourceReference + +// OutboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load balancer. +type OutboundIPPrefix ResourceReference + +// NetworkProfile represents a network profile. +type NetworkProfile struct { + // The CIDR used for OpenShift/Kubernetes Pods. + PodCIDR string `json:"podCidr,omitempty"` + + // The CIDR used for OpenShift/Kubernetes Services. + ServiceCIDR string `json:"serviceCidr,omitempty"` + + // The OutboundType used for egress traffic. + OutboundType OutboundType `json:"outboundType,omitempty"` + + // The cluster load balancer profile. + LoadBalancerProfile *LoadBalancerProfile `json:"loadBalancerProfile,omitempty"` + + // Specifies whether subnets are pre-attached with an NSG + PreconfiguredNSG PreconfiguredNSG `json:"preconfiguredNSG,omitempty"` +} + +// PreconfiguredNSG represents whether customers want to use their own NSG attached to the subnets +type PreconfiguredNSG string + +// PreconfiguredNSG constants +const ( + PreconfiguredNSGEnabled PreconfiguredNSG = "Enabled" + PreconfiguredNSGDisabled PreconfiguredNSG = "Disabled" +) + +// EncryptionAtHost represents encryption at host state +type EncryptionAtHost string + +// EncryptionAtHost constants +const ( + EncryptionAtHostEnabled EncryptionAtHost = "Enabled" + EncryptionAtHostDisabled EncryptionAtHost = "Disabled" +) + +// MasterProfile represents a master profile. +type MasterProfile struct { + // The size of the master VMs. + VMSize VMSize `json:"vmSize,omitempty"` + + // The Azure resource ID of the master subnet. + SubnetID string `json:"subnetId,omitempty"` + + // Whether master virtual machines are encrypted at host. + EncryptionAtHost EncryptionAtHost `json:"encryptionAtHost,omitempty"` + + // The resource ID of an associated DiskEncryptionSet, if applicable. + DiskEncryptionSetID string `json:"diskEncryptionSetId,omitempty"` +} + +// VM size availability varies by region. +// If a node contains insufficient compute resources (memory, cpu, etc.), pods might fail to run correctly. +// For more details on restricted VM sizes, see: https://docs.microsoft.com/en-us/azure/openshift/support-policies-v4#supported-virtual-machine-sizes +type VMSize string + +// WorkerProfile represents a worker profile. +type WorkerProfile struct { + // The worker profile name. + Name string `json:"name,omitempty"` + + // The size of the worker VMs. + VMSize VMSize `json:"vmSize,omitempty"` + + // The disk size of the worker VMs. + DiskSizeGB int `json:"diskSizeGB,omitempty"` + + // The Azure resource ID of the worker subnet. + SubnetID string `json:"subnetId,omitempty"` + + // The number of worker VMs. + Count int `json:"count,omitempty"` + + // Whether master virtual machines are encrypted at host. + EncryptionAtHost EncryptionAtHost `json:"encryptionAtHost,omitempty"` + + // The resource ID of an associated DiskEncryptionSet, if applicable. + DiskEncryptionSetID string `json:"diskEncryptionSetId,omitempty"` +} + +// APIServerProfile represents an API server profile. +type APIServerProfile struct { + // API server visibility. + Visibility Visibility `json:"visibility,omitempty"` + + // The URL to access the cluster API server. + URL string `json:"url,omitempty"` + + // The IP of the cluster API server. + IP string `json:"ip,omitempty"` +} + +// Visibility represents visibility. +type Visibility string + +// Visibility constants +const ( + VisibilityPublic Visibility = "Public" + VisibilityPrivate Visibility = "Private" +) + +// IngressProfile represents an ingress profile. +type IngressProfile struct { + // The ingress profile name. + Name string `json:"name,omitempty"` + + // Ingress visibility. + Visibility Visibility `json:"visibility,omitempty"` + + // The IP of the ingress. + IP string `json:"ip,omitempty"` +} + +// CreatedByType by defines user type, which executed the request +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The identity that created the resource. + CreatedBy string `json:"createdBy,omitempty"` + // The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + // The identity that last modified the resource. + LastModifiedBy string `json:"lastModifiedBy,omitempty"` + // The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // The type of identity that last modified the resource. + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` +} diff --git a/pkg/api/v20231122/openshiftcluster_convert.go b/pkg/api/v20231122/openshiftcluster_convert.go new file mode 100644 index 00000000000..539213f1de9 --- /dev/null +++ b/pkg/api/v20231122/openshiftcluster_convert.go @@ -0,0 +1,307 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +type openShiftClusterConverter struct{} + +// ToExternal returns a new external representation of the internal object, +// reading from the subset of the internal object's fields that appear in the +// external representation. ToExternal does not modify its argument; there is +// no pointer aliasing between the passed and returned objects +func (c openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interface{} { + out := &OpenShiftCluster{ + ID: oc.ID, + Name: oc.Name, + Type: oc.Type, + Location: oc.Location, + Properties: OpenShiftClusterProperties{ + ProvisioningState: ProvisioningState(oc.Properties.ProvisioningState), + ClusterProfile: ClusterProfile{ + PullSecret: string(oc.Properties.ClusterProfile.PullSecret), + Domain: oc.Properties.ClusterProfile.Domain, + Version: oc.Properties.ClusterProfile.Version, + ResourceGroupID: oc.Properties.ClusterProfile.ResourceGroupID, + FipsValidatedModules: FipsValidatedModules(oc.Properties.ClusterProfile.FipsValidatedModules), + }, + ConsoleProfile: ConsoleProfile{ + URL: oc.Properties.ConsoleProfile.URL, + }, + ServicePrincipalProfile: ServicePrincipalProfile{ + ClientID: oc.Properties.ServicePrincipalProfile.ClientID, + ClientSecret: string(oc.Properties.ServicePrincipalProfile.ClientSecret), + }, + NetworkProfile: NetworkProfile{ + PodCIDR: oc.Properties.NetworkProfile.PodCIDR, + ServiceCIDR: oc.Properties.NetworkProfile.ServiceCIDR, + OutboundType: OutboundType(oc.Properties.NetworkProfile.OutboundType), + PreconfiguredNSG: PreconfiguredNSG(oc.Properties.NetworkProfile.PreconfiguredNSG), + }, + MasterProfile: MasterProfile{ + VMSize: VMSize(oc.Properties.MasterProfile.VMSize), + SubnetID: oc.Properties.MasterProfile.SubnetID, + EncryptionAtHost: EncryptionAtHost(oc.Properties.MasterProfile.EncryptionAtHost), + DiskEncryptionSetID: oc.Properties.MasterProfile.DiskEncryptionSetID, + }, + APIServerProfile: APIServerProfile{ + Visibility: Visibility(oc.Properties.APIServerProfile.Visibility), + URL: oc.Properties.APIServerProfile.URL, + IP: oc.Properties.APIServerProfile.IP, + }, + }, + } + + if oc.Properties.NetworkProfile.LoadBalancerProfile != nil { + out.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{} + + if oc.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts != nil { + out.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts = oc.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts + } + + if oc.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs != nil { + out.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs = &ManagedOutboundIPs{ + Count: oc.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count, + } + } + + if oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs != nil { + out.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs = make([]EffectiveOutboundIP, 0, len(oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs)) + for _, effectiveOutboundIP := range oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs { + out.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs = append(out.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs, EffectiveOutboundIP{ + ID: effectiveOutboundIP.ID, + }) + } + } + + if oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs != nil { + out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs = make([]OutboundIP, 0, len(oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs)) + for _, outboundIP := range oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs { + out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs = append(out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs, OutboundIP{ + ID: outboundIP.ID, + }) + } + } + + if oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes != nil { + out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes = make([]OutboundIPPrefix, 0, len(oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes)) + for _, outboundIPPrefix := range oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes { + out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes = append(out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes, OutboundIPPrefix{ + ID: outboundIPPrefix.ID, + }) + } + } + } + + if oc.Properties.WorkerProfiles != nil { + workerProfiles := oc.Properties.WorkerProfiles + out.Properties.WorkerProfiles = make([]WorkerProfile, 0, len(workerProfiles)) + for _, p := range workerProfiles { + out.Properties.WorkerProfiles = append(out.Properties.WorkerProfiles, WorkerProfile{ + Name: p.Name, + VMSize: VMSize(p.VMSize), + DiskSizeGB: p.DiskSizeGB, + SubnetID: p.SubnetID, + Count: p.Count, + EncryptionAtHost: EncryptionAtHost(p.EncryptionAtHost), + DiskEncryptionSetID: p.DiskEncryptionSetID, + }) + } + } + + if oc.Properties.WorkerProfilesStatus != nil { + workerProfiles := oc.Properties.WorkerProfilesStatus + out.Properties.WorkerProfilesStatus = make([]WorkerProfile, 0, len(workerProfiles)) + for _, p := range workerProfiles { + out.Properties.WorkerProfilesStatus = append(out.Properties.WorkerProfilesStatus, WorkerProfile{ + Name: p.Name, + VMSize: VMSize(p.VMSize), + DiskSizeGB: p.DiskSizeGB, + SubnetID: p.SubnetID, + Count: p.Count, + EncryptionAtHost: EncryptionAtHost(p.EncryptionAtHost), + DiskEncryptionSetID: p.DiskEncryptionSetID, + }) + } + } + + if oc.Properties.IngressProfiles != nil { + out.Properties.IngressProfiles = make([]IngressProfile, 0, len(oc.Properties.IngressProfiles)) + for _, p := range oc.Properties.IngressProfiles { + out.Properties.IngressProfiles = append(out.Properties.IngressProfiles, IngressProfile{ + Name: p.Name, + Visibility: Visibility(p.Visibility), + IP: p.IP, + }) + } + } + + if oc.Tags != nil { + out.Tags = make(map[string]string, len(oc.Tags)) + for k, v := range oc.Tags { + out.Tags[k] = v + } + } + + out.SystemData = &SystemData{ + CreatedBy: oc.SystemData.CreatedBy, + CreatedAt: oc.SystemData.CreatedAt, + CreatedByType: CreatedByType(oc.SystemData.CreatedByType), + LastModifiedBy: oc.SystemData.LastModifiedBy, + LastModifiedAt: oc.SystemData.LastModifiedAt, + LastModifiedByType: CreatedByType(oc.SystemData.LastModifiedByType), + } + + return out +} + +// ToExternalList returns a slice of external representations of the internal +// objects +func (c openShiftClusterConverter) ToExternalList(ocs []*api.OpenShiftCluster, nextLink string) interface{} { + l := &OpenShiftClusterList{ + OpenShiftClusters: make([]*OpenShiftCluster, 0, len(ocs)), + NextLink: nextLink, + } + + for _, oc := range ocs { + l.OpenShiftClusters = append(l.OpenShiftClusters, c.ToExternal(oc).(*OpenShiftCluster)) + } + + return l +} + +// ToInternal overwrites in place a pre-existing internal object, setting (only) +// all mapped fields from the external representation. ToInternal modifies its +// argument; there is no pointer aliasing between the passed and returned +// objects +func (c openShiftClusterConverter) ToInternal(_oc interface{}, out *api.OpenShiftCluster) { + oc := _oc.(*OpenShiftCluster) + + out.ID = oc.ID + out.Name = oc.Name + out.Type = oc.Type + out.Location = oc.Location + out.Tags = nil + if oc.Tags != nil { + out.Tags = make(map[string]string, len(oc.Tags)) + for k, v := range oc.Tags { + out.Tags[k] = v + } + } + out.Properties.ProvisioningState = api.ProvisioningState(oc.Properties.ProvisioningState) + out.Properties.ClusterProfile.PullSecret = api.SecureString(oc.Properties.ClusterProfile.PullSecret) + out.Properties.ClusterProfile.Domain = oc.Properties.ClusterProfile.Domain + out.Properties.ClusterProfile.Version = oc.Properties.ClusterProfile.Version + out.Properties.ClusterProfile.ResourceGroupID = oc.Properties.ClusterProfile.ResourceGroupID + out.Properties.ConsoleProfile.URL = oc.Properties.ConsoleProfile.URL + out.Properties.ClusterProfile.FipsValidatedModules = api.FipsValidatedModules(oc.Properties.ClusterProfile.FipsValidatedModules) + out.Properties.ServicePrincipalProfile.ClientID = oc.Properties.ServicePrincipalProfile.ClientID + out.Properties.ServicePrincipalProfile.ClientSecret = api.SecureString(oc.Properties.ServicePrincipalProfile.ClientSecret) + out.Properties.NetworkProfile.PodCIDR = oc.Properties.NetworkProfile.PodCIDR + out.Properties.NetworkProfile.ServiceCIDR = oc.Properties.NetworkProfile.ServiceCIDR + out.Properties.NetworkProfile.OutboundType = api.OutboundType(oc.Properties.NetworkProfile.OutboundType) + + if oc.Properties.NetworkProfile.LoadBalancerProfile != nil { + loadBalancerProfile := api.LoadBalancerProfile{} + + // EffectiveOutboundIPs is a read-only field, so it will never be present in requests. + // Preserve the slice from the pre-existing internal object. + if out.Properties.NetworkProfile.LoadBalancerProfile != nil { + loadBalancerProfile.EffectiveOutboundIPs = make([]api.EffectiveOutboundIP, len(out.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs)) + copy(loadBalancerProfile.EffectiveOutboundIPs, out.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs) + } + + out.Properties.NetworkProfile.LoadBalancerProfile = &loadBalancerProfile + + if oc.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts != nil { + out.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts = oc.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts + } + + if oc.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs != nil { + out.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs = &api.ManagedOutboundIPs{ + Count: oc.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count, + } + } + if oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs != nil { + out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs = make([]api.OutboundIP, len(oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs)) + for i := range oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs { + out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs[i].ID = oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs[i].ID + } + } + if oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes != nil { + out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes = make([]api.OutboundIPPrefix, len(oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes)) + for i := range oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes { + out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes[i].ID = oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes[i].ID + } + } + if oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs != nil { + out.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs = make([]api.EffectiveOutboundIP, len(oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs)) + for i := range oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs { + out.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs[i].ID = oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs[i].ID + } + } + } + + out.Properties.MasterProfile.VMSize = api.VMSize(oc.Properties.MasterProfile.VMSize) + out.Properties.MasterProfile.SubnetID = oc.Properties.MasterProfile.SubnetID + out.Properties.MasterProfile.EncryptionAtHost = api.EncryptionAtHost(oc.Properties.MasterProfile.EncryptionAtHost) + out.Properties.MasterProfile.DiskEncryptionSetID = oc.Properties.MasterProfile.DiskEncryptionSetID + out.Properties.WorkerProfiles = nil + if oc.Properties.WorkerProfiles != nil { + out.Properties.WorkerProfiles = make([]api.WorkerProfile, len(oc.Properties.WorkerProfiles)) + for i := range oc.Properties.WorkerProfiles { + out.Properties.WorkerProfiles[i].Name = oc.Properties.WorkerProfiles[i].Name + out.Properties.WorkerProfiles[i].VMSize = api.VMSize(oc.Properties.WorkerProfiles[i].VMSize) + out.Properties.WorkerProfiles[i].DiskSizeGB = oc.Properties.WorkerProfiles[i].DiskSizeGB + out.Properties.WorkerProfiles[i].SubnetID = oc.Properties.WorkerProfiles[i].SubnetID + out.Properties.WorkerProfiles[i].Count = oc.Properties.WorkerProfiles[i].Count + out.Properties.WorkerProfiles[i].EncryptionAtHost = api.EncryptionAtHost(oc.Properties.WorkerProfiles[i].EncryptionAtHost) + out.Properties.WorkerProfiles[i].DiskEncryptionSetID = oc.Properties.WorkerProfiles[i].DiskEncryptionSetID + } + } + out.Properties.WorkerProfilesStatus = nil + if oc.Properties.WorkerProfilesStatus != nil { + out.Properties.WorkerProfilesStatus = make([]api.WorkerProfile, len(oc.Properties.WorkerProfilesStatus)) + for i := range oc.Properties.WorkerProfilesStatus { + out.Properties.WorkerProfilesStatus[i].Name = oc.Properties.WorkerProfilesStatus[i].Name + out.Properties.WorkerProfilesStatus[i].VMSize = api.VMSize(oc.Properties.WorkerProfilesStatus[i].VMSize) + out.Properties.WorkerProfilesStatus[i].DiskSizeGB = oc.Properties.WorkerProfilesStatus[i].DiskSizeGB + out.Properties.WorkerProfilesStatus[i].SubnetID = oc.Properties.WorkerProfilesStatus[i].SubnetID + out.Properties.WorkerProfilesStatus[i].Count = oc.Properties.WorkerProfilesStatus[i].Count + out.Properties.WorkerProfilesStatus[i].EncryptionAtHost = api.EncryptionAtHost(oc.Properties.WorkerProfilesStatus[i].EncryptionAtHost) + out.Properties.WorkerProfilesStatus[i].DiskEncryptionSetID = oc.Properties.WorkerProfilesStatus[i].DiskEncryptionSetID + } + } + out.Properties.APIServerProfile.Visibility = api.Visibility(oc.Properties.APIServerProfile.Visibility) + out.Properties.APIServerProfile.URL = oc.Properties.APIServerProfile.URL + out.Properties.APIServerProfile.IP = oc.Properties.APIServerProfile.IP + out.Properties.IngressProfiles = nil + if oc.Properties.IngressProfiles != nil { + out.Properties.IngressProfiles = make([]api.IngressProfile, len(oc.Properties.IngressProfiles)) + for i := range oc.Properties.IngressProfiles { + out.Properties.IngressProfiles[i].Name = oc.Properties.IngressProfiles[i].Name + out.Properties.IngressProfiles[i].Visibility = api.Visibility(oc.Properties.IngressProfiles[i].Visibility) + out.Properties.IngressProfiles[i].IP = oc.Properties.IngressProfiles[i].IP + } + } + + out.SystemData = api.SystemData{ + CreatedBy: oc.SystemData.CreatedBy, + CreatedAt: oc.SystemData.CreatedAt, + CreatedByType: api.CreatedByType(oc.SystemData.CreatedByType), + LastModifiedBy: oc.SystemData.LastModifiedBy, + LastModifiedAt: oc.SystemData.LastModifiedAt, + LastModifiedByType: api.CreatedByType(oc.SystemData.CreatedByType), + } +} + +// ExternalNoReadOnly removes all read-only fields from the external representation. +func (c openShiftClusterConverter) ExternalNoReadOnly(_oc interface{}) { + oc := _oc.(*OpenShiftCluster) + if oc.Properties.NetworkProfile.LoadBalancerProfile != nil { + oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs = nil + } +} diff --git a/pkg/api/v20231122/openshiftcluster_example.go b/pkg/api/v20231122/openshiftcluster_example.go new file mode 100644 index 00000000000..5d506575eee --- /dev/null +++ b/pkg/api/v20231122/openshiftcluster_example.go @@ -0,0 +1,90 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +func exampleOpenShiftCluster() *OpenShiftCluster { + doc := api.ExampleOpenShiftClusterDocument() + doc.OpenShiftCluster.Properties.WorkerProfilesStatus = nil + return (&openShiftClusterConverter{}).ToExternal(doc.OpenShiftCluster).(*OpenShiftCluster) +} + +// ExampleOpenShiftClusterPatchParameter returns an example OpenShiftCluster +// object that an end-user might send to create a cluster in a PATCH request +func ExampleOpenShiftClusterPatchParameter() interface{} { + oc := ExampleOpenShiftClusterPutParameter().(*OpenShiftCluster) + oc.Location = "" + oc.SystemData = nil + oc.Properties.WorkerProfilesStatus = nil + return oc +} + +// ExampleOpenShiftClusterPutParameter returns an example OpenShiftCluster +// object that an end-user might send to create a cluster in a PUT request +func ExampleOpenShiftClusterPutParameter() interface{} { + oc := exampleOpenShiftCluster() + oc.ID = "" + oc.Name = "" + oc.Type = "" + oc.Properties.ProvisioningState = "" + oc.Properties.ClusterProfile.Version = "" + oc.Properties.ClusterProfile.FipsValidatedModules = FipsValidatedModulesEnabled + oc.Properties.ConsoleProfile.URL = "" + oc.Properties.APIServerProfile.URL = "" + oc.Properties.APIServerProfile.IP = "" + oc.Properties.IngressProfiles[0].IP = "" + oc.Properties.MasterProfile.EncryptionAtHost = EncryptionAtHostEnabled + oc.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{ + ManagedOutboundIPs: &ManagedOutboundIPs{ + Count: 1, + }, + } + oc.SystemData = nil + + return oc +} + +// ExampleOpenShiftClusterResponse returns an example OpenShiftCluster object +// that the RP might return to an end-user in a GET response +func ExampleOpenShiftClusterGetResponse() interface{} { + oc := exampleOpenShiftCluster() + oc.Properties.ClusterProfile.PullSecret = "" + oc.Properties.ServicePrincipalProfile.ClientSecret = "" + oc.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{ + EffectiveOutboundIPs: []EffectiveOutboundIP{ + { + ID: "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup/providers/Microsoft.Network/publicIPAddresses/publicIPAddressName", + }, + }, + ManagedOutboundIPs: &ManagedOutboundIPs{ + Count: 1, + }, + } + + return oc +} + +// ExampleOpenShiftClusterResponse returns an example OpenShiftCluster object +// that the RP might return to an end-user in a PUT/PATCH response +func ExampleOpenShiftClusterPutOrPatchResponse() interface{} { + oc := exampleOpenShiftCluster() + oc.Properties.ClusterProfile.PullSecret = "" + oc.Properties.ServicePrincipalProfile.ClientSecret = "" + oc.Properties.WorkerProfilesStatus = nil + + return oc +} + +// ExampleOpenShiftClusterListResponse returns an example OpenShiftClusterList +// object that the RP might return to an end-user +func ExampleOpenShiftClusterListResponse() interface{} { + return &OpenShiftClusterList{ + OpenShiftClusters: []*OpenShiftCluster{ + ExampleOpenShiftClusterGetResponse().(*OpenShiftCluster), + }, + } +} diff --git a/pkg/api/v20231122/openshiftcluster_marshal.go b/pkg/api/v20231122/openshiftcluster_marshal.go new file mode 100644 index 00000000000..1412736309f --- /dev/null +++ b/pkg/api/v20231122/openshiftcluster_marshal.go @@ -0,0 +1,20 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "encoding/json" +) + +// UnmarshalJSON unmarshals tags. We override this to ensure that PATCH +// behaviour overwrites an existing tags map rather than endlessly adding to it +func (t *Tags) UnmarshalJSON(b []byte) error { + var m map[string]string + err := json.Unmarshal(b, &m) + if err != nil { + return err + } + *t = m + return nil +} diff --git a/pkg/api/v20231122/openshiftcluster_validatestatic.go b/pkg/api/v20231122/openshiftcluster_validatestatic.go new file mode 100644 index 00000000000..c8cab37fb0a --- /dev/null +++ b/pkg/api/v20231122/openshiftcluster_validatestatic.go @@ -0,0 +1,444 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "fmt" + "net" + "net/http" + "net/url" + "strings" + + "github.com/Azure/go-autorest/autorest/azure" + + "github.com/Azure/ARO-RP/pkg/api" + "github.com/Azure/ARO-RP/pkg/api/util/immutable" + apisubnet "github.com/Azure/ARO-RP/pkg/api/util/subnet" + "github.com/Azure/ARO-RP/pkg/api/validate" + "github.com/Azure/ARO-RP/pkg/util/pullsecret" + "github.com/Azure/ARO-RP/pkg/util/uuid" +) + +type openShiftClusterStaticValidator struct { + location string + domain string + requireD2sV3Workers bool + resourceID string + + r azure.Resource +} + +// Validate validates an OpenShift cluster +func (sv openShiftClusterStaticValidator) Static(_oc interface{}, _current *api.OpenShiftCluster, location, domain string, requireD2sV3Workers bool, resourceID string) error { + sv.location = location + sv.domain = domain + sv.requireD2sV3Workers = requireD2sV3Workers + sv.resourceID = resourceID + + oc := _oc.(*OpenShiftCluster) + + var current *OpenShiftCluster + if _current != nil { + current = (&openShiftClusterConverter{}).ToExternal(_current).(*OpenShiftCluster) + } + + var err error + sv.r, err = azure.ParseResourceID(sv.resourceID) + if err != nil { + return err + } + + err = sv.validate(oc, current == nil) + if err != nil { + return err + } + + if current == nil { + return nil + } + + return sv.validateDelta(oc, current) +} + +func (sv openShiftClusterStaticValidator) validate(oc *OpenShiftCluster, isCreate bool) error { + if !strings.EqualFold(oc.ID, sv.resourceID) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeMismatchingResourceID, "id", "The provided resource ID '%s' did not match the name in the Url '%s'.", oc.ID, sv.resourceID) + } + if !strings.EqualFold(oc.Name, sv.r.ResourceName) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeMismatchingResourceName, "name", "The provided resource name '%s' did not match the name in the Url '%s'.", oc.Name, sv.r.ResourceName) + } + if !strings.EqualFold(oc.Type, resourceProviderNamespace+"/"+resourceType) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeMismatchingResourceType, "type", "The provided resource type '%s' did not match the name in the Url '%s'.", oc.Type, resourceProviderNamespace+"/"+resourceType) + } + if !strings.EqualFold(oc.Location, sv.location) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, "location", "The provided location '%s' is invalid.", oc.Location) + } + + return sv.validateProperties("properties", &oc.Properties, isCreate) +} + +func (sv openShiftClusterStaticValidator) validateProperties(path string, p *OpenShiftClusterProperties, isCreate bool) error { + switch p.ProvisioningState { + case ProvisioningStateCreating, ProvisioningStateUpdating, + ProvisioningStateAdminUpdating, ProvisioningStateDeleting, + ProvisioningStateSucceeded, ProvisioningStateFailed: + default: + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".provisioningState", "The provided provisioning state '%s' is invalid.", p.ProvisioningState) + } + if err := sv.validateClusterProfile(path+".clusterProfile", &p.ClusterProfile, isCreate); err != nil { + return err + } + if err := sv.validateConsoleProfile(path+".consoleProfile", &p.ConsoleProfile); err != nil { + return err + } + if err := sv.validateServicePrincipalProfile(path+".servicePrincipalProfile", &p.ServicePrincipalProfile); err != nil { + return err + } + if err := sv.validateNetworkProfile(path+".networkProfile", &p.NetworkProfile, p.APIServerProfile.Visibility, p.IngressProfiles[0].Visibility); err != nil { + return err + } + if err := sv.validateMasterProfile(path+".masterProfile", &p.MasterProfile); err != nil { + return err + } + if err := sv.validateAPIServerProfile(path+".apiserverProfile", &p.APIServerProfile); err != nil { + return err + } + + if isCreate { + if len(p.WorkerProfilesStatus) != 0 { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".workerProfilesStatus", "Worker Profile Status must be set to nil.") + } + + if len(p.WorkerProfiles) != 1 { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".workerProfiles", "There should be exactly one worker profile.") + } + if err := sv.validateWorkerProfile(path+".workerProfiles['"+p.WorkerProfiles[0].Name+"']", &p.WorkerProfiles[0], &p.MasterProfile); err != nil { + return err + } + + if len(p.IngressProfiles) != 1 { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".ingressProfiles", "There should be exactly one ingress profile.") + } + if err := sv.validateIngressProfile(path+".ingressProfiles['"+p.IngressProfiles[0].Name+"']", &p.IngressProfiles[0]); err != nil { + return err + } + } + + return nil +} + +func (sv openShiftClusterStaticValidator) validateClusterProfile(path string, cp *ClusterProfile, isCreate bool) error { + if pullsecret.Validate(cp.PullSecret) != nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".pullSecret", "The provided pull secret is invalid.") + } + if isCreate { + if !validate.RxDomainName.MatchString(cp.Domain) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain) + } + } else { + // We currently do not allow domains with a digit as a first charecter, + // for new clusters, but we already have some existing clusters with + // domains like this and we need to allow customers to update them. + if !validate.RxDomainNameRFC1123.MatchString(cp.Domain) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain) + } + } + // domain ends .aroapp.io, but doesn't end ..aroapp.io + if strings.HasSuffix(cp.Domain, "."+strings.SplitN(sv.domain, ".", 2)[1]) && + !strings.HasSuffix(cp.Domain, "."+sv.domain) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain) + } + // domain is of form multiple.names..aroapp.io + if strings.HasSuffix(cp.Domain, "."+sv.domain) && + strings.ContainsRune(strings.TrimSuffix(cp.Domain, "."+sv.domain), '.') { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".domain", "The provided domain '%s' is invalid.", cp.Domain) + } + + if !validate.RxResourceGroupID.MatchString(cp.ResourceGroupID) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid.", cp.ResourceGroupID) + } + if strings.Split(cp.ResourceGroupID, "/")[2] != sv.r.SubscriptionID { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid: must be in same subscription as cluster.", cp.ResourceGroupID) + } + if strings.EqualFold(cp.ResourceGroupID, fmt.Sprintf("/subscriptions/%s/resourceGroups/%s", sv.r.SubscriptionID, sv.r.ResourceGroup)) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".resourceGroupId", "The provided resource group '%s' is invalid: must be different from resourceGroup of the OpenShift cluster object.", cp.ResourceGroupID) + } + + switch cp.FipsValidatedModules { + case FipsValidatedModulesDisabled, FipsValidatedModulesEnabled: + default: + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".fipsValidatedModules", "The provided value '%s' is invalid.", cp.FipsValidatedModules) + } + + return nil +} + +func (sv openShiftClusterStaticValidator) validateConsoleProfile(path string, cp *ConsoleProfile) error { + if cp.URL != "" { + if _, err := url.Parse(cp.URL); err != nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".url", "The provided console URL '%s' is invalid.", cp.URL) + } + } + + return nil +} + +func (sv openShiftClusterStaticValidator) validateServicePrincipalProfile(path string, spp *ServicePrincipalProfile) error { + valid := uuid.IsValid(spp.ClientID) + if !valid { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".clientId", "The provided client ID '%s' is invalid.", spp.ClientID) + } + if spp.ClientSecret == "" { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".clientSecret", "The provided client secret is invalid.") + } + + return nil +} + +func (sv openShiftClusterStaticValidator) validateNetworkProfile(path string, np *NetworkProfile, apiServerVisibility Visibility, ingressVisibility Visibility) error { + _, pod, err := net.ParseCIDR(np.PodCIDR) + if err != nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".podCidr", "The provided pod CIDR '%s' is invalid: '%s'.", np.PodCIDR, err) + } + if pod.IP.To4() == nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".podCidr", "The provided pod CIDR '%s' is invalid: must be IPv4.", np.PodCIDR) + } + { + ones, _ := pod.Mask.Size() + if ones > 18 { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".podCidr", "The provided vnet CIDR '%s' is invalid: must be /18 or larger.", np.PodCIDR) + } + } + _, service, err := net.ParseCIDR(np.ServiceCIDR) + if err != nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".serviceCidr", "The provided service CIDR '%s' is invalid: '%s'.", np.ServiceCIDR, err) + } + if service.IP.To4() == nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".serviceCidr", "The provided service CIDR '%s' is invalid: must be IPv4.", np.ServiceCIDR) + } + { + ones, _ := service.Mask.Size() + if ones > 22 { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".serviceCidr", "The provided vnet CIDR '%s' is invalid: must be /22 or larger.", np.ServiceCIDR) + } + } + + if np.OutboundType != "" { + if np.OutboundType != OutboundTypeLoadbalancer && np.OutboundType != OutboundTypeUserDefinedRouting { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".outboundType", "The provided outboundType '%s' is invalid: must be UserDefinedRouting or Loadbalancer.", np.OutboundType) + } + if np.OutboundType == OutboundTypeUserDefinedRouting && (apiServerVisibility != VisibilityPrivate || ingressVisibility != VisibilityPrivate) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".outboundType", "The provided outboundType '%s' is invalid: cannot use UserDefinedRouting if either API Server Visibility or Ingress Visibility is public.", np.OutboundType) + } + } + + if np.OutboundType == OutboundTypeUserDefinedRouting && np.LoadBalancerProfile != nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".loadBalancerProfile", "The provided loadBalancerProfile is invalid: cannot use a loadBalancerProfile if outboundType is UserDefinedRouting.") + } + + return nil +} + +func (sv openShiftClusterStaticValidator) validateLoadBalancerProfile(path string, lbp *LoadBalancerProfile, isCreate bool) error { + if lbp == nil { + return nil + } + + err := checkPickedExactlyOne(path, lbp) + if err != nil { + return err + } + + switch { + case lbp.ManagedOutboundIPs != nil: + err := validateManagedOutboundIPs(path, *lbp.ManagedOutboundIPs) + if err != nil { + return err + } + case lbp.OutboundIPs != nil: + err := validateOutboundIPs(path, lbp.OutboundIPs) + if err != nil { + return err + } + case lbp.OutboundIPPrefixes != nil: + err := validateOutboundIPPrefixes(path, lbp.OutboundIPPrefixes) + if err != nil { + return err + } + } + + if lbp.AllocatedOutboundPorts != nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".allocatedOutboundPorts", "The field allocatedOutboundPorts is not implemented at this time, please check back later.") + } + + // Prevents EffectiveOutboundIPs from being set during create, + // during update validateDelta will prevent the field from being changed. + if lbp.EffectiveOutboundIPs != nil && isCreate { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".effectiveOutboundIps", "The field effectiveOutboundIps is read only.") + } + return nil +} + +func checkPickedExactlyOne(path string, lbp *LoadBalancerProfile) error { + var isManagedOutboundIPCount = lbp.ManagedOutboundIPs != nil + var isOutboundIPs = lbp.OutboundIPs != nil + var isOutboundIPPrefixes = lbp.OutboundIPPrefixes != nil + + if !isManagedOutboundIPCount && !isOutboundIPPrefixes && !isOutboundIPs { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path, "The provided loadBalancerProfile is invalid: must specify one of managedOutboundIps, outboundIps, or outboundIpPrefixes.") + } else if !((isManagedOutboundIPCount && !isOutboundIPs && !isOutboundIPPrefixes) || + (!isManagedOutboundIPCount && isOutboundIPs && !isOutboundIPPrefixes) || + (!isManagedOutboundIPCount && !isOutboundIPs && isOutboundIPPrefixes)) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path, "The provided loadBalancerProfile is invalid: can only use one of managedOutboundIps, outboundIps, or outboundIpPrefixes at a time.") + } + return nil +} + +func validateManagedOutboundIPs(path string, managedOutboundIPs ManagedOutboundIPs) error { + if !(managedOutboundIPs.Count > 0 && managedOutboundIPs.Count <= 20) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".managedOutboundIps.count", "The provided managedOutboundIps.count %d is invalid: managedOutboundIps.count must be in the range of 1 to 20 (inclusive).", managedOutboundIPs.Count) + } + return nil +} + +func validateOutboundIPs(path string, outboundIPs []OutboundIP) error { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".outboundIps", "The field outboundIps is not implemented at this time, please check back later.") +} + +func validateOutboundIPPrefixes(path string, outboundIPPrefixes []OutboundIPPrefix) error { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".outboundIpPrefixes", "The field outboundIpPrefixes is not implemented at this time, please check back later.") +} + +func (sv openShiftClusterStaticValidator) validateMasterProfile(path string, mp *MasterProfile) error { + if !validate.VMSizeIsValid(api.VMSize(mp.VMSize), sv.requireD2sV3Workers, true) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".vmSize", "The provided master VM size '%s' is invalid.", mp.VMSize) + } + if !validate.RxSubnetID.MatchString(mp.SubnetID) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".subnetId", "The provided master VM subnet '%s' is invalid.", mp.SubnetID) + } + sr, err := azure.ParseResourceID(mp.SubnetID) + if err != nil { + return err + } + if sr.SubscriptionID != sv.r.SubscriptionID { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".subnetId", "The provided master VM subnet '%s' is invalid: must be in same subscription as cluster.", mp.SubnetID) + } + switch mp.EncryptionAtHost { + case EncryptionAtHostDisabled, EncryptionAtHostEnabled: + default: + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".encryptionAtHost", "The provided value '%s' is invalid.", mp.EncryptionAtHost) + } + if mp.DiskEncryptionSetID != "" { + if !validate.RxDiskEncryptionSetID.MatchString(mp.DiskEncryptionSetID) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".diskEncryptionSetId", "The provided master disk encryption set '%s' is invalid.", mp.DiskEncryptionSetID) + } + desr, err := azure.ParseResourceID(mp.DiskEncryptionSetID) + if err != nil { + return err + } + if desr.SubscriptionID != sv.r.SubscriptionID { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".diskEncryptionSetId", "The provided master disk encryption set '%s' is invalid: must be in same subscription as cluster.", mp.DiskEncryptionSetID) + } + } + + return nil +} + +func (sv openShiftClusterStaticValidator) validateWorkerProfile(path string, wp *WorkerProfile, mp *MasterProfile) error { + if wp.Name != "worker" { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".name", "The provided worker name '%s' is invalid.", wp.Name) + } + if !validate.VMSizeIsValid(api.VMSize(wp.VMSize), sv.requireD2sV3Workers, false) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".vmSize", "The provided worker VM size '%s' is invalid.", wp.VMSize) + } + if !validate.DiskSizeIsValid(wp.DiskSizeGB) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".diskSizeGB", "The provided worker disk size '%d' is invalid.", wp.DiskSizeGB) + } + if !validate.RxSubnetID.MatchString(wp.SubnetID) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".subnetId", "The provided worker VM subnet '%s' is invalid.", wp.SubnetID) + } + switch wp.EncryptionAtHost { + case EncryptionAtHostDisabled, EncryptionAtHostEnabled: + default: + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".encryptionAtHost", "The provided value '%s' is invalid.", wp.EncryptionAtHost) + } + workerVnetID, _, err := apisubnet.Split(wp.SubnetID) + if err != nil { + return err + } + masterVnetID, _, err := apisubnet.Split(mp.SubnetID) + if err != nil { + return err + } + if !strings.EqualFold(masterVnetID, workerVnetID) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".subnetId", "The provided worker VM subnet '%s' is invalid: must be in the same vnet as master VM subnet '%s'.", wp.SubnetID, mp.SubnetID) + } + if strings.EqualFold(mp.SubnetID, wp.SubnetID) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".subnetId", "The provided worker VM subnet '%s' is invalid: must be different to master VM subnet '%s'.", wp.SubnetID, mp.SubnetID) + } + if wp.Count < 2 || wp.Count > 50 { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".count", "The provided worker count '%d' is invalid.", wp.Count) + } + if !strings.EqualFold(mp.DiskEncryptionSetID, wp.DiskEncryptionSetID) { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".subnetId", "The provided worker disk encryption set '%s' is invalid: must be the same as master disk encryption set '%s'.", wp.DiskEncryptionSetID, mp.DiskEncryptionSetID) + } + + return nil +} + +func (sv openShiftClusterStaticValidator) validateAPIServerProfile(path string, ap *APIServerProfile) error { + switch ap.Visibility { + case VisibilityPublic, VisibilityPrivate: + default: + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".visibility", "The provided visibility '%s' is invalid.", ap.Visibility) + } + if ap.URL != "" { + if _, err := url.Parse(ap.URL); err != nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".url", "The provided URL '%s' is invalid.", ap.URL) + } + } + if ap.IP != "" { + ip := net.ParseIP(ap.IP) + if ip == nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".ip", "The provided IP '%s' is invalid.", ap.IP) + } + if ip.To4() == nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".ip", "The provided IP '%s' is invalid: must be IPv4.", ap.IP) + } + } + + return nil +} + +func (sv openShiftClusterStaticValidator) validateIngressProfile(path string, p *IngressProfile) error { + if p.Name != "default" { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".name", "The provided ingress name '%s' is invalid.", p.Name) + } + switch p.Visibility { + case VisibilityPublic, VisibilityPrivate: + default: + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".visibility", "The provided visibility '%s' is invalid.", p.Visibility) + } + if p.IP != "" { + ip := net.ParseIP(p.IP) + if ip == nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".ip", "The provided IP '%s' is invalid.", p.IP) + } + if ip.To4() == nil { + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".ip", "The provided IP '%s' is invalid: must be IPv4.", p.IP) + } + } + + return nil +} + +func (sv openShiftClusterStaticValidator) validateDelta(oc, current *OpenShiftCluster) error { + err := immutable.Validate("", oc, current) + if err != nil { + err := err.(*immutable.ValidationError) + return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodePropertyChangeNotAllowed, err.Target, err.Message) + } + + return nil +} diff --git a/pkg/api/v20231122/openshiftcluster_validatestatic_test.go b/pkg/api/v20231122/openshiftcluster_validatestatic_test.go new file mode 100644 index 00000000000..36101be3817 --- /dev/null +++ b/pkg/api/v20231122/openshiftcluster_validatestatic_test.go @@ -0,0 +1,1004 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "fmt" + "net/http" + "strings" + "testing" + "time" + + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/to" + + "github.com/Azure/ARO-RP/pkg/api" + "github.com/Azure/ARO-RP/pkg/util/uuid" + "github.com/Azure/ARO-RP/pkg/util/version" + "github.com/Azure/ARO-RP/test/validate" +) + +type validateTest struct { + name string + clusterName *string + location *string + current func(oc *OpenShiftCluster) + modify func(oc *OpenShiftCluster) + requireD2sV3Workers bool + wantErr string +} + +type testMode string + +const ( + testModeCreate testMode = "Create" + testModeUpdate testMode = "Update" +) + +var ( + subscriptionID = "00000000-0000-0000-0000-000000000000" +) + +func getResourceID(clusterName string) string { + return fmt.Sprintf("/subscriptions/%s/resourcegroups/resourceGroup/providers/microsoft.redhatopenshift/openshiftclusters/%s", subscriptionID, clusterName) +} + +func validOpenShiftCluster(name, location string) *OpenShiftCluster { + timestamp, err := time.Parse(time.RFC3339, "2021-01-23T12:34:54.0000000Z") + if err != nil { + panic(err) + } + + oc := &OpenShiftCluster{ + ID: getResourceID(name), + Name: name, + Type: "Microsoft.RedHatOpenShift/OpenShiftClusters", + Location: location, + Tags: Tags{ + "key": "value", + }, + SystemData: &SystemData{ + CreatedBy: "00000000-0000-0000-0000-000000000000", + CreatedByType: CreatedByTypeApplication, + CreatedAt: ×tamp, + LastModifiedBy: "00000000-0000-0000-0000-000000000000", + LastModifiedByType: CreatedByTypeApplication, + LastModifiedAt: ×tamp, + }, + Properties: OpenShiftClusterProperties{ + ProvisioningState: ProvisioningStateSucceeded, + ClusterProfile: ClusterProfile{ + PullSecret: `{"auths":{"registry.connect.redhat.com":{"auth":""},"registry.redhat.io":{"auth":""}}}`, + Domain: "cluster.location.aroapp.io", + Version: version.DefaultInstallStream.Version.String(), + ResourceGroupID: fmt.Sprintf("/subscriptions/%s/resourceGroups/test-cluster", subscriptionID), + FipsValidatedModules: FipsValidatedModulesDisabled, + }, + ConsoleProfile: ConsoleProfile{ + URL: "https://console-openshift-console.apps.cluster.location.aroapp.io/", + }, + ServicePrincipalProfile: ServicePrincipalProfile{ + ClientSecret: "clientSecret", + ClientID: "11111111-1111-1111-1111-111111111111", + }, + NetworkProfile: NetworkProfile{ + PodCIDR: "10.128.0.0/14", + ServiceCIDR: "172.30.0.0/16", + OutboundType: OutboundTypeLoadbalancer, + LoadBalancerProfile: &LoadBalancerProfile{ + ManagedOutboundIPs: &ManagedOutboundIPs{ + Count: 1, + }, + }, + }, + MasterProfile: MasterProfile{ + VMSize: "Standard_D8s_v3", + EncryptionAtHost: EncryptionAtHostDisabled, + SubnetID: fmt.Sprintf("/subscriptions/%s/resourceGroups/vnet/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/master", subscriptionID), + }, + WorkerProfiles: []WorkerProfile{ + { + Name: "worker", + VMSize: "Standard_D4s_v3", + EncryptionAtHost: EncryptionAtHostDisabled, + DiskSizeGB: 128, + SubnetID: fmt.Sprintf("/subscriptions/%s/resourceGroups/vnet/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/worker", subscriptionID), + Count: 3, + }, + }, + APIServerProfile: APIServerProfile{ + Visibility: VisibilityPublic, + URL: "https://api.cluster.location.aroapp.io:6443/", + IP: "1.2.3.4", + }, + IngressProfiles: []IngressProfile{ + { + Name: "default", + Visibility: VisibilityPublic, + IP: "1.2.3.4", + }, + }, + }, + } + + return oc +} + +func runTests(t *testing.T, mode testMode, tests []*validateTest) { + t.Run(string(mode), func(t *testing.T) { + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // default values if not set + if tt.location == nil { + tt.location = to.StringPtr("location") + } + + if tt.clusterName == nil { + tt.clusterName = to.StringPtr("resourceName") + } + + v := &openShiftClusterStaticValidator{ + location: *tt.location, + domain: "location.aroapp.io", + requireD2sV3Workers: tt.requireD2sV3Workers, + resourceID: getResourceID(*tt.clusterName), + r: azure.Resource{ + SubscriptionID: subscriptionID, + ResourceGroup: "resourceGroup", + Provider: "Microsoft.RedHatOpenShift", + ResourceType: "openshiftClusters", + ResourceName: *tt.clusterName, + }, + } + + validOCForTest := func() *OpenShiftCluster { + oc := validOpenShiftCluster(*tt.clusterName, *tt.location) + if tt.current != nil { + tt.current(oc) + } + return oc + } + + oc := validOCForTest() + if tt.modify != nil { + tt.modify(oc) + } + + var current *api.OpenShiftCluster + if mode == testModeUpdate { + current = &api.OpenShiftCluster{} + (&openShiftClusterConverter{}).ToInternal(validOCForTest(), current) + } + + err := v.Static(oc, current, v.location, v.domain, tt.requireD2sV3Workers, v.resourceID) + if err == nil { + if tt.wantErr != "" { + t.Error(err) + } + } else { + if err.Error() != tt.wantErr { + t.Error(err) + } + + cloudErr := err.(*api.CloudError) + + if cloudErr.StatusCode != http.StatusBadRequest { + t.Error(cloudErr.StatusCode) + } + if cloudErr.Target == "" { + t.Error("target is required") + } + + validate.CloudError(t, err) + } + }) + } + }) +} + +func TestOpenShiftClusterStaticValidate(t *testing.T) { + commonTests := []*validateTest{ + { + name: "valid", + }, + { + name: "id wrong", + modify: func(oc *OpenShiftCluster) { + oc.ID = "wrong" + }, + wantErr: "400: MismatchingResourceID: id: The provided resource ID 'wrong' did not match the name in the Url '/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resourceGroup/providers/microsoft.redhatopenshift/openshiftclusters/resourceName'.", + }, + { + name: "name wrong", + modify: func(oc *OpenShiftCluster) { + oc.Name = "wrong" + }, + wantErr: "400: MismatchingResourceName: name: The provided resource name 'wrong' did not match the name in the Url 'resourceName'.", + }, + { + name: "type wrong", + modify: func(oc *OpenShiftCluster) { + oc.Type = "wrong" + }, + wantErr: "400: MismatchingResourceType: type: The provided resource type 'wrong' did not match the name in the Url 'Microsoft.RedHatOpenShift/openShiftClusters'.", + }, + { + name: "location invalid", + modify: func(oc *OpenShiftCluster) { + oc.Location = "invalid" + }, + wantErr: "400: InvalidParameter: location: The provided location 'invalid' is invalid.", + }, + } + + runTests(t, testModeCreate, commonTests) + runTests(t, testModeUpdate, commonTests) +} + +func TestOpenShiftClusterStaticValidateProperties(t *testing.T) { + commonTests := []*validateTest{ + { + name: "valid", + }, + { + name: "provisioningState invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ProvisioningState = "invalid" + }, + wantErr: "400: InvalidParameter: properties.provisioningState: The provided provisioning state 'invalid' is invalid.", + }, + } + createTests := []*validateTest{ + { + name: "no workerProfiles invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles = nil + }, + wantErr: "400: InvalidParameter: properties.workerProfiles: There should be exactly one worker profile.", + }, + { + name: "multiple workerProfiles invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles = []WorkerProfile{{}, {}} + }, + wantErr: "400: InvalidParameter: properties.workerProfiles: There should be exactly one worker profile.", + }, + { + name: "workerProfileStatus nonNil", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfilesStatus = []WorkerProfile{ + { + Name: "worker", + VMSize: "Standard_D4s_v3", + EncryptionAtHost: EncryptionAtHostDisabled, + DiskSizeGB: 128, + SubnetID: fmt.Sprintf("/subscriptions/%s/resourceGroups/vnet/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/worker", subscriptionID), + Count: 3, + }, + } + }, + wantErr: "400: InvalidParameter: properties.workerProfilesStatus: Worker Profile Status must be set to nil.", + }, + } + + runTests(t, testModeCreate, createTests) + runTests(t, testModeCreate, commonTests) + runTests(t, testModeUpdate, commonTests) +} + +func TestOpenShiftClusterStaticValidateClusterProfile(t *testing.T) { + commonTests := []*validateTest{ + { + name: "valid", + }, + { + name: "pull secret not a map", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.PullSecret = "1" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.pullSecret: The provided pull secret is invalid.", + }, + { + name: "pull secret invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.PullSecret = "{" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.pullSecret: The provided pull secret is invalid.", + }, + { + name: "empty domain invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.Domain = "" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.domain: The provided domain '' is invalid.", + }, + { + name: "upper case domain invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.Domain = "BAD" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.domain: The provided domain 'BAD' is invalid.", + }, + { + name: "domain invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.Domain = "!" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.domain: The provided domain '!' is invalid.", + }, + { + name: "wrong location managed domain invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.Domain = "cluster.wronglocation.aroapp.io" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.domain: The provided domain 'cluster.wronglocation.aroapp.io' is invalid.", + }, + { + name: "double part managed domain invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.Domain = "foo.bar.location.aroapp.io" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.domain: The provided domain 'foo.bar.location.aroapp.io' is invalid.", + }, + { + name: "resourceGroupId invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.ResourceGroupID = "invalid" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.resourceGroupId: The provided resource group 'invalid' is invalid.", + }, + { + name: "cluster resource group subscriptionId not matching cluster subscriptionId", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.ResourceGroupID = "/subscriptions/7a3036d1-60a1-4605-8a41-44955e050804/resourcegroups/test-cluster" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.resourceGroupId: The provided resource group '/subscriptions/7a3036d1-60a1-4605-8a41-44955e050804/resourcegroups/test-cluster' is invalid: must be in same subscription as cluster.", + }, + { + name: "cluster resourceGroup and external resourceGroup equal", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.ResourceGroupID = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resourceGroup" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.resourceGroupId: The provided resource group '/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resourceGroup' is invalid: must be different from resourceGroup of the OpenShift cluster object.", + }, + { + name: "fips validated modules invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.FipsValidatedModules = "invalid" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.fipsValidatedModules: The provided value 'invalid' is invalid.", + }, + { + name: "fips validated modules empty", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.FipsValidatedModules = "" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.fipsValidatedModules: The provided value '' is invalid.", + }, + } + + createTests := []*validateTest{ + { + name: "empty pull secret valid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.PullSecret = "" + }, + }, + { + name: "leading digit domain invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.Domain = "4k7f9clk" + }, + wantErr: "400: InvalidParameter: properties.clusterProfile.domain: The provided domain '4k7f9clk' is invalid.", + }, + } + + updateTests := []*validateTest{ + { + name: "leading digit domain valid", + current: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.Domain = "4k7f9clk" + }, + }, + } + + runTests(t, testModeCreate, createTests) + runTests(t, testModeCreate, commonTests) + runTests(t, testModeUpdate, updateTests) + runTests(t, testModeUpdate, commonTests) +} + +func TestOpenShiftClusterStaticValidateConsoleProfile(t *testing.T) { + commonTests := []*validateTest{ + { + name: "valid", + }, + { + name: "console url invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ConsoleProfile.URL = "\x00" + }, + wantErr: "400: InvalidParameter: properties.consoleProfile.url: The provided console URL '\x00' is invalid.", + }, + } + + createTests := []*validateTest{ + { + name: "empty console url valid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ConsoleProfile.URL = "" + }, + }, + } + + runTests(t, testModeCreate, createTests) + runTests(t, testModeCreate, commonTests) + runTests(t, testModeUpdate, commonTests) +} + +func TestOpenShiftClusterStaticValidateServicePrincipalProfile(t *testing.T) { + tests := []*validateTest{ + { + name: "valid", + }, + { + name: "clientID invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ServicePrincipalProfile.ClientID = "invalid" + }, + wantErr: "400: InvalidParameter: properties.servicePrincipalProfile.clientId: The provided client ID 'invalid' is invalid.", + }, + { + name: "empty clientSecret invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ServicePrincipalProfile.ClientSecret = "" + }, + wantErr: "400: InvalidParameter: properties.servicePrincipalProfile.clientSecret: The provided client secret is invalid.", + }, + } + + runTests(t, testModeCreate, tests) + runTests(t, testModeUpdate, tests) +} + +func TestOpenShiftClusterStaticValidateNetworkProfile(t *testing.T) { + tests := []*validateTest{ + { + name: "valid", + }, + { + name: "podCidr invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.PodCIDR = "invalid" + }, + wantErr: "400: InvalidParameter: properties.networkProfile.podCidr: The provided pod CIDR 'invalid' is invalid: 'invalid CIDR address: invalid'.", + }, + { + name: "ipv6 podCidr invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.PodCIDR = "::0/0" + }, + wantErr: "400: InvalidParameter: properties.networkProfile.podCidr: The provided pod CIDR '::0/0' is invalid: must be IPv4.", + }, + { + name: "serviceCidr invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.ServiceCIDR = "invalid" + }, + wantErr: "400: InvalidParameter: properties.networkProfile.serviceCidr: The provided service CIDR 'invalid' is invalid: 'invalid CIDR address: invalid'.", + }, + { + name: "ipv6 serviceCidr invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.ServiceCIDR = "::0/0" + }, + wantErr: "400: InvalidParameter: properties.networkProfile.serviceCidr: The provided service CIDR '::0/0' is invalid: must be IPv4.", + }, + { + name: "podCidr too small", + modify: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.PodCIDR = "10.0.0.0/19" + }, + wantErr: "400: InvalidParameter: properties.networkProfile.podCidr: The provided vnet CIDR '10.0.0.0/19' is invalid: must be /18 or larger.", + }, + { + name: "serviceCidr too small", + modify: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.ServiceCIDR = "10.0.0.0/23" + }, + wantErr: "400: InvalidParameter: properties.networkProfile.serviceCidr: The provided vnet CIDR '10.0.0.0/23' is invalid: must be /22 or larger.", + }, + { + name: "OutboundType is empty", + current: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.OutboundType = "" + }, + wantErr: "", + }, + { + name: "OutboundType is invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.OutboundType = "invalid" + }, + wantErr: "400: InvalidParameter: properties.networkProfile.outboundType: The provided outboundType 'invalid' is invalid: must be UserDefinedRouting or Loadbalancer.", + }, + { + name: "OutboundType is invalid with UserDefinedRouting and public ingress", + current: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.OutboundType = OutboundTypeUserDefinedRouting + oc.Properties.IngressProfiles[0].Visibility = VisibilityPublic + oc.Properties.APIServerProfile.Visibility = VisibilityPrivate + }, + wantErr: "400: InvalidParameter: properties.networkProfile.outboundType: The provided outboundType 'UserDefinedRouting' is invalid: cannot use UserDefinedRouting if either API Server Visibility or Ingress Visibility is public.", + }, + { + name: "OutboundType Loadbalancer is valid", + modify: func(oc *OpenShiftCluster) { + }, + wantErr: "", + }, + } + + runTests(t, testModeCreate, tests) + runTests(t, testModeUpdate, tests) +} + +func TestOpenShiftClusterStaticValidateMasterProfile(t *testing.T) { + tests := []*validateTest{ + { + name: "valid", + }, + { + name: "vmSize unsupported", + modify: func(oc *OpenShiftCluster) { + oc.Properties.MasterProfile.VMSize = "Standard_D2s_v3" + }, + wantErr: "400: InvalidParameter: properties.masterProfile.vmSize: The provided master VM size 'Standard_D2s_v3' is invalid.", + }, + { + name: "subnetId invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.MasterProfile.SubnetID = "invalid" + }, + wantErr: "400: InvalidParameter: properties.masterProfile.subnetId: The provided master VM subnet 'invalid' is invalid.", + }, + { + name: "subnet subscriptionId not matching cluster subscriptionId", + modify: func(oc *OpenShiftCluster) { + oc.Properties.MasterProfile.SubnetID = "/subscriptions/7a3036d1-60a1-4605-8a41-44955e050804/resourcegroups/test-vnet/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/master" + }, + wantErr: "400: InvalidParameter: properties.masterProfile.subnetId: The provided master VM subnet '/subscriptions/7a3036d1-60a1-4605-8a41-44955e050804/resourcegroups/test-vnet/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/master' is invalid: must be in same subscription as cluster.", + }, + { + name: "disk encryption set is invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.MasterProfile.DiskEncryptionSetID = "invalid" + oc.Properties.WorkerProfiles[0].DiskEncryptionSetID = "invalid" + }, + wantErr: "400: InvalidParameter: properties.masterProfile.diskEncryptionSetId: The provided master disk encryption set 'invalid' is invalid.", + }, + { + name: "disk encryption set not matching cluster subscriptionId", + modify: func(oc *OpenShiftCluster) { + oc.Properties.MasterProfile.DiskEncryptionSetID = "/subscriptions/7a3036d1-60a1-4605-8a41-44955e050804/resourceGroups/fakeRG/providers/Microsoft.Compute/diskEncryptionSets/fakeDES1" + }, + wantErr: "400: InvalidParameter: properties.masterProfile.diskEncryptionSetId: The provided master disk encryption set '/subscriptions/7a3036d1-60a1-4605-8a41-44955e050804/resourceGroups/fakeRG/providers/Microsoft.Compute/diskEncryptionSets/fakeDES1' is invalid: must be in same subscription as cluster.", + }, + { + name: "encryption at host invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.MasterProfile.EncryptionAtHost = "Banana" + }, + wantErr: "400: InvalidParameter: properties.masterProfile.encryptionAtHost: The provided value 'Banana' is invalid.", + }, + { + name: "encryption at host empty", + modify: func(oc *OpenShiftCluster) { + oc.Properties.MasterProfile.EncryptionAtHost = "" + }, + wantErr: "400: InvalidParameter: properties.masterProfile.encryptionAtHost: The provided value '' is invalid.", + }, + } + + createTests := []*validateTest{ + { + name: "disk encryption set is valid", + modify: func(oc *OpenShiftCluster) { + desID := fmt.Sprintf("/subscriptions/%s/resourceGroups/test-cluster/providers/Microsoft.Compute/diskEncryptionSets/test-disk-encryption-set", subscriptionID) + oc.Properties.MasterProfile.DiskEncryptionSetID = desID + oc.Properties.WorkerProfiles[0].DiskEncryptionSetID = desID + }, + }, + } + + runTests(t, testModeCreate, createTests) + runTests(t, testModeCreate, tests) + runTests(t, testModeUpdate, tests) +} + +func TestOpenShiftClusterStaticValidateWorkerProfile(t *testing.T) { + tests := []*validateTest{ + { + name: "valid", + }, + { + name: "name invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].Name = "invalid" + }, + wantErr: "400: InvalidParameter: properties.workerProfiles['invalid'].name: The provided worker name 'invalid' is invalid.", + }, + { + name: "vmSize invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].VMSize = "invalid" + }, + wantErr: "400: InvalidParameter: properties.workerProfiles['worker'].vmSize: The provided worker VM size 'invalid' is invalid.", + }, + { + name: "vmSize too small (prod)", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].VMSize = "Standard_D2s_v3" + }, + wantErr: "400: InvalidParameter: properties.workerProfiles['worker'].vmSize: The provided worker VM size 'Standard_D2s_v3' is invalid.", + }, + { + name: "vmSize too big (dev)", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].VMSize = "Standard_D4s_v3" + }, + requireD2sV3Workers: true, + wantErr: "400: InvalidParameter: properties.workerProfiles['worker'].vmSize: The provided worker VM size 'Standard_D4s_v3' is invalid.", + }, + { + name: "disk too small", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].DiskSizeGB = 127 + }, + wantErr: "400: InvalidParameter: properties.workerProfiles['worker'].diskSizeGB: The provided worker disk size '127' is invalid.", + }, + { + name: "subnetId invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].SubnetID = "invalid" + }, + wantErr: "400: InvalidParameter: properties.workerProfiles['worker'].subnetId: The provided worker VM subnet 'invalid' is invalid.", + }, + { + name: "master and worker subnets not in same vnet", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].SubnetID = fmt.Sprintf("/subscriptions/%s/resourceGroups/vnet/providers/Microsoft.Network/virtualNetworks/different-vnet/subnets/worker", subscriptionID) + }, + wantErr: "400: InvalidParameter: properties.workerProfiles['worker'].subnetId: The provided worker VM subnet '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/vnet/providers/Microsoft.Network/virtualNetworks/different-vnet/subnets/worker' is invalid: must be in the same vnet as master VM subnet '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/vnet/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/master'.", + }, + { + name: "master and worker subnets not different", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].SubnetID = oc.Properties.MasterProfile.SubnetID + }, + wantErr: "400: InvalidParameter: properties.workerProfiles['worker'].subnetId: The provided worker VM subnet '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/vnet/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/master' is invalid: must be different to master VM subnet '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/vnet/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/master'.", + }, + { + name: "count too small", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].Count = 1 + }, + wantErr: "400: InvalidParameter: properties.workerProfiles['worker'].count: The provided worker count '1' is invalid.", + }, + { + name: "count too big", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].Count = 51 + }, + wantErr: "400: InvalidParameter: properties.workerProfiles['worker'].count: The provided worker count '51' is invalid.", + }, + { + name: "disk encryption set not matching master disk encryption set", + modify: func(oc *OpenShiftCluster) { + oc.Properties.MasterProfile.DiskEncryptionSetID = fmt.Sprintf("/subscriptions/%s/resourceGroups/test-cluster/providers/Microsoft.Compute/diskEncryptionSets/test-disk-encryption-set", subscriptionID) + oc.Properties.WorkerProfiles[0].DiskEncryptionSetID = "/subscriptions/7a3036d1-60a1-4605-8a41-44955e050804/resourceGroups/fakeRG/providers/Microsoft.Compute/diskEncryptionSets/fakeDES1" + }, + wantErr: "400: InvalidParameter: properties.workerProfiles['worker'].subnetId: The provided worker disk encryption set '/subscriptions/7a3036d1-60a1-4605-8a41-44955e050804/resourceGroups/fakeRG/providers/Microsoft.Compute/diskEncryptionSets/fakeDES1' is invalid: must be the same as master disk encryption set '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-cluster/providers/Microsoft.Compute/diskEncryptionSets/test-disk-encryption-set'.", + }, + { + name: "encryption at host invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].EncryptionAtHost = "Banana" + }, + wantErr: "400: InvalidParameter: properties.workerProfiles['worker'].encryptionAtHost: The provided value 'Banana' is invalid.", + }, + { + name: "encryption at host empty", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].EncryptionAtHost = "" + }, + wantErr: "400: InvalidParameter: properties.workerProfiles['worker'].encryptionAtHost: The provided value '' is invalid.", + }, + } + + // We do not perform this validation on update + runTests(t, testModeCreate, tests) +} + +func TestOpenShiftClusterStaticValidateAPIServerProfile(t *testing.T) { + commonTests := []*validateTest{ + { + name: "valid", + }, + { + name: "visibility invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.APIServerProfile.Visibility = "invalid" + }, + wantErr: "400: InvalidParameter: properties.apiserverProfile.visibility: The provided visibility 'invalid' is invalid.", + }, + { + name: "url invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.APIServerProfile.URL = "\x00" + }, + wantErr: "400: InvalidParameter: properties.apiserverProfile.url: The provided URL '\x00' is invalid.", + }, + { + name: "ip invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.APIServerProfile.IP = "invalid" + }, + wantErr: "400: InvalidParameter: properties.apiserverProfile.ip: The provided IP 'invalid' is invalid.", + }, + { + name: "ipv6 ip invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.APIServerProfile.IP = "::" + }, + wantErr: "400: InvalidParameter: properties.apiserverProfile.ip: The provided IP '::' is invalid: must be IPv4.", + }, + } + + createTests := []*validateTest{ + { + name: "empty url valid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.APIServerProfile.URL = "" + }, + }, + { + name: "empty ip valid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.APIServerProfile.IP = "" + }, + }, + } + + runTests(t, testModeCreate, createTests) + runTests(t, testModeCreate, commonTests) + runTests(t, testModeUpdate, commonTests) +} + +func TestOpenShiftClusterStaticValidateIngressProfile(t *testing.T) { + tests := []*validateTest{ + { + name: "valid", + }, + { + name: "name invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.IngressProfiles[0].Name = "invalid" + }, + wantErr: "400: InvalidParameter: properties.ingressProfiles['invalid'].name: The provided ingress name 'invalid' is invalid.", + }, + { + name: "visibility invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.IngressProfiles[0].Visibility = "invalid" + }, + wantErr: "400: InvalidParameter: properties.ingressProfiles['default'].visibility: The provided visibility 'invalid' is invalid.", + }, + { + name: "ip invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.IngressProfiles[0].IP = "invalid" + }, + wantErr: "400: InvalidParameter: properties.ingressProfiles['default'].ip: The provided IP 'invalid' is invalid.", + }, + { + name: "ipv6 ip invalid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.IngressProfiles[0].IP = "::" + }, + wantErr: "400: InvalidParameter: properties.ingressProfiles['default'].ip: The provided IP '::' is invalid: must be IPv4.", + }, + { + name: "empty ip valid", + modify: func(oc *OpenShiftCluster) { + oc.Properties.IngressProfiles[0].IP = "" + }, + }, + } + + // we don't validate this on update as all fields are immutable and will + // be validated with "mutable" flag + runTests(t, testModeCreate, tests) +} + +func TestOpenShiftClusterStaticValidateDelta(t *testing.T) { + tests := []*validateTest{ + { + name: "valid", + }, + { + name: "valid id case change", + modify: func(oc *OpenShiftCluster) { oc.ID = strings.ToUpper(oc.ID) }, + }, + { + name: "valid name case change", + modify: func(oc *OpenShiftCluster) { oc.Name = strings.ToUpper(oc.Name) }, + }, + { + name: "valid type case change", + modify: func(oc *OpenShiftCluster) { oc.Type = strings.ToUpper(oc.Type) }, + }, + { + name: "location change", + modify: func(oc *OpenShiftCluster) { oc.Location = strings.ToUpper(oc.Location) }, + wantErr: "400: PropertyChangeNotAllowed: location: Changing property 'location' is not allowed.", + }, + { + name: "valid tags change", + modify: func(oc *OpenShiftCluster) { oc.Tags = Tags{"new": "value"} }, + }, + { + name: "provisioningState change", + modify: func(oc *OpenShiftCluster) { oc.Properties.ProvisioningState = ProvisioningStateFailed }, + wantErr: "400: PropertyChangeNotAllowed: properties.provisioningState: Changing property 'properties.provisioningState' is not allowed.", + }, + { + name: "console url change", + modify: func(oc *OpenShiftCluster) { oc.Properties.ConsoleProfile.URL = "invalid" }, + wantErr: "400: PropertyChangeNotAllowed: properties.consoleProfile.url: Changing property 'properties.consoleProfile.url' is not allowed.", + }, + { + name: "pull secret change", + modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.PullSecret = `{"auths":{}}` }, + wantErr: "400: PropertyChangeNotAllowed: properties.clusterProfile.pullSecret: Changing property 'properties.clusterProfile.pullSecret' is not allowed.", + }, + { + name: "domain change", + modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.Domain = "invalid" }, + wantErr: "400: PropertyChangeNotAllowed: properties.clusterProfile.domain: Changing property 'properties.clusterProfile.domain' is not allowed.", + }, + { + name: "version change", + modify: func(oc *OpenShiftCluster) { oc.Properties.ClusterProfile.Version = "4.3.999" }, + wantErr: "400: PropertyChangeNotAllowed: properties.clusterProfile.version: Changing property 'properties.clusterProfile.version' is not allowed.", + }, + { + name: "resource group change", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ClusterProfile.ResourceGroupID = oc.Properties.ClusterProfile.ResourceGroupID[:strings.LastIndexByte(oc.Properties.ClusterProfile.ResourceGroupID, '/')] + "/changed" + }, + wantErr: "400: PropertyChangeNotAllowed: properties.clusterProfile.resourceGroupId: Changing property 'properties.clusterProfile.resourceGroupId' is not allowed.", + }, + { + name: "apiServer private change", + modify: func(oc *OpenShiftCluster) { + oc.Properties.APIServerProfile.Visibility = VisibilityPrivate + }, + wantErr: "400: PropertyChangeNotAllowed: properties.apiserverProfile.visibility: Changing property 'properties.apiserverProfile.visibility' is not allowed.", + }, + { + name: "apiServer url change", + modify: func(oc *OpenShiftCluster) { oc.Properties.APIServerProfile.URL = "invalid" }, + wantErr: "400: PropertyChangeNotAllowed: properties.apiserverProfile.url: Changing property 'properties.apiserverProfile.url' is not allowed.", + }, + { + name: "apiServer ip change", + modify: func(oc *OpenShiftCluster) { oc.Properties.APIServerProfile.IP = "2.3.4.5" }, + wantErr: "400: PropertyChangeNotAllowed: properties.apiserverProfile.ip: Changing property 'properties.apiserverProfile.ip' is not allowed.", + }, + { + name: "ingress private change", + modify: func(oc *OpenShiftCluster) { + oc.Properties.IngressProfiles[0].Visibility = VisibilityPrivate + }, + wantErr: "400: PropertyChangeNotAllowed: properties.ingressProfiles['default'].visibility: Changing property 'properties.ingressProfiles['default'].visibility' is not allowed.", + }, + { + name: "ingress ip change", + modify: func(oc *OpenShiftCluster) { oc.Properties.IngressProfiles[0].IP = "2.3.4.5" }, + wantErr: "400: PropertyChangeNotAllowed: properties.ingressProfiles['default'].ip: Changing property 'properties.ingressProfiles['default'].ip' is not allowed.", + }, + { + name: "clientId change", + modify: func(oc *OpenShiftCluster) { + oc.Properties.ServicePrincipalProfile.ClientID = uuid.DefaultGenerator.Generate() + }, + }, + { + name: "clientSecret change", + modify: func(oc *OpenShiftCluster) { oc.Properties.ServicePrincipalProfile.ClientSecret = "invalid" }, + }, + { + name: "podCidr change", + modify: func(oc *OpenShiftCluster) { oc.Properties.NetworkProfile.PodCIDR = "0.0.0.0/0" }, + wantErr: "400: PropertyChangeNotAllowed: properties.networkProfile.podCidr: Changing property 'properties.networkProfile.podCidr' is not allowed.", + }, + { + name: "serviceCidr change", + modify: func(oc *OpenShiftCluster) { oc.Properties.NetworkProfile.ServiceCIDR = "0.0.0.0/0" }, + wantErr: "400: PropertyChangeNotAllowed: properties.networkProfile.serviceCidr: Changing property 'properties.networkProfile.serviceCidr' is not allowed.", + }, + { + name: "outboundType change", + modify: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.OutboundType = OutboundTypeUserDefinedRouting + }, + wantErr: "400: InvalidParameter: properties.networkProfile.outboundType: The provided outboundType 'UserDefinedRouting' is invalid: cannot use UserDefinedRouting if either API Server Visibility or Ingress Visibility is public.", + }, + { + name: "master subnetId change", + modify: func(oc *OpenShiftCluster) { + oc.Properties.MasterProfile.SubnetID = oc.Properties.MasterProfile.SubnetID[:strings.LastIndexByte(oc.Properties.MasterProfile.SubnetID, '/')] + "/changed" + }, + wantErr: "400: PropertyChangeNotAllowed: properties.masterProfile.subnetId: Changing property 'properties.masterProfile.subnetId' is not allowed.", + }, + { + name: "worker name change", + modify: func(oc *OpenShiftCluster) { oc.Properties.WorkerProfiles[0].Name = "new-name" }, + wantErr: "400: PropertyChangeNotAllowed: properties.workerProfiles['new-name'].name: Changing property 'properties.workerProfiles['new-name'].name' is not allowed.", + }, + { + name: "worker vmSize change", + modify: func(oc *OpenShiftCluster) { oc.Properties.WorkerProfiles[0].VMSize = "Standard_D8s_v3" }, + wantErr: "400: PropertyChangeNotAllowed: properties.workerProfiles['worker'].vmSize: Changing property 'properties.workerProfiles['worker'].vmSize' is not allowed.", + }, + { + name: "worker diskSizeGB change", + modify: func(oc *OpenShiftCluster) { oc.Properties.WorkerProfiles[0].DiskSizeGB++ }, + wantErr: "400: PropertyChangeNotAllowed: properties.workerProfiles['worker'].diskSizeGB: Changing property 'properties.workerProfiles['worker'].diskSizeGB' is not allowed.", + }, + { + name: "worker subnetId change", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles[0].SubnetID = oc.Properties.WorkerProfiles[0].SubnetID[:strings.LastIndexByte(oc.Properties.WorkerProfiles[0].SubnetID, '/')] + "/changed" + }, + wantErr: "400: PropertyChangeNotAllowed: properties.workerProfiles['worker'].subnetId: Changing property 'properties.workerProfiles['worker'].subnetId' is not allowed.", + }, + { + name: "workerProfiles count change", + modify: func(oc *OpenShiftCluster) { oc.Properties.WorkerProfiles[0].Count++ }, + wantErr: "400: PropertyChangeNotAllowed: properties.workerProfiles['worker'].count: Changing property 'properties.workerProfiles['worker'].count' is not allowed.", + }, + { + name: "number of workerProfiles changes", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles = []WorkerProfile{{}, {}} + }, + wantErr: "400: PropertyChangeNotAllowed: properties.workerProfiles: Changing property 'properties.workerProfiles' is not allowed.", + }, + { + name: "workerProfiles set to nil", + modify: func(oc *OpenShiftCluster) { + oc.Properties.WorkerProfiles = nil + }, + wantErr: "400: PropertyChangeNotAllowed: properties.workerProfiles: Changing property 'properties.workerProfiles' is not allowed.", + }, + { + name: "systemData set to empty", + modify: func(oc *OpenShiftCluster) { + oc.SystemData = &SystemData{} + }, + wantErr: "400: PropertyChangeNotAllowed: systemData.createdBy: Changing property 'systemData.createdBy' is not allowed.", + }, + { + name: "systemData LastUpdated changed", + modify: func(oc *OpenShiftCluster) { + oc.SystemData.LastModifiedBy = "Bob" + }, + wantErr: "400: PropertyChangeNotAllowed: systemData.lastModifiedBy: Changing property 'systemData.lastModifiedBy' is not allowed.", + }, + } + + runTests(t, testModeUpdate, tests) +} diff --git a/pkg/api/v20231122/openshiftclusteradminkubeconfig.go b/pkg/api/v20231122/openshiftclusteradminkubeconfig.go new file mode 100644 index 00000000000..dad327f76c9 --- /dev/null +++ b/pkg/api/v20231122/openshiftclusteradminkubeconfig.go @@ -0,0 +1,10 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +// OpenShiftClusterAdminKubeconfig represents an OpenShift cluster's admin kubeconfig. +type OpenShiftClusterAdminKubeconfig struct { + // The base64-encoded kubeconfig file. + Kubeconfig []byte `json:"kubeconfig,omitempty"` +} diff --git a/pkg/api/v20231122/openshiftclusteradminkubeconfig_convert.go b/pkg/api/v20231122/openshiftclusteradminkubeconfig_convert.go new file mode 100644 index 00000000000..dcdf980818f --- /dev/null +++ b/pkg/api/v20231122/openshiftclusteradminkubeconfig_convert.go @@ -0,0 +1,21 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +type openShiftClusterAdminKubeconfigConverter struct{} + +// openShiftClusterAdminKubeconfigConverter returns a new external representation +// of the internal object, reading from the subset of the internal object's +// fields that appear in the external representation. ToExternal does not +// modify its argument; there is no pointer aliasing between the passed and +// returned objects. +func (openShiftClusterAdminKubeconfigConverter) ToExternal(oc *api.OpenShiftCluster) interface{} { + return &OpenShiftClusterAdminKubeconfig{ + Kubeconfig: oc.Properties.UserAdminKubeconfig, + } +} diff --git a/pkg/api/v20231122/openshiftclusteradminkubeconfig_example.go b/pkg/api/v20231122/openshiftclusteradminkubeconfig_example.go new file mode 100644 index 00000000000..5be5f23d9b8 --- /dev/null +++ b/pkg/api/v20231122/openshiftclusteradminkubeconfig_example.go @@ -0,0 +1,12 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +// ExampleOpenShiftClusterAdminKubeconfigResponse returns an example +// OpenShiftClusterAdminKubeconfig object that the RP might return to an end-user +func ExampleOpenShiftClusterAdminKubeconfigResponse() interface{} { + return &OpenShiftClusterAdminKubeconfig{ + Kubeconfig: []byte("{}"), + } +} diff --git a/pkg/api/v20231122/openshiftclustercredentials.go b/pkg/api/v20231122/openshiftclustercredentials.go new file mode 100644 index 00000000000..21660f82829 --- /dev/null +++ b/pkg/api/v20231122/openshiftclustercredentials.go @@ -0,0 +1,13 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +// OpenShiftClusterCredentials represents an OpenShift cluster's credentials. +type OpenShiftClusterCredentials struct { + // The username for the kubeadmin user. + KubeadminUsername string `json:"kubeadminUsername,omitempty"` + + // The password for the kubeadmin user. + KubeadminPassword string `json:"kubeadminPassword,omitempty"` +} diff --git a/pkg/api/v20231122/openshiftclustercredentials_convert.go b/pkg/api/v20231122/openshiftclustercredentials_convert.go new file mode 100644 index 00000000000..4eb69b43a05 --- /dev/null +++ b/pkg/api/v20231122/openshiftclustercredentials_convert.go @@ -0,0 +1,24 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +type openShiftClusterCredentialsConverter struct{} + +// OpenShiftClusterCredentialsToExternal returns a new external representation +// of the internal object, reading from the subset of the internal object's +// fields that appear in the external representation. ToExternal does not +// modify its argument; there is no pointer aliasing between the passed and +// returned objects. +func (openShiftClusterCredentialsConverter) ToExternal(oc *api.OpenShiftCluster) interface{} { + out := &OpenShiftClusterCredentials{ + KubeadminUsername: "kubeadmin", + KubeadminPassword: string(oc.Properties.KubeadminPassword), + } + + return out +} diff --git a/pkg/api/v20231122/openshiftclustercredentials_example.go b/pkg/api/v20231122/openshiftclustercredentials_example.go new file mode 100644 index 00000000000..da06cea1c7f --- /dev/null +++ b/pkg/api/v20231122/openshiftclustercredentials_example.go @@ -0,0 +1,13 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +// ExampleOpenShiftClusterCredentialsResponse returns an example +// OpenShiftClusterCredentials object that the RP might return to an end-user +func ExampleOpenShiftClusterCredentialsResponse() interface{} { + return &OpenShiftClusterCredentials{ + KubeadminUsername: "kubeadmin", + KubeadminPassword: "password", + } +} diff --git a/pkg/api/v20231122/openshiftversion.go b/pkg/api/v20231122/openshiftversion.go new file mode 100644 index 00000000000..8246b62f920 --- /dev/null +++ b/pkg/api/v20231122/openshiftversion.go @@ -0,0 +1,36 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +// OpenShiftVersionList represents a List of available versions. +type OpenShiftVersionList struct { + // The List of available versions. + OpenShiftVersions []*OpenShiftVersion `json:"value"` + + // Next Link to next operation. + NextLink string `json:"nextLink,omitempty"` +} + +// OpenShiftVersion represents an OpenShift version that can be installed. +type OpenShiftVersion struct { + proxyResource bool + + // The ID for the resource. + ID string `json:"id,omitempty" mutable:"case"` + + // Name of the resource. + Name string `json:"name,omitempty" mutable:"case"` + + // The resource type. + Type string `json:"type,omitempty" mutable:"case"` + + // The properties for the OpenShiftVersion resource. + Properties OpenShiftVersionProperties `json:"properties,omitempty"` +} + +// OpenShiftVersionProperties represents the properties of an OpenShiftVersion. +type OpenShiftVersionProperties struct { + // Version represents the version to create the cluster at. + Version string `json:"version,omitempty"` +} diff --git a/pkg/api/v20231122/openshiftversion_convert.go b/pkg/api/v20231122/openshiftversion_convert.go new file mode 100644 index 00000000000..538ba2fe1f3 --- /dev/null +++ b/pkg/api/v20231122/openshiftversion_convert.go @@ -0,0 +1,50 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +type openShiftVersionConverter struct{} + +// openShiftVersionConverter.ToExternal returns a new external representation +// of the internal object, reading from the subset of the internal object's +// fields that appear in the external representation. ToExternal does not +// modify its argument; there is no pointer aliasing between the passed and +// returned objects. +func (openShiftVersionConverter) ToExternal(v *api.OpenShiftVersion) interface{} { + out := &OpenShiftVersion{ + ID: v.ID, + proxyResource: true, + Properties: OpenShiftVersionProperties{ + Version: v.Properties.Version, + }, + } + + return out +} + +// ToExternalList returns a slice of external representations of the internal +// objects +func (c openShiftVersionConverter) ToExternalList(vers []*api.OpenShiftVersion) interface{} { + l := &OpenShiftVersionList{ + OpenShiftVersions: make([]*OpenShiftVersion, 0, len(vers)), + } + + for _, ver := range vers { + l.OpenShiftVersions = append(l.OpenShiftVersions, c.ToExternal(ver).(*OpenShiftVersion)) + } + + return l +} + +// ToInternal overwrites in place a pre-existing internal object, setting (only) +// all mapped fields from the external representation. ToInternal modifies its +// argument; there is no pointer aliasing between the passed and returned +// objects +func (c openShiftVersionConverter) ToInternal(_new interface{}, out *api.OpenShiftVersion) { + new := _new.(*OpenShiftVersion) + out.Properties.Version = new.Properties.Version +} diff --git a/pkg/api/v20231122/openshiftversion_example.go b/pkg/api/v20231122/openshiftversion_example.go new file mode 100644 index 00000000000..862ff0e48c0 --- /dev/null +++ b/pkg/api/v20231122/openshiftversion_example.go @@ -0,0 +1,24 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import "github.com/Azure/ARO-RP/pkg/api" + +func exampleOpenShiftVersion() *OpenShiftVersion { + doc := api.ExampleOpenShiftVersionDocument() + ext := (&openShiftVersionConverter{}).ToExternal(doc.OpenShiftVersion) + return ext.(*OpenShiftVersion) +} + +func ExampleOpenShiftVersionResponse() interface{} { + return exampleOpenShiftVersion() +} + +func ExampleOpenShiftVersionListResponse() interface{} { + return &OpenShiftVersionList{ + OpenShiftVersions: []*OpenShiftVersion{ + ExampleOpenShiftVersionResponse().(*OpenShiftVersion), + }, + } +} diff --git a/pkg/api/v20231122/register.go b/pkg/api/v20231122/register.go new file mode 100644 index 00000000000..ae2a150e0e5 --- /dev/null +++ b/pkg/api/v20231122/register.go @@ -0,0 +1,54 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +// APIVersion contains a version string as it will be used by clients +const APIVersion = "2023-11-22" + +const ( + resourceProviderNamespace = "Microsoft.RedHatOpenShift" + resourceType = "openShiftClusters" +) + +func init() { + api.APIs[APIVersion] = &api.Version{ + OpenShiftClusterConverter: openShiftClusterConverter{}, + OpenShiftClusterStaticValidator: openShiftClusterStaticValidator{}, + OpenShiftClusterCredentialsConverter: openShiftClusterCredentialsConverter{}, + OpenShiftClusterAdminKubeconfigConverter: openShiftClusterAdminKubeconfigConverter{}, + OpenShiftVersionConverter: openShiftVersionConverter{}, + OperationList: api.OperationList{ + Operations: []api.Operation{ + api.OperationResultsRead, + api.OperationStatusRead, + api.OperationRead, + api.OperationOpenShiftClusterRead, + api.OperationOpenShiftClusterWrite, + api.OperationOpenShiftClusterDelete, + api.OperationOpenShiftClusterListCredentials, + api.OperationOpenShiftClusterListAdminCredentials, + api.OperationListInstallVersions, + api.OperationSyncSetsRead, + api.OperationSyncSetsWrite, + api.OperationSyncSetsDelete, + api.OperationMachinePoolsRead, + api.OperationMachinePoolsWrite, + api.OperationMachinePoolsDelete, + api.OperationSyncIdentityProvidersRead, + api.OperationSyncIdentityProvidersWrite, + api.OperationSyncIdentityProvidersDelete, + api.OperationOpenShiftClusterGetDetectors, + }, + }, + SyncSetConverter: syncSetConverter{}, + MachinePoolConverter: machinePoolConverter{}, + SyncIdentityProviderConverter: syncIdentityProviderConverter{}, + SecretConverter: secretConverter{}, + ClusterManagerStaticValidator: clusterManagerStaticValidator{}, + } +} diff --git a/pkg/api/v20231122/secret_convert.go b/pkg/api/v20231122/secret_convert.go new file mode 100644 index 00000000000..15fabb857fa --- /dev/null +++ b/pkg/api/v20231122/secret_convert.go @@ -0,0 +1,38 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +type secretConverter struct{} + +func (c secretConverter) ToExternal(s *api.Secret) interface{} { + out := new(Secret) + out.proxyResource = true + out.ID = s.ID + out.Name = s.Name + out.Type = s.Type + return out +} + +func (c secretConverter) ToInternal(_s interface{}, out *api.Secret) { + ocm := _s.(*api.Secret) + out.ID = ocm.ID +} + +// ToExternalList returns a slice of external representations of the internal objects +func (c secretConverter) ToExternalList(s []*api.Secret) interface{} { + l := &SecretList{ + Secrets: make([]*Secret, 0, len(s)), + } + + for _, secrets := range s { + c := c.ToExternal(secrets) + l.Secrets = append(l.Secrets, c.(*Secret)) + } + + return l +} diff --git a/pkg/api/v20231122/secret_example.go b/pkg/api/v20231122/secret_example.go new file mode 100644 index 00000000000..397fa8d128a --- /dev/null +++ b/pkg/api/v20231122/secret_example.go @@ -0,0 +1,38 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +func exampleSecret() *Secret { + doc := api.ExampleClusterManagerConfigurationDocumentSecret() + ext := (&secretConverter{}).ToExternal(doc.Secret) + return ext.(*Secret) +} + +func ExampleSecretPutParameter() interface{} { + s := exampleSecret() + s.ID = "" + s.Type = "" + s.Name = "" + return s +} + +func ExampleSecretPatchParameter() interface{} { + return ExampleSecretPutParameter() +} + +func ExampleSecretResponse() interface{} { + return exampleSecret() +} + +func ExampleSecretListResponse() interface{} { + return &SecretList{ + Secrets: []*Secret{ + ExampleSecretResponse().(*Secret), + }, + } +} diff --git a/pkg/api/v20231122/syncidentityprovider_convert.go b/pkg/api/v20231122/syncidentityprovider_convert.go new file mode 100644 index 00000000000..e7b5e23c09e --- /dev/null +++ b/pkg/api/v20231122/syncidentityprovider_convert.go @@ -0,0 +1,39 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +type syncIdentityProviderConverter struct{} + +func (c syncIdentityProviderConverter) ToExternal(sip *api.SyncIdentityProvider) interface{} { + out := new(SyncIdentityProvider) + out.proxyResource = true + out.ID = sip.ID + out.Name = sip.Name + out.Type = sip.Type + out.Properties.Resources = sip.Properties.Resources + return out +} + +func (c syncIdentityProviderConverter) ToInternal(_sip interface{}, out *api.SyncIdentityProvider) { + ocm := _sip.(*api.SyncIdentityProvider) + out.ID = ocm.ID +} + +// ToExternalList returns a slice of external representations of the internal objects +func (c syncIdentityProviderConverter) ToExternalList(sip []*api.SyncIdentityProvider) interface{} { + l := &SyncIdentityProviderList{ + SyncIdentityProviders: make([]*SyncIdentityProvider, 0, len(sip)), + } + + for _, syncidentityproviders := range sip { + c := c.ToExternal(syncidentityproviders) + l.SyncIdentityProviders = append(l.SyncIdentityProviders, c.(*SyncIdentityProvider)) + } + + return l +} diff --git a/pkg/api/v20231122/syncidentityprovider_example.go b/pkg/api/v20231122/syncidentityprovider_example.go new file mode 100644 index 00000000000..695f61d64cd --- /dev/null +++ b/pkg/api/v20231122/syncidentityprovider_example.go @@ -0,0 +1,38 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +func exampleSyncIdentityProvider() *SyncIdentityProvider { + doc := api.ExampleClusterManagerConfigurationDocumentSyncIdentityProvider() + ext := (&syncIdentityProviderConverter{}).ToExternal(doc.SyncIdentityProvider) + return ext.(*SyncIdentityProvider) +} + +func ExampleSyncIdentityProviderPutParameter() interface{} { + sip := exampleSyncIdentityProvider() + sip.ID = "" + sip.Type = "" + sip.Name = "" + return sip +} + +func ExampleSyncIdentityProviderPatchParameter() interface{} { + return ExampleSyncIdentityProviderPutParameter() +} + +func ExampleSyncIdentityProviderResponse() interface{} { + return exampleSyncIdentityProvider() +} + +func ExampleSyncIdentityProviderListResponse() interface{} { + return &SyncIdentityProviderList{ + SyncIdentityProviders: []*SyncIdentityProvider{ + ExampleSyncIdentityProviderResponse().(*SyncIdentityProvider), + }, + } +} diff --git a/pkg/api/v20231122/syncset_convert.go b/pkg/api/v20231122/syncset_convert.go new file mode 100644 index 00000000000..1655872481e --- /dev/null +++ b/pkg/api/v20231122/syncset_convert.go @@ -0,0 +1,39 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +type syncSetConverter struct{} + +func (c syncSetConverter) ToExternal(ss *api.SyncSet) interface{} { + out := new(SyncSet) + out.proxyResource = true + out.ID = ss.ID + out.Name = ss.Name + out.Type = ss.Type + out.Properties.Resources = ss.Properties.Resources + return out +} + +func (c syncSetConverter) ToInternal(_ss interface{}, out *api.SyncSet) { + ocm := _ss.(*api.SyncSet) + out.ID = ocm.ID +} + +// ToExternalList returns a slice of external representations of the internal objects +func (c syncSetConverter) ToExternalList(ss []*api.SyncSet) interface{} { + l := &SyncSetList{ + SyncSets: make([]*SyncSet, 0, len(ss)), + } + + for _, syncset := range ss { + c := c.ToExternal(syncset) + l.SyncSets = append(l.SyncSets, c.(*SyncSet)) + } + + return l +} diff --git a/pkg/api/v20231122/syncset_example.go b/pkg/api/v20231122/syncset_example.go new file mode 100644 index 00000000000..a985baba766 --- /dev/null +++ b/pkg/api/v20231122/syncset_example.go @@ -0,0 +1,38 @@ +package v20231122 + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "github.com/Azure/ARO-RP/pkg/api" +) + +func exampleSyncSet() *SyncSet { + doc := api.ExampleClusterManagerConfigurationDocumentSyncSet() + ext := (&syncSetConverter{}).ToExternal(doc.SyncSet) + return ext.(*SyncSet) +} + +func ExampleSyncSetPutParameter() interface{} { + ss := exampleSyncSet() + ss.ID = "" + ss.Type = "" + ss.Name = "" + return ss +} + +func ExampleSyncSetPatchParameter() interface{} { + return ExampleSyncSetPutParameter() +} + +func ExampleSyncSetResponse() interface{} { + return exampleSyncSet() +} + +func ExampleSyncSetListResponse() interface{} { + return &SyncSetList{ + SyncSets: []*SyncSet{ + ExampleSyncSetResponse().(*SyncSet), + }, + } +} diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/client.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/client.go new file mode 100644 index 00000000000..3abc5fc815a --- /dev/null +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/client.go @@ -0,0 +1,52 @@ +// Package redhatopenshift implements the Azure ARM Redhatopenshift service API version 2023-11-22. +// +// Rest API for Azure Red Hat OpenShift 4 +package redhatopenshift + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Redhatopenshift + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Redhatopenshift. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/enums.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/enums.go new file mode 100644 index 00000000000..0a2ae262792 --- /dev/null +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/enums.go @@ -0,0 +1,137 @@ +package redhatopenshift + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// EncryptionAtHost enumerates the values for encryption at host. +type EncryptionAtHost string + +const ( + // Disabled ... + Disabled EncryptionAtHost = "Disabled" + // Enabled ... + Enabled EncryptionAtHost = "Enabled" +) + +// PossibleEncryptionAtHostValues returns an array of possible values for the EncryptionAtHost const type. +func PossibleEncryptionAtHostValues() []EncryptionAtHost { + return []EncryptionAtHost{Disabled, Enabled} +} + +// FipsValidatedModules enumerates the values for fips validated modules. +type FipsValidatedModules string + +const ( + // FipsValidatedModulesDisabled ... + FipsValidatedModulesDisabled FipsValidatedModules = "Disabled" + // FipsValidatedModulesEnabled ... + FipsValidatedModulesEnabled FipsValidatedModules = "Enabled" +) + +// PossibleFipsValidatedModulesValues returns an array of possible values for the FipsValidatedModules const type. +func PossibleFipsValidatedModulesValues() []FipsValidatedModules { + return []FipsValidatedModules{FipsValidatedModulesDisabled, FipsValidatedModulesEnabled} +} + +// OutboundType enumerates the values for outbound type. +type OutboundType string + +const ( + // Loadbalancer ... + Loadbalancer OutboundType = "Loadbalancer" + // UserDefinedRouting ... + UserDefinedRouting OutboundType = "UserDefinedRouting" +) + +// PossibleOutboundTypeValues returns an array of possible values for the OutboundType const type. +func PossibleOutboundTypeValues() []OutboundType { + return []OutboundType{Loadbalancer, UserDefinedRouting} +} + +// PreconfiguredNSG enumerates the values for preconfigured nsg. +type PreconfiguredNSG string + +const ( + // PreconfiguredNSGDisabled ... + PreconfiguredNSGDisabled PreconfiguredNSG = "Disabled" + // PreconfiguredNSGEnabled ... + PreconfiguredNSGEnabled PreconfiguredNSG = "Enabled" +) + +// PossiblePreconfiguredNSGValues returns an array of possible values for the PreconfiguredNSG const type. +func PossiblePreconfiguredNSGValues() []PreconfiguredNSG { + return []PreconfiguredNSG{PreconfiguredNSGDisabled, PreconfiguredNSGEnabled} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // AdminUpdating ... + AdminUpdating ProvisioningState = "AdminUpdating" + // Cancelled ... + Cancelled ProvisioningState = "Cancelled" + // Creating ... + Creating ProvisioningState = "Creating" + // Deleting ... + Deleting ProvisioningState = "Deleting" + // Failed ... + Failed ProvisioningState = "Failed" + // Succeeded ... + Succeeded ProvisioningState = "Succeeded" + // Updating ... + Updating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{AdminUpdating, Cancelled, Creating, Deleting, Failed, Succeeded, Updating} +} + +// Visibility enumerates the values for visibility. +type Visibility string + +const ( + // Private ... + Private Visibility = "Private" + // Public ... + Public Visibility = "Public" +) + +// PossibleVisibilityValues returns an array of possible values for the Visibility const type. +func PossibleVisibilityValues() []Visibility { + return []Visibility{Private, Public} +} diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/machinepools.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/machinepools.go new file mode 100644 index 00000000000..67bb027365c --- /dev/null +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/machinepools.go @@ -0,0 +1,561 @@ +package redhatopenshift + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" +) + +// MachinePoolsClient is the rest API for Azure Red Hat OpenShift 4 +type MachinePoolsClient struct { + BaseClient +} + +// NewMachinePoolsClient creates an instance of the MachinePoolsClient client. +func NewMachinePoolsClient(subscriptionID string) MachinePoolsClient { + return NewMachinePoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMachinePoolsClientWithBaseURI creates an instance of the MachinePoolsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewMachinePoolsClientWithBaseURI(baseURI string, subscriptionID string) MachinePoolsClient { + return MachinePoolsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate the operation returns properties of a MachinePool. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the MachinePool resource. +// parameters - the MachinePool resource. +func (client MachinePoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters MachinePool) (result MachinePool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.MachinePoolsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client MachinePoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters MachinePool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client MachinePoolsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client MachinePoolsClient) CreateOrUpdateResponder(resp *http.Response) (result MachinePool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the operation returns nothing. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the MachinePool resource. +func (client MachinePoolsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.MachinePoolsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, childResourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MachinePoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client MachinePoolsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MachinePoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get the operation returns properties of a MachinePool. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the MachinePool resource. +func (client MachinePoolsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result MachinePool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.MachinePoolsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, childResourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MachinePoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MachinePoolsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MachinePoolsClient) GetResponder(resp *http.Response) (result MachinePool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the operation returns properties of each MachinePool. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +func (client MachinePoolsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result MachinePoolListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolsClient.List") + defer func() { + sc := -1 + if result.mpl.Response.Response != nil { + sc = result.mpl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.MachinePoolsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mpl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "List", resp, "Failure sending request") + return + } + + result.mpl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "List", resp, "Failure responding to request") + return + } + if result.mpl.hasNextLink() && result.mpl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MachinePoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/machinePools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client MachinePoolsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client MachinePoolsClient) ListResponder(resp *http.Response) (result MachinePoolList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client MachinePoolsClient) listNextResults(ctx context.Context, lastResults MachinePoolList) (result MachinePoolList, err error) { + req, err := lastResults.machinePoolListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client MachinePoolsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result MachinePoolListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} + +// Update the operation returns properties of a MachinePool. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the MachinePool resource. +// parameters - the MachinePool resource. +func (client MachinePoolsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters MachinePoolUpdate) (result MachinePool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.MachinePoolsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.MachinePoolsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client MachinePoolsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters MachinePoolUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client MachinePoolsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client MachinePoolsClient) UpdateResponder(resp *http.Response) (result MachinePool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/models.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/models.go new file mode 100644 index 00000000000..384b598fcd1 --- /dev/null +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/models.go @@ -0,0 +1,2459 @@ +package redhatopenshift + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift" + +// APIServerProfile aPIServerProfile represents an API server profile. +type APIServerProfile struct { + // Visibility - API server visibility. Possible values include: 'Private', 'Public' + Visibility Visibility `json:"visibility,omitempty"` + // URL - The URL to access the cluster API server. + URL *string `json:"url,omitempty"` + // IP - The IP of the cluster API server. + IP *string `json:"ip,omitempty"` +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CloudError cloudError represents a cloud error. +type CloudError struct { + // Error - An error response from the service. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody cloudErrorBody represents the body of a cloud error. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// ClusterProfile clusterProfile represents a cluster profile. +type ClusterProfile struct { + // PullSecret - The pull secret for the cluster. + PullSecret *string `json:"pullSecret,omitempty"` + // Domain - The domain for the cluster. + Domain *string `json:"domain,omitempty"` + // Version - The version of the cluster. + Version *string `json:"version,omitempty"` + // ResourceGroupID - The ID of the cluster resource group. + ResourceGroupID *string `json:"resourceGroupId,omitempty"` + // FipsValidatedModules - If FIPS validated crypto modules are used. Possible values include: 'FipsValidatedModulesDisabled', 'FipsValidatedModulesEnabled' + FipsValidatedModules FipsValidatedModules `json:"fipsValidatedModules,omitempty"` +} + +// ConsoleProfile consoleProfile represents a console profile. +type ConsoleProfile struct { + // URL - The URL to access the cluster console. + URL *string `json:"url,omitempty"` +} + +// Display display represents the display details of an operation. +type Display struct { + // Provider - Friendly name of the resource provider. + Provider *string `json:"provider,omitempty"` + // Resource - Resource type on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type: read, write, delete, listKeys/action, etc. + Operation *string `json:"operation,omitempty"` + // Description - Friendly name of the operation. + Description *string `json:"description,omitempty"` +} + +// EffectiveOutboundIP effectiveOutboundIP represents an effective outbound IP resource of the cluster +// public load balancer. +type EffectiveOutboundIP struct { + // ID - The fully qualified Azure resource id of an IP address resource. + ID *string `json:"id,omitempty"` +} + +// IngressProfile ingressProfile represents an ingress profile. +type IngressProfile struct { + // Name - The ingress profile name. + Name *string `json:"name,omitempty"` + // Visibility - Ingress visibility. Possible values include: 'Private', 'Public' + Visibility Visibility `json:"visibility,omitempty"` + // IP - The IP of the ingress. + IP *string `json:"ip,omitempty"` +} + +// LoadBalancerProfile loadBalancerProfile represents the profile of the cluster public load balancer. +type LoadBalancerProfile struct { + // ManagedOutboundIps - The desired managed outbound IPs for the cluster public load balancer. + ManagedOutboundIps *ManagedOutboundIPs `json:"managedOutboundIps,omitempty"` + // EffectiveOutboundIps - READ-ONLY; The list of effective outbound IP addresses of the public load balancer. + EffectiveOutboundIps *[]EffectiveOutboundIP `json:"effectiveOutboundIps,omitempty"` + // OutboundIps - The desired outbound IP resources for the cluster load balancer. + OutboundIps *[]OutboundIP `json:"outboundIps,omitempty"` + // OutboundIPPrefixes - The desired outbound IP Prefix resources for the cluster load balancer. + OutboundIPPrefixes *[]OutboundIPPrefix `json:"outboundIpPrefixes,omitempty"` + // AllocatedOutboundPorts - The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 1024. + AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerProfile. +func (lbp LoadBalancerProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbp.ManagedOutboundIps != nil { + objectMap["managedOutboundIps"] = lbp.ManagedOutboundIps + } + if lbp.OutboundIps != nil { + objectMap["outboundIps"] = lbp.OutboundIps + } + if lbp.OutboundIPPrefixes != nil { + objectMap["outboundIpPrefixes"] = lbp.OutboundIPPrefixes + } + if lbp.AllocatedOutboundPorts != nil { + objectMap["allocatedOutboundPorts"] = lbp.AllocatedOutboundPorts + } + return json.Marshal(objectMap) +} + +// MachinePool machinePool represents a MachinePool +type MachinePool struct { + autorest.Response `json:"-"` + // MachinePoolProperties - The MachinePool Properties + *MachinePoolProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MachinePool. +func (mp MachinePool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.MachinePoolProperties != nil { + objectMap["properties"] = mp.MachinePoolProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MachinePool struct. +func (mp *MachinePool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var machinePoolProperties MachinePoolProperties + err = json.Unmarshal(*v, &machinePoolProperties) + if err != nil { + return err + } + mp.MachinePoolProperties = &machinePoolProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mp.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mp.SystemData = &systemData + } + } + } + + return nil +} + +// MachinePoolList machinePoolList represents a list of MachinePools +type MachinePoolList struct { + autorest.Response `json:"-"` + // Value - The list of Machine Pools. + Value *[]MachinePool `json:"value,omitempty"` + // NextLink - The link used to get the next page of operations. + NextLink *string `json:"nextLink,omitempty"` +} + +// MachinePoolListIterator provides access to a complete listing of MachinePool values. +type MachinePoolListIterator struct { + i int + page MachinePoolListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MachinePoolListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MachinePoolListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MachinePoolListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MachinePoolListIterator) Response() MachinePoolList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MachinePoolListIterator) Value() MachinePool { + if !iter.page.NotDone() { + return MachinePool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MachinePoolListIterator type. +func NewMachinePoolListIterator(page MachinePoolListPage) MachinePoolListIterator { + return MachinePoolListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mpl MachinePoolList) IsEmpty() bool { + return mpl.Value == nil || len(*mpl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mpl MachinePoolList) hasNextLink() bool { + return mpl.NextLink != nil && len(*mpl.NextLink) != 0 +} + +// machinePoolListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mpl MachinePoolList) machinePoolListPreparer(ctx context.Context) (*http.Request, error) { + if !mpl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mpl.NextLink))) +} + +// MachinePoolListPage contains a page of MachinePool values. +type MachinePoolListPage struct { + fn func(context.Context, MachinePoolList) (MachinePoolList, error) + mpl MachinePoolList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MachinePoolListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MachinePoolListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mpl) + if err != nil { + return err + } + page.mpl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MachinePoolListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MachinePoolListPage) NotDone() bool { + return !page.mpl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MachinePoolListPage) Response() MachinePoolList { + return page.mpl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MachinePoolListPage) Values() []MachinePool { + if page.mpl.IsEmpty() { + return nil + } + return *page.mpl.Value +} + +// Creates a new instance of the MachinePoolListPage type. +func NewMachinePoolListPage(cur MachinePoolList, getNextPage func(context.Context, MachinePoolList) (MachinePoolList, error)) MachinePoolListPage { + return MachinePoolListPage{ + fn: getNextPage, + mpl: cur, + } +} + +// MachinePoolProperties machinePoolProperties represents the properties of a MachinePool +type MachinePoolProperties struct { + Resources *string `json:"resources,omitempty"` +} + +// MachinePoolUpdate machinePool represents a MachinePool +type MachinePoolUpdate struct { + // MachinePoolProperties - The MachinePool Properties + *MachinePoolProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for MachinePoolUpdate. +func (mpu MachinePoolUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mpu.MachinePoolProperties != nil { + objectMap["properties"] = mpu.MachinePoolProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MachinePoolUpdate struct. +func (mpu *MachinePoolUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var machinePoolProperties MachinePoolProperties + err = json.Unmarshal(*v, &machinePoolProperties) + if err != nil { + return err + } + mpu.MachinePoolProperties = &machinePoolProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mpu.SystemData = &systemData + } + } + } + + return nil +} + +// ManagedOutboundIPs managedOutboundIPs represents the desired managed outbound IPs for the cluster public +// load balancer. +type ManagedOutboundIPs struct { + // Count - Count represents the desired number of IPv4 outbound IPs created and managed by Azure for the cluster public load balancer. Allowed values are in the range of 1 - 20. The default value is 1. + Count *int32 `json:"count,omitempty"` +} + +// MasterProfile masterProfile represents a master profile. +type MasterProfile struct { + // VMSize - The size of the master VMs. + VMSize *string `json:"vmSize,omitempty"` + // SubnetID - The Azure resource ID of the master subnet. + SubnetID *string `json:"subnetId,omitempty"` + // EncryptionAtHost - Whether master virtual machines are encrypted at host. Possible values include: 'Disabled', 'Enabled' + EncryptionAtHost EncryptionAtHost `json:"encryptionAtHost,omitempty"` + // DiskEncryptionSetID - The resource ID of an associated DiskEncryptionSet, if applicable. + DiskEncryptionSetID *string `json:"diskEncryptionSetId,omitempty"` +} + +// NetworkProfile networkProfile represents a network profile. +type NetworkProfile struct { + // PodCidr - The CIDR used for OpenShift/Kubernetes Pods. + PodCidr *string `json:"podCidr,omitempty"` + // ServiceCidr - The CIDR used for OpenShift/Kubernetes Services. + ServiceCidr *string `json:"serviceCidr,omitempty"` + // OutboundType - The OutboundType used for egress traffic. Possible values include: 'Loadbalancer', 'UserDefinedRouting' + OutboundType OutboundType `json:"outboundType,omitempty"` + // LoadBalancerProfile - The cluster load balancer profile. + LoadBalancerProfile *LoadBalancerProfile `json:"loadBalancerProfile,omitempty"` + // PreconfiguredNSG - Specifies whether subnets are pre-attached with an NSG. Possible values include: 'PreconfiguredNSGDisabled', 'PreconfiguredNSGEnabled' + PreconfiguredNSG PreconfiguredNSG `json:"preconfiguredNSG,omitempty"` +} + +// OpenShiftCluster openShiftCluster represents an Azure Red Hat OpenShift cluster. +type OpenShiftCluster struct { + autorest.Response `json:"-"` + // OpenShiftClusterProperties - The cluster properties. + *OpenShiftClusterProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for OpenShiftCluster. +func (osc OpenShiftCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if osc.OpenShiftClusterProperties != nil { + objectMap["properties"] = osc.OpenShiftClusterProperties + } + if osc.Tags != nil { + objectMap["tags"] = osc.Tags + } + if osc.Location != nil { + objectMap["location"] = osc.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OpenShiftCluster struct. +func (osc *OpenShiftCluster) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var openShiftClusterProperties OpenShiftClusterProperties + err = json.Unmarshal(*v, &openShiftClusterProperties) + if err != nil { + return err + } + osc.OpenShiftClusterProperties = &openShiftClusterProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + osc.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + osc.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + osc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + osc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + osc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + osc.SystemData = &systemData + } + } + } + + return nil +} + +// OpenShiftClusterAdminKubeconfig openShiftClusterAdminKubeconfig represents an OpenShift cluster's admin +// kubeconfig. +type OpenShiftClusterAdminKubeconfig struct { + autorest.Response `json:"-"` + // Kubeconfig - The base64-encoded kubeconfig file. + Kubeconfig *string `json:"kubeconfig,omitempty"` +} + +// OpenShiftClusterCredentials openShiftClusterCredentials represents an OpenShift cluster's credentials. +type OpenShiftClusterCredentials struct { + autorest.Response `json:"-"` + // KubeadminUsername - The username for the kubeadmin user. + KubeadminUsername *string `json:"kubeadminUsername,omitempty"` + // KubeadminPassword - The password for the kubeadmin user. + KubeadminPassword *string `json:"kubeadminPassword,omitempty"` +} + +// OpenShiftClusterList openShiftClusterList represents a list of OpenShift clusters. +type OpenShiftClusterList struct { + autorest.Response `json:"-"` + // Value - The list of OpenShift clusters. + Value *[]OpenShiftCluster `json:"value,omitempty"` + // NextLink - The link used to get the next page of operations. + NextLink *string `json:"nextLink,omitempty"` +} + +// OpenShiftClusterListIterator provides access to a complete listing of OpenShiftCluster values. +type OpenShiftClusterListIterator struct { + i int + page OpenShiftClusterListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OpenShiftClusterListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClusterListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OpenShiftClusterListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OpenShiftClusterListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OpenShiftClusterListIterator) Response() OpenShiftClusterList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OpenShiftClusterListIterator) Value() OpenShiftCluster { + if !iter.page.NotDone() { + return OpenShiftCluster{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OpenShiftClusterListIterator type. +func NewOpenShiftClusterListIterator(page OpenShiftClusterListPage) OpenShiftClusterListIterator { + return OpenShiftClusterListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oscl OpenShiftClusterList) IsEmpty() bool { + return oscl.Value == nil || len(*oscl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (oscl OpenShiftClusterList) hasNextLink() bool { + return oscl.NextLink != nil && len(*oscl.NextLink) != 0 +} + +// openShiftClusterListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oscl OpenShiftClusterList) openShiftClusterListPreparer(ctx context.Context) (*http.Request, error) { + if !oscl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oscl.NextLink))) +} + +// OpenShiftClusterListPage contains a page of OpenShiftCluster values. +type OpenShiftClusterListPage struct { + fn func(context.Context, OpenShiftClusterList) (OpenShiftClusterList, error) + oscl OpenShiftClusterList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OpenShiftClusterListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClusterListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.oscl) + if err != nil { + return err + } + page.oscl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OpenShiftClusterListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OpenShiftClusterListPage) NotDone() bool { + return !page.oscl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OpenShiftClusterListPage) Response() OpenShiftClusterList { + return page.oscl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OpenShiftClusterListPage) Values() []OpenShiftCluster { + if page.oscl.IsEmpty() { + return nil + } + return *page.oscl.Value +} + +// Creates a new instance of the OpenShiftClusterListPage type. +func NewOpenShiftClusterListPage(cur OpenShiftClusterList, getNextPage func(context.Context, OpenShiftClusterList) (OpenShiftClusterList, error)) OpenShiftClusterListPage { + return OpenShiftClusterListPage{ + fn: getNextPage, + oscl: cur, + } +} + +// OpenShiftClusterProperties openShiftClusterProperties represents an OpenShift cluster's properties. +type OpenShiftClusterProperties struct { + // ProvisioningState - The cluster provisioning state. Possible values include: 'AdminUpdating', 'Cancelled', 'Creating', 'Deleting', 'Failed', 'Succeeded', 'Updating' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ClusterProfile - The cluster profile. + ClusterProfile *ClusterProfile `json:"clusterProfile,omitempty"` + // ConsoleProfile - The console profile. + ConsoleProfile *ConsoleProfile `json:"consoleProfile,omitempty"` + // ServicePrincipalProfile - The cluster service principal profile. + ServicePrincipalProfile *ServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"` + // NetworkProfile - The cluster network profile. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // MasterProfile - The cluster master profile. + MasterProfile *MasterProfile `json:"masterProfile,omitempty"` + // WorkerProfiles - The cluster worker profiles. + WorkerProfiles *[]WorkerProfile `json:"workerProfiles,omitempty"` + // WorkerProfilesStatus - READ-ONLY; The cluster worker profiles status. + WorkerProfilesStatus *[]WorkerProfile `json:"workerProfilesStatus,omitempty"` + // ApiserverProfile - The cluster API server profile. + ApiserverProfile *APIServerProfile `json:"apiserverProfile,omitempty"` + // IngressProfiles - The cluster ingress profiles. + IngressProfiles *[]IngressProfile `json:"ingressProfiles,omitempty"` +} + +// MarshalJSON is the custom marshaler for OpenShiftClusterProperties. +func (oscp OpenShiftClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oscp.ProvisioningState != "" { + objectMap["provisioningState"] = oscp.ProvisioningState + } + if oscp.ClusterProfile != nil { + objectMap["clusterProfile"] = oscp.ClusterProfile + } + if oscp.ConsoleProfile != nil { + objectMap["consoleProfile"] = oscp.ConsoleProfile + } + if oscp.ServicePrincipalProfile != nil { + objectMap["servicePrincipalProfile"] = oscp.ServicePrincipalProfile + } + if oscp.NetworkProfile != nil { + objectMap["networkProfile"] = oscp.NetworkProfile + } + if oscp.MasterProfile != nil { + objectMap["masterProfile"] = oscp.MasterProfile + } + if oscp.WorkerProfiles != nil { + objectMap["workerProfiles"] = oscp.WorkerProfiles + } + if oscp.ApiserverProfile != nil { + objectMap["apiserverProfile"] = oscp.ApiserverProfile + } + if oscp.IngressProfiles != nil { + objectMap["ingressProfiles"] = oscp.IngressProfiles + } + return json.Marshal(objectMap) +} + +// OpenShiftClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type OpenShiftClustersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OpenShiftClustersClient) (OpenShiftCluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OpenShiftClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OpenShiftClustersCreateOrUpdateFuture.Result. +func (future *OpenShiftClustersCreateOrUpdateFuture) result(client OpenShiftClustersClient) (osc OpenShiftCluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + osc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("redhatopenshift.OpenShiftClustersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osc.Response.Response, err = future.GetResult(sender); err == nil && osc.Response.Response.StatusCode != http.StatusNoContent { + osc, err = client.CreateOrUpdateResponder(osc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersCreateOrUpdateFuture", "Result", osc.Response.Response, "Failure responding to request") + } + } + return +} + +// OpenShiftClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OpenShiftClustersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OpenShiftClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OpenShiftClustersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OpenShiftClustersDeleteFuture.Result. +func (future *OpenShiftClustersDeleteFuture) result(client OpenShiftClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("redhatopenshift.OpenShiftClustersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// OpenShiftClustersUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OpenShiftClustersUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OpenShiftClustersClient) (OpenShiftCluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OpenShiftClustersUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OpenShiftClustersUpdateFuture.Result. +func (future *OpenShiftClustersUpdateFuture) result(client OpenShiftClustersClient) (osc OpenShiftCluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + osc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("redhatopenshift.OpenShiftClustersUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if osc.Response.Response, err = future.GetResult(sender); err == nil && osc.Response.Response.StatusCode != http.StatusNoContent { + osc, err = client.UpdateResponder(osc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersUpdateFuture", "Result", osc.Response.Response, "Failure responding to request") + } + } + return +} + +// OpenShiftClusterUpdate openShiftCluster represents an Azure Red Hat OpenShift cluster. +type OpenShiftClusterUpdate struct { + // Tags - The resource tags. + Tags map[string]*string `json:"tags"` + // OpenShiftClusterProperties - The cluster properties. + *OpenShiftClusterProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for OpenShiftClusterUpdate. +func (oscu OpenShiftClusterUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oscu.Tags != nil { + objectMap["tags"] = oscu.Tags + } + if oscu.OpenShiftClusterProperties != nil { + objectMap["properties"] = oscu.OpenShiftClusterProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OpenShiftClusterUpdate struct. +func (oscu *OpenShiftClusterUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + oscu.Tags = tags + } + case "properties": + if v != nil { + var openShiftClusterProperties OpenShiftClusterProperties + err = json.Unmarshal(*v, &openShiftClusterProperties) + if err != nil { + return err + } + oscu.OpenShiftClusterProperties = &openShiftClusterProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + oscu.SystemData = &systemData + } + } + } + + return nil +} + +// OpenShiftVersion openShiftVersion represents an OpenShift version that can be installed. +type OpenShiftVersion struct { + // OpenShiftVersionProperties - The properties for the OpenShiftVersion resource. + *OpenShiftVersionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for OpenShiftVersion. +func (osv OpenShiftVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if osv.OpenShiftVersionProperties != nil { + objectMap["properties"] = osv.OpenShiftVersionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OpenShiftVersion struct. +func (osv *OpenShiftVersion) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var openShiftVersionProperties OpenShiftVersionProperties + err = json.Unmarshal(*v, &openShiftVersionProperties) + if err != nil { + return err + } + osv.OpenShiftVersionProperties = &openShiftVersionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + osv.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + osv.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + osv.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + osv.SystemData = &systemData + } + } + } + + return nil +} + +// OpenShiftVersionList openShiftVersionList represents a List of available versions. +type OpenShiftVersionList struct { + autorest.Response `json:"-"` + // Value - The List of available versions. + Value *[]OpenShiftVersion `json:"value,omitempty"` + // NextLink - Next Link to next operation. + NextLink *string `json:"nextLink,omitempty"` +} + +// OpenShiftVersionListIterator provides access to a complete listing of OpenShiftVersion values. +type OpenShiftVersionListIterator struct { + i int + page OpenShiftVersionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OpenShiftVersionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftVersionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OpenShiftVersionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OpenShiftVersionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OpenShiftVersionListIterator) Response() OpenShiftVersionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OpenShiftVersionListIterator) Value() OpenShiftVersion { + if !iter.page.NotDone() { + return OpenShiftVersion{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OpenShiftVersionListIterator type. +func NewOpenShiftVersionListIterator(page OpenShiftVersionListPage) OpenShiftVersionListIterator { + return OpenShiftVersionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (osvl OpenShiftVersionList) IsEmpty() bool { + return osvl.Value == nil || len(*osvl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (osvl OpenShiftVersionList) hasNextLink() bool { + return osvl.NextLink != nil && len(*osvl.NextLink) != 0 +} + +// openShiftVersionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (osvl OpenShiftVersionList) openShiftVersionListPreparer(ctx context.Context) (*http.Request, error) { + if !osvl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(osvl.NextLink))) +} + +// OpenShiftVersionListPage contains a page of OpenShiftVersion values. +type OpenShiftVersionListPage struct { + fn func(context.Context, OpenShiftVersionList) (OpenShiftVersionList, error) + osvl OpenShiftVersionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OpenShiftVersionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftVersionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.osvl) + if err != nil { + return err + } + page.osvl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OpenShiftVersionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OpenShiftVersionListPage) NotDone() bool { + return !page.osvl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OpenShiftVersionListPage) Response() OpenShiftVersionList { + return page.osvl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OpenShiftVersionListPage) Values() []OpenShiftVersion { + if page.osvl.IsEmpty() { + return nil + } + return *page.osvl.Value +} + +// Creates a new instance of the OpenShiftVersionListPage type. +func NewOpenShiftVersionListPage(cur OpenShiftVersionList, getNextPage func(context.Context, OpenShiftVersionList) (OpenShiftVersionList, error)) OpenShiftVersionListPage { + return OpenShiftVersionListPage{ + fn: getNextPage, + osvl: cur, + } +} + +// OpenShiftVersionProperties openShiftVersionProperties represents the properties of an OpenShiftVersion. +type OpenShiftVersionProperties struct { + // Version - Version represents the version to create the cluster at. + Version *string `json:"version,omitempty"` +} + +// Operation operation represents an RP operation. +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + // Display - The object that describes the operation. + Display *Display `json:"display,omitempty"` + // Origin - Sources of requests to this operation. Comma separated list with valid values user or system, e.g. "user,system". + Origin *string `json:"origin,omitempty"` +} + +// OperationList operationList represents an RP operation list. +type OperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by the resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - The link used to get the next page of operations. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListIterator provides access to a complete listing of Operation values. +type OperationListIterator struct { + i int + page OperationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListIterator) Response() OperationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListIterator type. +func NewOperationListIterator(page OperationListPage) OperationListIterator { + return OperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ol OperationList) IsEmpty() bool { + return ol.Value == nil || len(*ol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ol OperationList) hasNextLink() bool { + return ol.NextLink != nil && len(*ol.NextLink) != 0 +} + +// operationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) { + if !ol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ol.NextLink))) +} + +// OperationListPage contains a page of Operation values. +type OperationListPage struct { + fn func(context.Context, OperationList) (OperationList, error) + ol OperationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ol) + if err != nil { + return err + } + page.ol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListPage) NotDone() bool { + return !page.ol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListPage) Response() OperationList { + return page.ol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListPage) Values() []Operation { + if page.ol.IsEmpty() { + return nil + } + return *page.ol.Value +} + +// Creates a new instance of the OperationListPage type. +func NewOperationListPage(cur OperationList, getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage { + return OperationListPage{ + fn: getNextPage, + ol: cur, + } +} + +// OutboundIP outboundIP represents a desired outbound IP resource for the cluster load balancer. +type OutboundIP struct { + // ID - The fully qualified Azure resource id of an IP address resource. + ID *string `json:"id,omitempty"` +} + +// OutboundIPPrefix outboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load +// balancer. +type OutboundIPPrefix struct { + // ID - The fully qualified Azure resource id of an IP address resource. + ID *string `json:"id,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Secret secret represents a secret. +type Secret struct { + autorest.Response `json:"-"` + // SecretProperties - The Secret Properties + *SecretProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Secret. +func (s Secret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SecretProperties != nil { + objectMap["properties"] = s.SecretProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Secret struct. +func (s *Secret) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var secretProperties SecretProperties + err = json.Unmarshal(*v, &secretProperties) + if err != nil { + return err + } + s.SecretProperties = &secretProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + s.SystemData = &systemData + } + } + } + + return nil +} + +// SecretList secretList represents a list of Secrets +type SecretList struct { + autorest.Response `json:"-"` + // Value - The list of secrets. + Value *[]Secret `json:"value,omitempty"` + // NextLink - The link used to get the next page of operations. + NextLink *string `json:"nextLink,omitempty"` +} + +// SecretListIterator provides access to a complete listing of Secret values. +type SecretListIterator struct { + i int + page SecretListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecretListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecretListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecretListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecretListIterator) Response() SecretList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecretListIterator) Value() Secret { + if !iter.page.NotDone() { + return Secret{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecretListIterator type. +func NewSecretListIterator(page SecretListPage) SecretListIterator { + return SecretListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sl SecretList) IsEmpty() bool { + return sl.Value == nil || len(*sl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sl SecretList) hasNextLink() bool { + return sl.NextLink != nil && len(*sl.NextLink) != 0 +} + +// secretListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sl SecretList) secretListPreparer(ctx context.Context) (*http.Request, error) { + if !sl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sl.NextLink))) +} + +// SecretListPage contains a page of Secret values. +type SecretListPage struct { + fn func(context.Context, SecretList) (SecretList, error) + sl SecretList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecretListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sl) + if err != nil { + return err + } + page.sl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecretListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecretListPage) NotDone() bool { + return !page.sl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecretListPage) Response() SecretList { + return page.sl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecretListPage) Values() []Secret { + if page.sl.IsEmpty() { + return nil + } + return *page.sl.Value +} + +// Creates a new instance of the SecretListPage type. +func NewSecretListPage(cur SecretList, getNextPage func(context.Context, SecretList) (SecretList, error)) SecretListPage { + return SecretListPage{ + fn: getNextPage, + sl: cur, + } +} + +// SecretProperties secretProperties represents the properties of a Secret +type SecretProperties struct { + // SecretResources - The Secrets Resources. + SecretResources *string `json:"secretResources,omitempty"` +} + +// SecretUpdate secret represents a secret. +type SecretUpdate struct { + // SecretProperties - The Secret Properties + *SecretProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecretUpdate. +func (su SecretUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if su.SecretProperties != nil { + objectMap["properties"] = su.SecretProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecretUpdate struct. +func (su *SecretUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var secretProperties SecretProperties + err = json.Unmarshal(*v, &secretProperties) + if err != nil { + return err + } + su.SecretProperties = &secretProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + su.SystemData = &systemData + } + } + } + + return nil +} + +// ServicePrincipalProfile servicePrincipalProfile represents a service principal profile. +type ServicePrincipalProfile struct { + // ClientID - The client ID used for the cluster. + ClientID *string `json:"clientId,omitempty"` + // ClientSecret - The client secret used for the cluster. + ClientSecret *string `json:"clientSecret,omitempty"` +} + +// SyncIdentityProvider syncIdentityProvider represents a SyncIdentityProvider +type SyncIdentityProvider struct { + autorest.Response `json:"-"` + // SyncIdentityProviderProperties - The SyncIdentityProvider Properties + *SyncIdentityProviderProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SyncIdentityProvider. +func (sip SyncIdentityProvider) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sip.SyncIdentityProviderProperties != nil { + objectMap["properties"] = sip.SyncIdentityProviderProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SyncIdentityProvider struct. +func (sip *SyncIdentityProvider) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var syncIdentityProviderProperties SyncIdentityProviderProperties + err = json.Unmarshal(*v, &syncIdentityProviderProperties) + if err != nil { + return err + } + sip.SyncIdentityProviderProperties = &syncIdentityProviderProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sip.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sip.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sip.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sip.SystemData = &systemData + } + } + } + + return nil +} + +// SyncIdentityProviderList syncSetList represents a list of SyncSets +type SyncIdentityProviderList struct { + autorest.Response `json:"-"` + // Value - The list of sync identity providers + Value *[]SyncIdentityProvider `json:"value,omitempty"` + // NextLink - The link used to get the next page of operations. + NextLink *string `json:"nextLink,omitempty"` +} + +// SyncIdentityProviderListIterator provides access to a complete listing of SyncIdentityProvider values. +type SyncIdentityProviderListIterator struct { + i int + page SyncIdentityProviderListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SyncIdentityProviderListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProviderListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SyncIdentityProviderListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SyncIdentityProviderListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SyncIdentityProviderListIterator) Response() SyncIdentityProviderList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SyncIdentityProviderListIterator) Value() SyncIdentityProvider { + if !iter.page.NotDone() { + return SyncIdentityProvider{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SyncIdentityProviderListIterator type. +func NewSyncIdentityProviderListIterator(page SyncIdentityProviderListPage) SyncIdentityProviderListIterator { + return SyncIdentityProviderListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sipl SyncIdentityProviderList) IsEmpty() bool { + return sipl.Value == nil || len(*sipl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sipl SyncIdentityProviderList) hasNextLink() bool { + return sipl.NextLink != nil && len(*sipl.NextLink) != 0 +} + +// syncIdentityProviderListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sipl SyncIdentityProviderList) syncIdentityProviderListPreparer(ctx context.Context) (*http.Request, error) { + if !sipl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sipl.NextLink))) +} + +// SyncIdentityProviderListPage contains a page of SyncIdentityProvider values. +type SyncIdentityProviderListPage struct { + fn func(context.Context, SyncIdentityProviderList) (SyncIdentityProviderList, error) + sipl SyncIdentityProviderList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SyncIdentityProviderListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProviderListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sipl) + if err != nil { + return err + } + page.sipl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SyncIdentityProviderListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SyncIdentityProviderListPage) NotDone() bool { + return !page.sipl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SyncIdentityProviderListPage) Response() SyncIdentityProviderList { + return page.sipl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SyncIdentityProviderListPage) Values() []SyncIdentityProvider { + if page.sipl.IsEmpty() { + return nil + } + return *page.sipl.Value +} + +// Creates a new instance of the SyncIdentityProviderListPage type. +func NewSyncIdentityProviderListPage(cur SyncIdentityProviderList, getNextPage func(context.Context, SyncIdentityProviderList) (SyncIdentityProviderList, error)) SyncIdentityProviderListPage { + return SyncIdentityProviderListPage{ + fn: getNextPage, + sipl: cur, + } +} + +// SyncIdentityProviderProperties syncSetProperties represents the properties of a SyncSet +type SyncIdentityProviderProperties struct { + Resources *string `json:"resources,omitempty"` +} + +// SyncIdentityProviderUpdate syncIdentityProvider represents a SyncIdentityProvider +type SyncIdentityProviderUpdate struct { + // SyncIdentityProviderProperties - The SyncIdentityProvider Properties + *SyncIdentityProviderProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SyncIdentityProviderUpdate. +func (sipu SyncIdentityProviderUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sipu.SyncIdentityProviderProperties != nil { + objectMap["properties"] = sipu.SyncIdentityProviderProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SyncIdentityProviderUpdate struct. +func (sipu *SyncIdentityProviderUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var syncIdentityProviderProperties SyncIdentityProviderProperties + err = json.Unmarshal(*v, &syncIdentityProviderProperties) + if err != nil { + return err + } + sipu.SyncIdentityProviderProperties = &syncIdentityProviderProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sipu.SystemData = &systemData + } + } + } + + return nil +} + +// SyncSet syncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. +type SyncSet struct { + autorest.Response `json:"-"` + // SyncSetProperties - The Syncsets properties + *SyncSetProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SyncSet. +func (ss SyncSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ss.SyncSetProperties != nil { + objectMap["properties"] = ss.SyncSetProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SyncSet struct. +func (ss *SyncSet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var syncSetProperties SyncSetProperties + err = json.Unmarshal(*v, &syncSetProperties) + if err != nil { + return err + } + ss.SyncSetProperties = &syncSetProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ss.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ss.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ss.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ss.SystemData = &systemData + } + } + } + + return nil +} + +// SyncSetList syncSetList represents a list of SyncSets +type SyncSetList struct { + autorest.Response `json:"-"` + // Value - The list of syncsets. + Value *[]SyncSet `json:"value,omitempty"` + // NextLink - The link used to get the next page of operations. + NextLink *string `json:"nextLink,omitempty"` +} + +// SyncSetListIterator provides access to a complete listing of SyncSet values. +type SyncSetListIterator struct { + i int + page SyncSetListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SyncSetListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SyncSetListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SyncSetListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SyncSetListIterator) Response() SyncSetList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SyncSetListIterator) Value() SyncSet { + if !iter.page.NotDone() { + return SyncSet{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SyncSetListIterator type. +func NewSyncSetListIterator(page SyncSetListPage) SyncSetListIterator { + return SyncSetListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssl SyncSetList) IsEmpty() bool { + return ssl.Value == nil || len(*ssl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ssl SyncSetList) hasNextLink() bool { + return ssl.NextLink != nil && len(*ssl.NextLink) != 0 +} + +// syncSetListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssl SyncSetList) syncSetListPreparer(ctx context.Context) (*http.Request, error) { + if !ssl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ssl.NextLink))) +} + +// SyncSetListPage contains a page of SyncSet values. +type SyncSetListPage struct { + fn func(context.Context, SyncSetList) (SyncSetList, error) + ssl SyncSetList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SyncSetListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ssl) + if err != nil { + return err + } + page.ssl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SyncSetListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SyncSetListPage) NotDone() bool { + return !page.ssl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SyncSetListPage) Response() SyncSetList { + return page.ssl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SyncSetListPage) Values() []SyncSet { + if page.ssl.IsEmpty() { + return nil + } + return *page.ssl.Value +} + +// Creates a new instance of the SyncSetListPage type. +func NewSyncSetListPage(cur SyncSetList, getNextPage func(context.Context, SyncSetList) (SyncSetList, error)) SyncSetListPage { + return SyncSetListPage{ + fn: getNextPage, + ssl: cur, + } +} + +// SyncSetProperties syncSetProperties represents the properties of a SyncSet +type SyncSetProperties struct { + // Resources - Resources represents the SyncSets configuration. + Resources *string `json:"resources,omitempty"` +} + +// SyncSetUpdate syncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. +type SyncSetUpdate struct { + // SyncSetProperties - The Syncsets properties + *SyncSetProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SyncSetUpdate. +func (ssu SyncSetUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ssu.SyncSetProperties != nil { + objectMap["properties"] = ssu.SyncSetProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SyncSetUpdate struct. +func (ssu *SyncSetUpdate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var syncSetProperties SyncSetProperties + err = json.Unmarshal(*v, &syncSetProperties) + if err != nil { + return err + } + ssu.SyncSetProperties = &syncSetProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ssu.SystemData = &systemData + } + } + } + + return nil +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// WorkerProfile workerProfile represents a worker profile. +type WorkerProfile struct { + // Name - The worker profile name. + Name *string `json:"name,omitempty"` + // VMSize - The size of the worker VMs. + VMSize *string `json:"vmSize,omitempty"` + // DiskSizeGB - The disk size of the worker VMs. + DiskSizeGB *int32 `json:"diskSizeGB,omitempty"` + // SubnetID - The Azure resource ID of the worker subnet. + SubnetID *string `json:"subnetId,omitempty"` + // Count - The number of worker VMs. + Count *int32 `json:"count,omitempty"` + // EncryptionAtHost - Whether master virtual machines are encrypted at host. Possible values include: 'Disabled', 'Enabled' + EncryptionAtHost EncryptionAtHost `json:"encryptionAtHost,omitempty"` + // DiskEncryptionSetID - The resource ID of an associated DiskEncryptionSet, if applicable. + DiskEncryptionSetID *string `json:"diskEncryptionSetId,omitempty"` +} diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/openshiftclusters.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/openshiftclusters.go new file mode 100644 index 00000000000..2eb98382af3 --- /dev/null +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/openshiftclusters.go @@ -0,0 +1,814 @@ +package redhatopenshift + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" +) + +// OpenShiftClustersClient is the rest API for Azure Red Hat OpenShift 4 +type OpenShiftClustersClient struct { + BaseClient +} + +// NewOpenShiftClustersClient creates an instance of the OpenShiftClustersClient client. +func NewOpenShiftClustersClient(subscriptionID string) OpenShiftClustersClient { + return NewOpenShiftClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOpenShiftClustersClientWithBaseURI creates an instance of the OpenShiftClustersClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewOpenShiftClustersClientWithBaseURI(baseURI string, subscriptionID string) OpenShiftClustersClient { + return OpenShiftClustersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate the operation returns properties of a OpenShift cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// parameters - the OpenShift cluster resource. +func (client OpenShiftClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters OpenShiftCluster) (result OpenShiftClustersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.OpenShiftClustersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client OpenShiftClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters OpenShiftCluster) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client OpenShiftClustersClient) CreateOrUpdateSender(req *http.Request) (future OpenShiftClustersCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client OpenShiftClustersClient) CreateOrUpdateResponder(resp *http.Response) (result OpenShiftCluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the operation returns nothing. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +func (client OpenShiftClustersClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result OpenShiftClustersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.OpenShiftClustersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OpenShiftClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client OpenShiftClustersClient) DeleteSender(req *http.Request) (future OpenShiftClustersDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client OpenShiftClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get the operation returns properties of a OpenShift cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +func (client OpenShiftClustersClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result OpenShiftCluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.OpenShiftClustersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OpenShiftClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OpenShiftClustersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OpenShiftClustersClient) GetResponder(resp *http.Response) (result OpenShiftCluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the operation returns properties of each OpenShift cluster. +func (client OpenShiftClustersClient) List(ctx context.Context) (result OpenShiftClusterListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.List") + defer func() { + sc := -1 + if result.oscl.Response.Response != nil { + sc = result.oscl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.OpenShiftClustersClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.oscl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "List", resp, "Failure sending request") + return + } + + result.oscl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "List", resp, "Failure responding to request") + return + } + if result.oscl.hasNextLink() && result.oscl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OpenShiftClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OpenShiftClustersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OpenShiftClustersClient) ListResponder(resp *http.Response) (result OpenShiftClusterList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OpenShiftClustersClient) listNextResults(ctx context.Context, lastResults OpenShiftClusterList) (result OpenShiftClusterList, err error) { + req, err := lastResults.openShiftClusterListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OpenShiftClustersClient) ListComplete(ctx context.Context) (result OpenShiftClusterListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListAdminCredentials the operation returns the admin kubeconfig. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +func (client OpenShiftClustersClient) ListAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string) (result OpenShiftClusterAdminKubeconfig, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.ListAdminCredentials") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.OpenShiftClustersClient", "ListAdminCredentials", err.Error()) + } + + req, err := client.ListAdminCredentialsPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "ListAdminCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListAdminCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "ListAdminCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListAdminCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "ListAdminCredentials", resp, "Failure responding to request") + return + } + + return +} + +// ListAdminCredentialsPreparer prepares the ListAdminCredentials request. +func (client OpenShiftClustersClient) ListAdminCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listAdminCredentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAdminCredentialsSender sends the ListAdminCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client OpenShiftClustersClient) ListAdminCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAdminCredentialsResponder handles the response to the ListAdminCredentials request. The method always +// closes the http.Response Body. +func (client OpenShiftClustersClient) ListAdminCredentialsResponder(resp *http.Response) (result OpenShiftClusterAdminKubeconfig, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup the operation returns properties of each OpenShift cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client OpenShiftClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result OpenShiftClusterListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.oscl.Response.Response != nil { + sc = result.oscl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.OpenShiftClustersClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.oscl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.oscl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.oscl.hasNextLink() && result.oscl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client OpenShiftClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client OpenShiftClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client OpenShiftClustersClient) ListByResourceGroupResponder(resp *http.Response) (result OpenShiftClusterList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client OpenShiftClustersClient) listByResourceGroupNextResults(ctx context.Context, lastResults OpenShiftClusterList) (result OpenShiftClusterList, err error) { + req, err := lastResults.openShiftClusterListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client OpenShiftClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result OpenShiftClusterListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListCredentials the operation returns the credentials. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +func (client OpenShiftClustersClient) ListCredentials(ctx context.Context, resourceGroupName string, resourceName string) (result OpenShiftClusterCredentials, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.ListCredentials") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.OpenShiftClustersClient", "ListCredentials", err.Error()) + } + + req, err := client.ListCredentialsPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "ListCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "ListCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "ListCredentials", resp, "Failure responding to request") + return + } + + return +} + +// ListCredentialsPreparer prepares the ListCredentials request. +func (client OpenShiftClustersClient) ListCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listCredentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCredentialsSender sends the ListCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client OpenShiftClustersClient) ListCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListCredentialsResponder handles the response to the ListCredentials request. The method always +// closes the http.Response Body. +func (client OpenShiftClustersClient) ListCredentialsResponder(resp *http.Response) (result OpenShiftClusterCredentials, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update the operation returns properties of a OpenShift cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// parameters - the OpenShift cluster resource. +func (client OpenShiftClustersClient) Update(ctx context.Context, resourceGroupName string, resourceName string, parameters OpenShiftClusterUpdate) (result OpenShiftClustersUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftClustersClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.OpenShiftClustersClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftClustersClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client OpenShiftClustersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters OpenShiftClusterUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client OpenShiftClustersClient) UpdateSender(req *http.Request) (future OpenShiftClustersUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client OpenShiftClustersClient) UpdateResponder(resp *http.Response) (result OpenShiftCluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/openshiftversions.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/openshiftversions.go new file mode 100644 index 00000000000..3fbc454460d --- /dev/null +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/openshiftversions.go @@ -0,0 +1,169 @@ +package redhatopenshift + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" +) + +// OpenShiftVersionsClient is the rest API for Azure Red Hat OpenShift 4 +type OpenShiftVersionsClient struct { + BaseClient +} + +// NewOpenShiftVersionsClient creates an instance of the OpenShiftVersionsClient client. +func NewOpenShiftVersionsClient(subscriptionID string) OpenShiftVersionsClient { + return NewOpenShiftVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOpenShiftVersionsClientWithBaseURI creates an instance of the OpenShiftVersionsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewOpenShiftVersionsClientWithBaseURI(baseURI string, subscriptionID string) OpenShiftVersionsClient { + return OpenShiftVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List the operation returns the installable OpenShift versions as strings. +// Parameters: +// location - the name of Azure region. +func (client OpenShiftVersionsClient) List(ctx context.Context, location string) (result OpenShiftVersionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftVersionsClient.List") + defer func() { + sc := -1 + if result.osvl.Response.Response != nil { + sc = result.osvl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.OpenShiftVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.osvl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftVersionsClient", "List", resp, "Failure sending request") + return + } + + result.osvl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.osvl.hasNextLink() && result.osvl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OpenShiftVersionsClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/openshiftversions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OpenShiftVersionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OpenShiftVersionsClient) ListResponder(resp *http.Response) (result OpenShiftVersionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OpenShiftVersionsClient) listNextResults(ctx context.Context, lastResults OpenShiftVersionList) (result OpenShiftVersionList, err error) { + req, err := lastResults.openShiftVersionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftVersionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OpenShiftVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OpenShiftVersionsClient) ListComplete(ctx context.Context, location string) (result OpenShiftVersionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OpenShiftVersionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/operations.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/operations.go new file mode 100644 index 00000000000..6fecef5a22e --- /dev/null +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/operations.go @@ -0,0 +1,152 @@ +package redhatopenshift + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" +) + +// OperationsClient is the rest API for Azure Red Hat OpenShift 4 +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List the operation returns the RP operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.ol.Response.Response != nil { + sc = result.ol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.ol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.ol.hasNextLink() && result.ol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.RedHatOpenShift/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationList) (result OperationList, err error) { + req, err := lastResults.operationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "redhatopenshift.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redhatopenshift.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/redhatopenshiftapi/interfaces.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/redhatopenshiftapi/interfaces.go new file mode 100644 index 00000000000..e8657e6b012 --- /dev/null +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/redhatopenshiftapi/interfaces.go @@ -0,0 +1,106 @@ +package redhatopenshiftapi + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + + "github.com/Azure/go-autorest/autorest" + + "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result redhatopenshift.OperationListPage, err error) + ListComplete(ctx context.Context) (result redhatopenshift.OperationListIterator, err error) +} + +var _ OperationsClientAPI = (*redhatopenshift.OperationsClient)(nil) + +// OpenShiftVersionsClientAPI contains the set of methods on the OpenShiftVersionsClient type. +type OpenShiftVersionsClientAPI interface { + List(ctx context.Context, location string) (result redhatopenshift.OpenShiftVersionListPage, err error) + ListComplete(ctx context.Context, location string) (result redhatopenshift.OpenShiftVersionListIterator, err error) +} + +var _ OpenShiftVersionsClientAPI = (*redhatopenshift.OpenShiftVersionsClient)(nil) + +// OpenShiftClustersClientAPI contains the set of methods on the OpenShiftClustersClient type. +type OpenShiftClustersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters redhatopenshift.OpenShiftCluster) (result redhatopenshift.OpenShiftClustersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.OpenShiftClustersDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.OpenShiftCluster, err error) + List(ctx context.Context) (result redhatopenshift.OpenShiftClusterListPage, err error) + ListComplete(ctx context.Context) (result redhatopenshift.OpenShiftClusterListIterator, err error) + ListAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.OpenShiftClusterAdminKubeconfig, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result redhatopenshift.OpenShiftClusterListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result redhatopenshift.OpenShiftClusterListIterator, err error) + ListCredentials(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.OpenShiftClusterCredentials, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, parameters redhatopenshift.OpenShiftClusterUpdate) (result redhatopenshift.OpenShiftClustersUpdateFuture, err error) +} + +var _ OpenShiftClustersClientAPI = (*redhatopenshift.OpenShiftClustersClient)(nil) + +// MachinePoolsClientAPI contains the set of methods on the MachinePoolsClient type. +type MachinePoolsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.MachinePool) (result redhatopenshift.MachinePool, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result redhatopenshift.MachinePool, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.MachinePoolListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.MachinePoolListIterator, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.MachinePoolUpdate) (result redhatopenshift.MachinePool, err error) +} + +var _ MachinePoolsClientAPI = (*redhatopenshift.MachinePoolsClient)(nil) + +// SecretsClientAPI contains the set of methods on the SecretsClient type. +type SecretsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.Secret) (result redhatopenshift.Secret, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result redhatopenshift.Secret, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.SecretListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.SecretListIterator, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.SecretUpdate) (result redhatopenshift.Secret, err error) +} + +var _ SecretsClientAPI = (*redhatopenshift.SecretsClient)(nil) + +// SyncIdentityProvidersClientAPI contains the set of methods on the SyncIdentityProvidersClient type. +type SyncIdentityProvidersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.SyncIdentityProvider) (result redhatopenshift.SyncIdentityProvider, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result redhatopenshift.SyncIdentityProvider, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.SyncIdentityProviderListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.SyncIdentityProviderListIterator, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.SyncIdentityProviderUpdate) (result redhatopenshift.SyncIdentityProvider, err error) +} + +var _ SyncIdentityProvidersClientAPI = (*redhatopenshift.SyncIdentityProvidersClient)(nil) + +// SyncSetsClientAPI contains the set of methods on the SyncSetsClient type. +type SyncSetsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.SyncSet) (result redhatopenshift.SyncSet, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result redhatopenshift.SyncSet, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.SyncSetListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result redhatopenshift.SyncSetListIterator, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters redhatopenshift.SyncSetUpdate) (result redhatopenshift.SyncSet, err error) +} + +var _ SyncSetsClientAPI = (*redhatopenshift.SyncSetsClient)(nil) diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/secrets.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/secrets.go new file mode 100644 index 00000000000..347f4b6f135 --- /dev/null +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/secrets.go @@ -0,0 +1,561 @@ +package redhatopenshift + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" +) + +// SecretsClient is the rest API for Azure Red Hat OpenShift 4 +type SecretsClient struct { + BaseClient +} + +// NewSecretsClient creates an instance of the SecretsClient client. +func NewSecretsClient(subscriptionID string) SecretsClient { + return NewSecretsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecretsClientWithBaseURI creates an instance of the SecretsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSecretsClientWithBaseURI(baseURI string, subscriptionID string) SecretsClient { + return SecretsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate the operation returns properties of a Secret. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the Secret resource. +// parameters - the Secret resource. +func (client SecretsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters Secret) (result Secret, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SecretsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SecretsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters Secret) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SecretsClient) CreateOrUpdateResponder(resp *http.Response) (result Secret, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the operation returns nothing. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the Secret resource. +func (client SecretsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SecretsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, childResourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SecretsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SecretsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get the operation returns properties of a Secret. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the Secret resource. +func (client SecretsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result Secret, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SecretsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, childResourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecretsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecretsClient) GetResponder(resp *http.Response) (result Secret, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the operation returns properties of each Secret. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +func (client SecretsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result SecretListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.List") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SecretsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "List", resp, "Failure sending request") + return + } + + result.sl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "List", resp, "Failure responding to request") + return + } + if result.sl.hasNextLink() && result.sl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SecretsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/secrets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SecretsClient) ListResponder(resp *http.Response) (result SecretList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SecretsClient) listNextResults(ctx context.Context, lastResults SecretList) (result SecretList, err error) { + req, err := lastResults.secretListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecretsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result SecretListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} + +// Update the operation returns properties of a Secret. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the Secret resource. +// parameters - the Secret resource. +func (client SecretsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SecretUpdate) (result Secret, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecretsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SecretsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SecretsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SecretsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SecretUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SecretsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SecretsClient) UpdateResponder(resp *http.Response) (result Secret, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/syncidentityproviders.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/syncidentityproviders.go new file mode 100644 index 00000000000..24f4627ad97 --- /dev/null +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/syncidentityproviders.go @@ -0,0 +1,562 @@ +package redhatopenshift + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" +) + +// SyncIdentityProvidersClient is the rest API for Azure Red Hat OpenShift 4 +type SyncIdentityProvidersClient struct { + BaseClient +} + +// NewSyncIdentityProvidersClient creates an instance of the SyncIdentityProvidersClient client. +func NewSyncIdentityProvidersClient(subscriptionID string) SyncIdentityProvidersClient { + return NewSyncIdentityProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSyncIdentityProvidersClientWithBaseURI creates an instance of the SyncIdentityProvidersClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewSyncIdentityProvidersClientWithBaseURI(baseURI string, subscriptionID string) SyncIdentityProvidersClient { + return SyncIdentityProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate the operation returns properties of a SyncIdentityProvider. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the SyncIdentityProvider resource. +// parameters - the SyncIdentityProvider resource. +func (client SyncIdentityProvidersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncIdentityProvider) (result SyncIdentityProvider, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProvidersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SyncIdentityProvidersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SyncIdentityProvidersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncIdentityProvider) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SyncIdentityProvidersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SyncIdentityProvidersClient) CreateOrUpdateResponder(resp *http.Response) (result SyncIdentityProvider, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the operation returns nothing. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the SyncIdentityProvider resource. +func (client SyncIdentityProvidersClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProvidersClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SyncIdentityProvidersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, childResourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SyncIdentityProvidersClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SyncIdentityProvidersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SyncIdentityProvidersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get the operation returns properties of a SyncIdentityProvider. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the SyncIdentityProvider resource. +func (client SyncIdentityProvidersClient) Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result SyncIdentityProvider, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProvidersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SyncIdentityProvidersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, childResourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SyncIdentityProvidersClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SyncIdentityProvidersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SyncIdentityProvidersClient) GetResponder(resp *http.Response) (result SyncIdentityProvider, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the operation returns properties of each SyncIdentityProvider. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +func (client SyncIdentityProvidersClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result SyncIdentityProviderListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProvidersClient.List") + defer func() { + sc := -1 + if result.sipl.Response.Response != nil { + sc = result.sipl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SyncIdentityProvidersClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sipl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "List", resp, "Failure sending request") + return + } + + result.sipl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "List", resp, "Failure responding to request") + return + } + if result.sipl.hasNextLink() && result.sipl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SyncIdentityProvidersClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncIdentityProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SyncIdentityProvidersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SyncIdentityProvidersClient) ListResponder(resp *http.Response) (result SyncIdentityProviderList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SyncIdentityProvidersClient) listNextResults(ctx context.Context, lastResults SyncIdentityProviderList) (result SyncIdentityProviderList, err error) { + req, err := lastResults.syncIdentityProviderListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SyncIdentityProvidersClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result SyncIdentityProviderListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProvidersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} + +// Update the operation returns properties of a SyncIdentityProvider. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the SyncIdentityProvider resource. +// parameters - the SyncIdentityProvider resource. +func (client SyncIdentityProvidersClient) Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncIdentityProviderUpdate) (result SyncIdentityProvider, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncIdentityProvidersClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SyncIdentityProvidersClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncIdentityProvidersClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SyncIdentityProvidersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncIdentityProviderUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SyncIdentityProvidersClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SyncIdentityProvidersClient) UpdateResponder(resp *http.Response) (result SyncIdentityProvider, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/syncsets.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/syncsets.go new file mode 100644 index 00000000000..dbe7250392a --- /dev/null +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/syncsets.go @@ -0,0 +1,561 @@ +package redhatopenshift + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" +) + +// SyncSetsClient is the rest API for Azure Red Hat OpenShift 4 +type SyncSetsClient struct { + BaseClient +} + +// NewSyncSetsClient creates an instance of the SyncSetsClient client. +func NewSyncSetsClient(subscriptionID string) SyncSetsClient { + return NewSyncSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSyncSetsClientWithBaseURI creates an instance of the SyncSetsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSyncSetsClientWithBaseURI(baseURI string, subscriptionID string) SyncSetsClient { + return SyncSetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate the operation returns properties of a SyncSet. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the SyncSet resource. +// parameters - the SyncSet resource. +func (client SyncSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncSet) (result SyncSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SyncSetsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SyncSetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncSet) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SyncSetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SyncSetsClient) CreateOrUpdateResponder(resp *http.Response) (result SyncSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the operation returns nothing. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the SyncSet resource. +func (client SyncSetsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SyncSetsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, childResourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SyncSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SyncSetsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SyncSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get the operation returns properties of a SyncSet. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the SyncSet resource. +func (client SyncSetsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (result SyncSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SyncSetsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, childResourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SyncSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SyncSetsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SyncSetsClient) GetResponder(resp *http.Response) (result SyncSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the operation returns properties of each SyncSet. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +func (client SyncSetsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result SyncSetListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetsClient.List") + defer func() { + sc := -1 + if result.ssl.Response.Response != nil { + sc = result.ssl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SyncSetsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ssl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "List", resp, "Failure sending request") + return + } + + result.ssl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "List", resp, "Failure responding to request") + return + } + if result.ssl.hasNextLink() && result.ssl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SyncSetsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SyncSetsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SyncSetsClient) ListResponder(resp *http.Response) (result SyncSetList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SyncSetsClient) listNextResults(ctx context.Context, lastResults SyncSetList) (result SyncSetList, err error) { + req, err := lastResults.syncSetListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SyncSetsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result SyncSetListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} + +// Update the operation returns properties of a SyncSet. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the OpenShift cluster resource. +// childResourceName - the name of the SyncSet resource. +// parameters - the SyncSet resource. +func (client SyncSetsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncSetUpdate) (result SyncSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SyncSetsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: childResourceName, + Constraints: []validation.Constraint{{Target: "childResourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "childResourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "childResourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("redhatopenshift.SyncSetsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, childResourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "redhatopenshift.SyncSetsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SyncSetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, childResourceName string, parameters SyncSetUpdate) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "childResourceName": autorest.Encode("path", childResourceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2023-11-22" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client SyncSetsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client SyncSetsClient) UpdateResponder(resp *http.Response) (result SyncSet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/version.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/version.go new file mode 100644 index 00000000000..bcef143e938 --- /dev/null +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/version.go @@ -0,0 +1,28 @@ +package redhatopenshift + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " redhatopenshift/2023-11-22" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "0.0.0" +} diff --git a/pkg/swagger/generator.go b/pkg/swagger/generator.go index 1a24a88b0e7..98d5b839c47 100644 --- a/pkg/swagger/generator.go +++ b/pkg/swagger/generator.go @@ -14,6 +14,7 @@ import ( v20230401 "github.com/Azure/ARO-RP/pkg/api/v20230401" v20230701preview "github.com/Azure/ARO-RP/pkg/api/v20230701preview" v20230904 "github.com/Azure/ARO-RP/pkg/api/v20230904" + v20231122 "github.com/Azure/ARO-RP/pkg/api/v20231122" ) const apiv20200430Path = "github.com/Azure/ARO-RP/pkg/api/v20200430" @@ -23,6 +24,7 @@ const apiv20220904Path = "github.com/Azure/ARO-RP/pkg/api/v20220904" const apiv20230401Path = "github.com/Azure/ARO-RP/pkg/api/v20230401" const apiv20230701previewPath = "github.com/Azure/ARO-RP/pkg/api/v20230701preview" const apiv20230904Path = "github.com/Azure/ARO-RP/pkg/api/v20230904" +const apiv20231122Path = "github.com/Azure/ARO-RP/pkg/api/v20231122" type generator struct { exampleSyncSetPutParameter func() interface{} @@ -238,6 +240,43 @@ var apis = map[string]*generator{ exampleOpenShiftVersionListResponse: v20230904.ExampleOpenShiftVersionListResponse, exampleOperationListResponse: api.ExampleOperationListResponse, + xmsEnum: []string{"EncryptionAtHost", "FipsValidatedModules", "SoftwareDefinedNetwork", "Visibility", "OutboundType"}, + xmsSecretList: []string{"kubeconfig", "kubeadminPassword", "secretResources"}, + xmsIdentifiers: []string{}, + commonTypesVersion: "v3", + systemData: true, + clusterManager: true, + installVersionList: true, + kubeConfig: true, + workerProfilesStatus: true, + }, + apiv20231122Path: { + exampleSyncSetPutParameter: v20231122.ExampleSyncSetPutParameter, + exampleSyncSetPatchParameter: v20231122.ExampleSyncSetPatchParameter, + exampleSyncSetResponse: v20231122.ExampleSyncSetResponse, + exampleSyncSetListResponse: v20231122.ExampleSyncSetListResponse, + exampleMachinePoolPutParameter: v20231122.ExampleMachinePoolPutParameter, + exampleMachinePoolPatchParameter: v20231122.ExampleMachinePoolPatchParameter, + exampleMachinePoolResponse: v20231122.ExampleMachinePoolResponse, + exampleMachinePoolListResponse: v20231122.ExampleMachinePoolListResponse, + exampleSyncIdentityProviderPutParameter: v20231122.ExampleSyncIdentityProviderPutParameter, + exampleSyncIdentityProviderPatchParameter: v20231122.ExampleSyncIdentityProviderPatchParameter, + exampleSyncIdentityProviderResponse: v20231122.ExampleSyncIdentityProviderResponse, + exampleSyncIdentityProviderListResponse: v20231122.ExampleSyncIdentityProviderListResponse, + exampleSecretPutParameter: v20231122.ExampleSecretPutParameter, + exampleSecretPatchParameter: v20231122.ExampleSecretPatchParameter, + exampleSecretResponse: v20231122.ExampleSecretResponse, + exampleSecretListResponse: v20231122.ExampleSecretListResponse, + exampleOpenShiftClusterPutParameter: v20231122.ExampleOpenShiftClusterPutParameter, + exampleOpenShiftClusterPatchParameter: v20231122.ExampleOpenShiftClusterPatchParameter, + exampleOpenShiftClusterGetResponse: v20231122.ExampleOpenShiftClusterGetResponse, + exampleOpenShiftClusterPutOrPatchResponse: v20231122.ExampleOpenShiftClusterPutOrPatchResponse, + exampleOpenShiftClusterCredentialsResponse: v20231122.ExampleOpenShiftClusterCredentialsResponse, + exampleOpenShiftClusterListResponse: v20231122.ExampleOpenShiftClusterListResponse, + exampleOpenShiftClusterAdminKubeconfigResponse: v20231122.ExampleOpenShiftClusterAdminKubeconfigResponse, + exampleOpenShiftVersionListResponse: v20231122.ExampleOpenShiftVersionListResponse, + exampleOperationListResponse: api.ExampleOperationListResponse, + xmsEnum: []string{"EncryptionAtHost", "FipsValidatedModules", "SoftwareDefinedNetwork", "Visibility", "OutboundType"}, xmsSecretList: []string{"kubeconfig", "kubeadminPassword", "secretResources"}, xmsIdentifiers: []string{}, diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/__init__.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/__init__.py new file mode 100644 index 00000000000..530d3ea7f10 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient +__all__ = ['AzureRedHatOpenShiftClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/_azure_red_hat_open_shift_client.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/_azure_red_hat_open_shift_client.py new file mode 100644 index 00000000000..ace512c90f2 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/_azure_red_hat_open_shift_client.py @@ -0,0 +1,131 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import AzureRedHatOpenShiftClientConfiguration +from .operations import MachinePoolsOperations, OpenShiftClustersOperations, OpenShiftVersionsOperations, Operations, SecretsOperations, SyncIdentityProvidersOperations, SyncSetsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + from azure.core.rest import HttpRequest, HttpResponse + +class AzureRedHatOpenShiftClient(object): # pylint: disable=too-many-instance-attributes + """Rest API for Azure Red Hat OpenShift 4. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.redhatopenshift.v2023_11_22.operations.Operations + :ivar open_shift_versions: OpenShiftVersionsOperations operations + :vartype open_shift_versions: + azure.mgmt.redhatopenshift.v2023_11_22.operations.OpenShiftVersionsOperations + :ivar open_shift_clusters: OpenShiftClustersOperations operations + :vartype open_shift_clusters: + azure.mgmt.redhatopenshift.v2023_11_22.operations.OpenShiftClustersOperations + :ivar machine_pools: MachinePoolsOperations operations + :vartype machine_pools: + azure.mgmt.redhatopenshift.v2023_11_22.operations.MachinePoolsOperations + :ivar secrets: SecretsOperations operations + :vartype secrets: azure.mgmt.redhatopenshift.v2023_11_22.operations.SecretsOperations + :ivar sync_identity_providers: SyncIdentityProvidersOperations operations + :vartype sync_identity_providers: + azure.mgmt.redhatopenshift.v2023_11_22.operations.SyncIdentityProvidersOperations + :ivar sync_sets: SyncSetsOperations operations + :vartype sync_sets: azure.mgmt.redhatopenshift.v2023_11_22.operations.SyncSetsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword api_version: Api Version. The default value is "2023-11-22". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url="https://management.azure.com", # type: str + **kwargs # type: Any + ): + # type: (...) -> None + self._config = AzureRedHatOpenShiftClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.open_shift_versions = OpenShiftVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.open_shift_clusters = OpenShiftClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.machine_pools = MachinePoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sync_identity_providers = SyncIdentityProvidersOperations(self._client, self._config, self._serialize, self._deserialize) + self.sync_sets = SyncSetsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AzureRedHatOpenShiftClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/_configuration.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/_configuration.py new file mode 100644 index 00000000000..9e2ab8aaf73 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/_configuration.py @@ -0,0 +1,83 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +class AzureRedHatOpenShiftClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AzureRedHatOpenShiftClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :keyword api_version: Api Version. The default value is "2023-11-22". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + super(AzureRedHatOpenShiftClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'azureredhatopenshiftclient/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/_patch.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/_vendor.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/_vendor.py new file mode 100644 index 00000000000..e2dad491384 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/_vendor.py @@ -0,0 +1,35 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py new file mode 100644 index 00000000000..04fa6db30f2 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py @@ -0,0 +1,158 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import APIServerProfile + from ._models_py3 import CloudErrorBody + from ._models_py3 import ClusterProfile + from ._models_py3 import ConsoleProfile + from ._models_py3 import Display + from ._models_py3 import EffectiveOutboundIP + from ._models_py3 import IngressProfile + from ._models_py3 import LoadBalancerProfile + from ._models_py3 import MachinePool + from ._models_py3 import MachinePoolList + from ._models_py3 import MachinePoolUpdate + from ._models_py3 import ManagedOutboundIPs + from ._models_py3 import MasterProfile + from ._models_py3 import NetworkProfile + from ._models_py3 import OpenShiftCluster + from ._models_py3 import OpenShiftClusterAdminKubeconfig + from ._models_py3 import OpenShiftClusterCredentials + from ._models_py3 import OpenShiftClusterList + from ._models_py3 import OpenShiftClusterUpdate + from ._models_py3 import OpenShiftVersion + from ._models_py3 import OpenShiftVersionList + from ._models_py3 import Operation + from ._models_py3 import OperationList + from ._models_py3 import OutboundIP + from ._models_py3 import OutboundIPPrefix + from ._models_py3 import ProxyResource + from ._models_py3 import Resource + from ._models_py3 import Secret + from ._models_py3 import SecretList + from ._models_py3 import SecretUpdate + from ._models_py3 import ServicePrincipalProfile + from ._models_py3 import SyncIdentityProvider + from ._models_py3 import SyncIdentityProviderList + from ._models_py3 import SyncIdentityProviderUpdate + from ._models_py3 import SyncSet + from ._models_py3 import SyncSetList + from ._models_py3 import SyncSetUpdate + from ._models_py3 import SystemData + from ._models_py3 import TrackedResource + from ._models_py3 import WorkerProfile +except (SyntaxError, ImportError): + from ._models import APIServerProfile # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import ClusterProfile # type: ignore + from ._models import ConsoleProfile # type: ignore + from ._models import Display # type: ignore + from ._models import EffectiveOutboundIP # type: ignore + from ._models import IngressProfile # type: ignore + from ._models import LoadBalancerProfile # type: ignore + from ._models import MachinePool # type: ignore + from ._models import MachinePoolList # type: ignore + from ._models import MachinePoolUpdate # type: ignore + from ._models import ManagedOutboundIPs # type: ignore + from ._models import MasterProfile # type: ignore + from ._models import NetworkProfile # type: ignore + from ._models import OpenShiftCluster # type: ignore + from ._models import OpenShiftClusterAdminKubeconfig # type: ignore + from ._models import OpenShiftClusterCredentials # type: ignore + from ._models import OpenShiftClusterList # type: ignore + from ._models import OpenShiftClusterUpdate # type: ignore + from ._models import OpenShiftVersion # type: ignore + from ._models import OpenShiftVersionList # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationList # type: ignore + from ._models import OutboundIP # type: ignore + from ._models import OutboundIPPrefix # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import Resource # type: ignore + from ._models import Secret # type: ignore + from ._models import SecretList # type: ignore + from ._models import SecretUpdate # type: ignore + from ._models import ServicePrincipalProfile # type: ignore + from ._models import SyncIdentityProvider # type: ignore + from ._models import SyncIdentityProviderList # type: ignore + from ._models import SyncIdentityProviderUpdate # type: ignore + from ._models import SyncSet # type: ignore + from ._models import SyncSetList # type: ignore + from ._models import SyncSetUpdate # type: ignore + from ._models import SystemData # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import WorkerProfile # type: ignore + +from ._azure_red_hat_open_shift_client_enums import ( + CreatedByType, + EncryptionAtHost, + FipsValidatedModules, + OutboundType, + PreconfiguredNSG, + ProvisioningState, + Visibility, +) + +__all__ = [ + 'APIServerProfile', + 'CloudErrorBody', + 'ClusterProfile', + 'ConsoleProfile', + 'Display', + 'EffectiveOutboundIP', + 'IngressProfile', + 'LoadBalancerProfile', + 'MachinePool', + 'MachinePoolList', + 'MachinePoolUpdate', + 'ManagedOutboundIPs', + 'MasterProfile', + 'NetworkProfile', + 'OpenShiftCluster', + 'OpenShiftClusterAdminKubeconfig', + 'OpenShiftClusterCredentials', + 'OpenShiftClusterList', + 'OpenShiftClusterUpdate', + 'OpenShiftVersion', + 'OpenShiftVersionList', + 'Operation', + 'OperationList', + 'OutboundIP', + 'OutboundIPPrefix', + 'ProxyResource', + 'Resource', + 'Secret', + 'SecretList', + 'SecretUpdate', + 'ServicePrincipalProfile', + 'SyncIdentityProvider', + 'SyncIdentityProviderList', + 'SyncIdentityProviderUpdate', + 'SyncSet', + 'SyncSetList', + 'SyncSetUpdate', + 'SystemData', + 'TrackedResource', + 'WorkerProfile', + 'CreatedByType', + 'EncryptionAtHost', + 'FipsValidatedModules', + 'OutboundType', + 'PreconfiguredNSG', + 'ProvisioningState', + 'Visibility', +] diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_azure_red_hat_open_shift_client_enums.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_azure_red_hat_open_shift_client_enums.py new file mode 100644 index 00000000000..1bede7b8fe1 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_azure_red_hat_open_shift_client_enums.py @@ -0,0 +1,76 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class EncryptionAtHost(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """EncryptionAtHost represents encryption at host state + """ + + DISABLED = "Disabled" + ENABLED = "Enabled" + +class FipsValidatedModules(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """FipsValidatedModules determines if FIPS is used. + """ + + DISABLED = "Disabled" + ENABLED = "Enabled" + +class OutboundType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The outbound routing strategy used to provide your cluster egress to the internet. + """ + + LOADBALANCER = "Loadbalancer" + USER_DEFINED_ROUTING = "UserDefinedRouting" + +class PreconfiguredNSG(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """PreconfiguredNSG represents whether customers want to use their own NSG attached to the subnets + """ + + DISABLED = "Disabled" + ENABLED = "Enabled" + +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """ProvisioningState represents a provisioning state. + """ + + ADMIN_UPDATING = "AdminUpdating" + CANCELLED = "Cancelled" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class Visibility(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Visibility represents visibility. + """ + + PRIVATE = "Private" + PUBLIC = "Public" diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models.py new file mode 100644 index 00000000000..e79467eec33 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models.py @@ -0,0 +1,1685 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class APIServerProfile(msrest.serialization.Model): + """APIServerProfile represents an API server profile. + + :ivar visibility: API server visibility. Possible values include: "Private", "Public". + :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.Visibility + :ivar url: The URL to access the cluster API server. + :vartype url: str + :ivar ip: The IP of the cluster API server. + :vartype ip: str + """ + + _attribute_map = { + 'visibility': {'key': 'visibility', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'ip': {'key': 'ip', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword visibility: API server visibility. Possible values include: "Private", "Public". + :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.Visibility + :keyword url: The URL to access the cluster API server. + :paramtype url: str + :keyword ip: The IP of the cluster API server. + :paramtype ip: str + """ + super(APIServerProfile, self).__init__(**kwargs) + self.visibility = kwargs.get('visibility', None) + self.url = kwargs.get('url', None) + self.ip = kwargs.get('ip', None) + + +class CloudErrorBody(msrest.serialization.Model): + """CloudErrorBody represents the body of a cloud error. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.CloudErrorBody] + """ + super(CloudErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + + +class ClusterProfile(msrest.serialization.Model): + """ClusterProfile represents a cluster profile. + + :ivar pull_secret: The pull secret for the cluster. + :vartype pull_secret: str + :ivar domain: The domain for the cluster. + :vartype domain: str + :ivar version: The version of the cluster. + :vartype version: str + :ivar resource_group_id: The ID of the cluster resource group. + :vartype resource_group_id: str + :ivar fips_validated_modules: If FIPS validated crypto modules are used. Possible values + include: "Disabled", "Enabled". + :vartype fips_validated_modules: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.FipsValidatedModules + """ + + _attribute_map = { + 'pull_secret': {'key': 'pullSecret', 'type': 'str'}, + 'domain': {'key': 'domain', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'resource_group_id': {'key': 'resourceGroupId', 'type': 'str'}, + 'fips_validated_modules': {'key': 'fipsValidatedModules', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword pull_secret: The pull secret for the cluster. + :paramtype pull_secret: str + :keyword domain: The domain for the cluster. + :paramtype domain: str + :keyword version: The version of the cluster. + :paramtype version: str + :keyword resource_group_id: The ID of the cluster resource group. + :paramtype resource_group_id: str + :keyword fips_validated_modules: If FIPS validated crypto modules are used. Possible values + include: "Disabled", "Enabled". + :paramtype fips_validated_modules: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.FipsValidatedModules + """ + super(ClusterProfile, self).__init__(**kwargs) + self.pull_secret = kwargs.get('pull_secret', None) + self.domain = kwargs.get('domain', None) + self.version = kwargs.get('version', None) + self.resource_group_id = kwargs.get('resource_group_id', None) + self.fips_validated_modules = kwargs.get('fips_validated_modules', None) + + +class ConsoleProfile(msrest.serialization.Model): + """ConsoleProfile represents a console profile. + + :ivar url: The URL to access the cluster console. + :vartype url: str + """ + + _attribute_map = { + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword url: The URL to access the cluster console. + :paramtype url: str + """ + super(ConsoleProfile, self).__init__(**kwargs) + self.url = kwargs.get('url', None) + + +class Display(msrest.serialization.Model): + """Display represents the display details of an operation. + + :ivar provider: Friendly name of the resource provider. + :vartype provider: str + :ivar resource: Resource type on which the operation is performed. + :vartype resource: str + :ivar operation: Operation type: read, write, delete, listKeys/action, etc. + :vartype operation: str + :ivar description: Friendly name of the operation. + :vartype description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword provider: Friendly name of the resource provider. + :paramtype provider: str + :keyword resource: Resource type on which the operation is performed. + :paramtype resource: str + :keyword operation: Operation type: read, write, delete, listKeys/action, etc. + :paramtype operation: str + :keyword description: Friendly name of the operation. + :paramtype description: str + """ + super(Display, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class EffectiveOutboundIP(msrest.serialization.Model): + """EffectiveOutboundIP represents an effective outbound IP resource of the cluster public load balancer. + + :ivar id: The fully qualified Azure resource id of an IP address resource. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword id: The fully qualified Azure resource id of an IP address resource. + :paramtype id: str + """ + super(EffectiveOutboundIP, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class IngressProfile(msrest.serialization.Model): + """IngressProfile represents an ingress profile. + + :ivar name: The ingress profile name. + :vartype name: str + :ivar visibility: Ingress visibility. Possible values include: "Private", "Public". + :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.Visibility + :ivar ip: The IP of the ingress. + :vartype ip: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'visibility': {'key': 'visibility', 'type': 'str'}, + 'ip': {'key': 'ip', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The ingress profile name. + :paramtype name: str + :keyword visibility: Ingress visibility. Possible values include: "Private", "Public". + :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.Visibility + :keyword ip: The IP of the ingress. + :paramtype ip: str + """ + super(IngressProfile, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.visibility = kwargs.get('visibility', None) + self.ip = kwargs.get('ip', None) + + +class LoadBalancerProfile(msrest.serialization.Model): + """LoadBalancerProfile represents the profile of the cluster public load balancer. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar managed_outbound_ips: The desired managed outbound IPs for the cluster public load + balancer. + :vartype managed_outbound_ips: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ManagedOutboundIPs + :ivar effective_outbound_ips: The list of effective outbound IP addresses of the public load + balancer. + :vartype effective_outbound_ips: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.EffectiveOutboundIP] + :ivar outbound_ips: The desired outbound IP resources for the cluster load balancer. + :vartype outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIP] + :ivar outbound_ip_prefixes: The desired outbound IP Prefix resources for the cluster load + balancer. + :vartype outbound_ip_prefixes: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIPPrefix] + :ivar allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed + values are in the range of 0 to 64000 (inclusive). The default value is 1024. + :vartype allocated_outbound_ports: int + """ + + _validation = { + 'effective_outbound_ips': {'readonly': True}, + } + + _attribute_map = { + 'managed_outbound_ips': {'key': 'managedOutboundIps', 'type': 'ManagedOutboundIPs'}, + 'effective_outbound_ips': {'key': 'effectiveOutboundIps', 'type': '[EffectiveOutboundIP]'}, + 'outbound_ips': {'key': 'outboundIps', 'type': '[OutboundIP]'}, + 'outbound_ip_prefixes': {'key': 'outboundIpPrefixes', 'type': '[OutboundIPPrefix]'}, + 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword managed_outbound_ips: The desired managed outbound IPs for the cluster public load + balancer. + :paramtype managed_outbound_ips: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ManagedOutboundIPs + :keyword outbound_ips: The desired outbound IP resources for the cluster load balancer. + :paramtype outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIP] + :keyword outbound_ip_prefixes: The desired outbound IP Prefix resources for the cluster load + balancer. + :paramtype outbound_ip_prefixes: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIPPrefix] + :keyword allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed + values are in the range of 0 to 64000 (inclusive). The default value is 1024. + :paramtype allocated_outbound_ports: int + """ + super(LoadBalancerProfile, self).__init__(**kwargs) + self.managed_outbound_ips = kwargs.get('managed_outbound_ips', None) + self.effective_outbound_ips = None + self.outbound_ips = kwargs.get('outbound_ips', None) + self.outbound_ip_prefixes = kwargs.get('outbound_ip_prefixes', None) + self.allocated_outbound_ports = kwargs.get('allocated_outbound_ports', None) + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class MachinePool(ProxyResource): + """MachinePool represents a MachinePool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar resources: + :vartype resources: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'resources': {'key': 'properties.resources', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword resources: + :paramtype resources: str + """ + super(MachinePool, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + + +class MachinePoolList(msrest.serialization.Model): + """MachinePoolList represents a list of MachinePools. + + :ivar value: The list of Machine Pools. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MachinePool]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: The list of Machine Pools. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super(MachinePoolList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class MachinePoolUpdate(msrest.serialization.Model): + """MachinePool represents a MachinePool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar resources: + :vartype resources: str + """ + + _validation = { + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'resources': {'key': 'properties.resources', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword resources: + :paramtype resources: str + """ + super(MachinePoolUpdate, self).__init__(**kwargs) + self.system_data = None + self.resources = kwargs.get('resources', None) + + +class ManagedOutboundIPs(msrest.serialization.Model): + """ManagedOutboundIPs represents the desired managed outbound IPs for the cluster public load balancer. + + :ivar count: Count represents the desired number of IPv4 outbound IPs created and managed by + Azure for the cluster public load balancer. Allowed values are in the range of 1 - 20. The + default value is 1. + :vartype count: int + """ + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword count: Count represents the desired number of IPv4 outbound IPs created and managed by + Azure for the cluster public load balancer. Allowed values are in the range of 1 - 20. The + default value is 1. + :paramtype count: int + """ + super(ManagedOutboundIPs, self).__init__(**kwargs) + self.count = kwargs.get('count', None) + + +class MasterProfile(msrest.serialization.Model): + """MasterProfile represents a master profile. + + :ivar vm_size: The size of the master VMs. + :vartype vm_size: str + :ivar subnet_id: The Azure resource ID of the master subnet. + :vartype subnet_id: str + :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Possible + values include: "Disabled", "Enabled". + :vartype encryption_at_host: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.EncryptionAtHost + :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if + applicable. + :vartype disk_encryption_set_id: str + """ + + _attribute_map = { + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'str'}, + 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword vm_size: The size of the master VMs. + :paramtype vm_size: str + :keyword subnet_id: The Azure resource ID of the master subnet. + :paramtype subnet_id: str + :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Possible + values include: "Disabled", "Enabled". + :paramtype encryption_at_host: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.EncryptionAtHost + :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if + applicable. + :paramtype disk_encryption_set_id: str + """ + super(MasterProfile, self).__init__(**kwargs) + self.vm_size = kwargs.get('vm_size', None) + self.subnet_id = kwargs.get('subnet_id', None) + self.encryption_at_host = kwargs.get('encryption_at_host', None) + self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) + + +class NetworkProfile(msrest.serialization.Model): + """NetworkProfile represents a network profile. + + :ivar pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. + :vartype pod_cidr: str + :ivar service_cidr: The CIDR used for OpenShift/Kubernetes Services. + :vartype service_cidr: str + :ivar outbound_type: The OutboundType used for egress traffic. Possible values include: + "Loadbalancer", "UserDefinedRouting". + :vartype outbound_type: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundType + :ivar load_balancer_profile: The cluster load balancer profile. + :vartype load_balancer_profile: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.LoadBalancerProfile + :ivar preconfigured_nsg: Specifies whether subnets are pre-attached with an NSG. Possible + values include: "Disabled", "Enabled". + :vartype preconfigured_nsg: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.PreconfiguredNSG + """ + + _attribute_map = { + 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, + 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, + 'outbound_type': {'key': 'outboundType', 'type': 'str'}, + 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'LoadBalancerProfile'}, + 'preconfigured_nsg': {'key': 'preconfiguredNSG', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. + :paramtype pod_cidr: str + :keyword service_cidr: The CIDR used for OpenShift/Kubernetes Services. + :paramtype service_cidr: str + :keyword outbound_type: The OutboundType used for egress traffic. Possible values include: + "Loadbalancer", "UserDefinedRouting". + :paramtype outbound_type: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundType + :keyword load_balancer_profile: The cluster load balancer profile. + :paramtype load_balancer_profile: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.LoadBalancerProfile + :keyword preconfigured_nsg: Specifies whether subnets are pre-attached with an NSG. Possible + values include: "Disabled", "Enabled". + :paramtype preconfigured_nsg: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.PreconfiguredNSG + """ + super(NetworkProfile, self).__init__(**kwargs) + self.pod_cidr = kwargs.get('pod_cidr', None) + self.service_cidr = kwargs.get('service_cidr', None) + self.outbound_type = kwargs.get('outbound_type', None) + self.load_balancer_profile = kwargs.get('load_balancer_profile', None) + self.preconfigured_nsg = kwargs.get('preconfigured_nsg', None) + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class OpenShiftCluster(TrackedResource): + """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The cluster provisioning state. Possible values include: + "AdminUpdating", "Cancelled", "Creating", "Deleting", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ProvisioningState + :ivar cluster_profile: The cluster profile. + :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ClusterProfile + :ivar console_profile: The console profile. + :vartype console_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ConsoleProfile + :ivar service_principal_profile: The cluster service principal profile. + :vartype service_principal_profile: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ServicePrincipalProfile + :ivar network_profile: The cluster network profile. + :vartype network_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.NetworkProfile + :ivar master_profile: The cluster master profile. + :vartype master_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MasterProfile + :ivar worker_profiles: The cluster worker profiles. + :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :ivar worker_profiles_status: The cluster worker profiles status. + :vartype worker_profiles_status: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :ivar apiserver_profile: The cluster API server profile. + :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.APIServerProfile + :ivar ingress_profiles: The cluster ingress profiles. + :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.IngressProfile] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'worker_profiles_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'cluster_profile': {'key': 'properties.clusterProfile', 'type': 'ClusterProfile'}, + 'console_profile': {'key': 'properties.consoleProfile', 'type': 'ConsoleProfile'}, + 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ServicePrincipalProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, + 'master_profile': {'key': 'properties.masterProfile', 'type': 'MasterProfile'}, + 'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'}, + 'worker_profiles_status': {'key': 'properties.workerProfilesStatus', 'type': '[WorkerProfile]'}, + 'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'}, + 'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword provisioning_state: The cluster provisioning state. Possible values include: + "AdminUpdating", "Cancelled", "Creating", "Deleting", "Failed", "Succeeded", "Updating". + :paramtype provisioning_state: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ProvisioningState + :keyword cluster_profile: The cluster profile. + :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ClusterProfile + :keyword console_profile: The console profile. + :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ConsoleProfile + :keyword service_principal_profile: The cluster service principal profile. + :paramtype service_principal_profile: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ServicePrincipalProfile + :keyword network_profile: The cluster network profile. + :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.NetworkProfile + :keyword master_profile: The cluster master profile. + :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MasterProfile + :keyword worker_profiles: The cluster worker profiles. + :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :keyword apiserver_profile: The cluster API server profile. + :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.APIServerProfile + :keyword ingress_profiles: The cluster ingress profiles. + :paramtype ingress_profiles: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.IngressProfile] + """ + super(OpenShiftCluster, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.cluster_profile = kwargs.get('cluster_profile', None) + self.console_profile = kwargs.get('console_profile', None) + self.service_principal_profile = kwargs.get('service_principal_profile', None) + self.network_profile = kwargs.get('network_profile', None) + self.master_profile = kwargs.get('master_profile', None) + self.worker_profiles = kwargs.get('worker_profiles', None) + self.worker_profiles_status = None + self.apiserver_profile = kwargs.get('apiserver_profile', None) + self.ingress_profiles = kwargs.get('ingress_profiles', None) + + +class OpenShiftClusterAdminKubeconfig(msrest.serialization.Model): + """OpenShiftClusterAdminKubeconfig represents an OpenShift cluster's admin kubeconfig. + + :ivar kubeconfig: The base64-encoded kubeconfig file. + :vartype kubeconfig: str + """ + + _attribute_map = { + 'kubeconfig': {'key': 'kubeconfig', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword kubeconfig: The base64-encoded kubeconfig file. + :paramtype kubeconfig: str + """ + super(OpenShiftClusterAdminKubeconfig, self).__init__(**kwargs) + self.kubeconfig = kwargs.get('kubeconfig', None) + + +class OpenShiftClusterCredentials(msrest.serialization.Model): + """OpenShiftClusterCredentials represents an OpenShift cluster's credentials. + + :ivar kubeadmin_username: The username for the kubeadmin user. + :vartype kubeadmin_username: str + :ivar kubeadmin_password: The password for the kubeadmin user. + :vartype kubeadmin_password: str + """ + + _attribute_map = { + 'kubeadmin_username': {'key': 'kubeadminUsername', 'type': 'str'}, + 'kubeadmin_password': {'key': 'kubeadminPassword', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword kubeadmin_username: The username for the kubeadmin user. + :paramtype kubeadmin_username: str + :keyword kubeadmin_password: The password for the kubeadmin user. + :paramtype kubeadmin_password: str + """ + super(OpenShiftClusterCredentials, self).__init__(**kwargs) + self.kubeadmin_username = kwargs.get('kubeadmin_username', None) + self.kubeadmin_password = kwargs.get('kubeadmin_password', None) + + +class OpenShiftClusterList(msrest.serialization.Model): + """OpenShiftClusterList represents a list of OpenShift clusters. + + :ivar value: The list of OpenShift clusters. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OpenShiftCluster]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: The list of OpenShift clusters. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super(OpenShiftClusterList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class OpenShiftClusterUpdate(msrest.serialization.Model): + """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar provisioning_state: The cluster provisioning state. Possible values include: + "AdminUpdating", "Cancelled", "Creating", "Deleting", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ProvisioningState + :ivar cluster_profile: The cluster profile. + :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ClusterProfile + :ivar console_profile: The console profile. + :vartype console_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ConsoleProfile + :ivar service_principal_profile: The cluster service principal profile. + :vartype service_principal_profile: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ServicePrincipalProfile + :ivar network_profile: The cluster network profile. + :vartype network_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.NetworkProfile + :ivar master_profile: The cluster master profile. + :vartype master_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MasterProfile + :ivar worker_profiles: The cluster worker profiles. + :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :ivar worker_profiles_status: The cluster worker profiles status. + :vartype worker_profiles_status: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :ivar apiserver_profile: The cluster API server profile. + :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.APIServerProfile + :ivar ingress_profiles: The cluster ingress profiles. + :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.IngressProfile] + """ + + _validation = { + 'system_data': {'readonly': True}, + 'worker_profiles_status': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'cluster_profile': {'key': 'properties.clusterProfile', 'type': 'ClusterProfile'}, + 'console_profile': {'key': 'properties.consoleProfile', 'type': 'ConsoleProfile'}, + 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ServicePrincipalProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, + 'master_profile': {'key': 'properties.masterProfile', 'type': 'MasterProfile'}, + 'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'}, + 'worker_profiles_status': {'key': 'properties.workerProfilesStatus', 'type': '[WorkerProfile]'}, + 'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'}, + 'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword tags: A set of tags. The resource tags. + :paramtype tags: dict[str, str] + :keyword provisioning_state: The cluster provisioning state. Possible values include: + "AdminUpdating", "Cancelled", "Creating", "Deleting", "Failed", "Succeeded", "Updating". + :paramtype provisioning_state: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ProvisioningState + :keyword cluster_profile: The cluster profile. + :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ClusterProfile + :keyword console_profile: The console profile. + :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ConsoleProfile + :keyword service_principal_profile: The cluster service principal profile. + :paramtype service_principal_profile: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ServicePrincipalProfile + :keyword network_profile: The cluster network profile. + :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.NetworkProfile + :keyword master_profile: The cluster master profile. + :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MasterProfile + :keyword worker_profiles: The cluster worker profiles. + :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :keyword apiserver_profile: The cluster API server profile. + :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.APIServerProfile + :keyword ingress_profiles: The cluster ingress profiles. + :paramtype ingress_profiles: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.IngressProfile] + """ + super(OpenShiftClusterUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.system_data = None + self.provisioning_state = kwargs.get('provisioning_state', None) + self.cluster_profile = kwargs.get('cluster_profile', None) + self.console_profile = kwargs.get('console_profile', None) + self.service_principal_profile = kwargs.get('service_principal_profile', None) + self.network_profile = kwargs.get('network_profile', None) + self.master_profile = kwargs.get('master_profile', None) + self.worker_profiles = kwargs.get('worker_profiles', None) + self.worker_profiles_status = None + self.apiserver_profile = kwargs.get('apiserver_profile', None) + self.ingress_profiles = kwargs.get('ingress_profiles', None) + + +class OpenShiftVersion(ProxyResource): + """OpenShiftVersion represents an OpenShift version that can be installed. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar version: Version represents the version to create the cluster at. + :vartype version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword version: Version represents the version to create the cluster at. + :paramtype version: str + """ + super(OpenShiftVersion, self).__init__(**kwargs) + self.version = kwargs.get('version', None) + + +class OpenShiftVersionList(msrest.serialization.Model): + """OpenShiftVersionList represents a List of available versions. + + :ivar value: The List of available versions. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftVersion] + :ivar next_link: Next Link to next operation. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OpenShiftVersion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: The List of available versions. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftVersion] + :keyword next_link: Next Link to next operation. + :paramtype next_link: str + """ + super(OpenShiftVersionList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class Operation(msrest.serialization.Model): + """Operation represents an RP operation. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that describes the operation. + :vartype display: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Display + :ivar origin: Sources of requests to this operation. Comma separated list with valid values + user or system, e.g. "user,system". + :vartype origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'Display'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that describes the operation. + :paramtype display: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Display + :keyword origin: Sources of requests to this operation. Comma separated list with valid values + user or system, e.g. "user,system". + :paramtype origin: str + """ + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + + +class OperationList(msrest.serialization.Model): + """OperationList represents an RP operation list. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.Operation] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: List of operations supported by the resource provider. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.Operation] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super(OperationList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class OutboundIP(msrest.serialization.Model): + """OutboundIP represents a desired outbound IP resource for the cluster load balancer. + + :ivar id: The fully qualified Azure resource id of an IP address resource. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword id: The fully qualified Azure resource id of an IP address resource. + :paramtype id: str + """ + super(OutboundIP, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class OutboundIPPrefix(msrest.serialization.Model): + """OutboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load balancer. + + :ivar id: The fully qualified Azure resource id of an IP address resource. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword id: The fully qualified Azure resource id of an IP address resource. + :paramtype id: str + """ + super(OutboundIPPrefix, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class Secret(ProxyResource): + """Secret represents a secret. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar secret_resources: The Secrets Resources. + :vartype secret_resources: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'secret_resources': {'key': 'properties.secretResources', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword secret_resources: The Secrets Resources. + :paramtype secret_resources: str + """ + super(Secret, self).__init__(**kwargs) + self.secret_resources = kwargs.get('secret_resources', None) + + +class SecretList(msrest.serialization.Model): + """SecretList represents a list of Secrets. + + :ivar value: The list of secrets. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Secret]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: The list of secrets. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super(SecretList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SecretUpdate(msrest.serialization.Model): + """Secret represents a secret. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar secret_resources: The Secrets Resources. + :vartype secret_resources: str + """ + + _validation = { + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'secret_resources': {'key': 'properties.secretResources', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword secret_resources: The Secrets Resources. + :paramtype secret_resources: str + """ + super(SecretUpdate, self).__init__(**kwargs) + self.system_data = None + self.secret_resources = kwargs.get('secret_resources', None) + + +class ServicePrincipalProfile(msrest.serialization.Model): + """ServicePrincipalProfile represents a service principal profile. + + :ivar client_id: The client ID used for the cluster. + :vartype client_id: str + :ivar client_secret: The client secret used for the cluster. + :vartype client_secret: str + """ + + _attribute_map = { + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'client_secret': {'key': 'clientSecret', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword client_id: The client ID used for the cluster. + :paramtype client_id: str + :keyword client_secret: The client secret used for the cluster. + :paramtype client_secret: str + """ + super(ServicePrincipalProfile, self).__init__(**kwargs) + self.client_id = kwargs.get('client_id', None) + self.client_secret = kwargs.get('client_secret', None) + + +class SyncIdentityProvider(ProxyResource): + """SyncIdentityProvider represents a SyncIdentityProvider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar resources: + :vartype resources: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'resources': {'key': 'properties.resources', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword resources: + :paramtype resources: str + """ + super(SyncIdentityProvider, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + + +class SyncIdentityProviderList(msrest.serialization.Model): + """SyncSetList represents a list of SyncSets. + + :ivar value: The list of sync identity providers. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SyncIdentityProvider]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: The list of sync identity providers. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super(SyncIdentityProviderList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SyncIdentityProviderUpdate(msrest.serialization.Model): + """SyncIdentityProvider represents a SyncIdentityProvider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar resources: + :vartype resources: str + """ + + _validation = { + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'resources': {'key': 'properties.resources', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword resources: + :paramtype resources: str + """ + super(SyncIdentityProviderUpdate, self).__init__(**kwargs) + self.system_data = None + self.resources = kwargs.get('resources', None) + + +class SyncSet(ProxyResource): + """SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar resources: Resources represents the SyncSets configuration. + :vartype resources: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'resources': {'key': 'properties.resources', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword resources: Resources represents the SyncSets configuration. + :paramtype resources: str + """ + super(SyncSet, self).__init__(**kwargs) + self.resources = kwargs.get('resources', None) + + +class SyncSetList(msrest.serialization.Model): + """SyncSetList represents a list of SyncSets. + + :ivar value: The list of syncsets. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SyncSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: The list of syncsets. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super(SyncSetList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SyncSetUpdate(msrest.serialization.Model): + """SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar resources: Resources represents the SyncSets configuration. + :vartype resources: str + """ + + _validation = { + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'resources': {'key': 'properties.resources', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword resources: Resources represents the SyncSets configuration. + :paramtype resources: str + """ + super(SyncSetUpdate, self).__init__(**kwargs) + self.system_data = None + self.resources = kwargs.get('resources', None) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class WorkerProfile(msrest.serialization.Model): + """WorkerProfile represents a worker profile. + + :ivar name: The worker profile name. + :vartype name: str + :ivar vm_size: The size of the worker VMs. + :vartype vm_size: str + :ivar disk_size_gb: The disk size of the worker VMs. + :vartype disk_size_gb: int + :ivar subnet_id: The Azure resource ID of the worker subnet. + :vartype subnet_id: str + :ivar count: The number of worker VMs. + :vartype count: int + :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Possible + values include: "Disabled", "Enabled". + :vartype encryption_at_host: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.EncryptionAtHost + :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if + applicable. + :vartype disk_encryption_set_id: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'str'}, + 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword name: The worker profile name. + :paramtype name: str + :keyword vm_size: The size of the worker VMs. + :paramtype vm_size: str + :keyword disk_size_gb: The disk size of the worker VMs. + :paramtype disk_size_gb: int + :keyword subnet_id: The Azure resource ID of the worker subnet. + :paramtype subnet_id: str + :keyword count: The number of worker VMs. + :paramtype count: int + :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Possible + values include: "Disabled", "Enabled". + :paramtype encryption_at_host: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.EncryptionAtHost + :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if + applicable. + :paramtype disk_encryption_set_id: str + """ + super(WorkerProfile, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.vm_size = kwargs.get('vm_size', None) + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.subnet_id = kwargs.get('subnet_id', None) + self.count = kwargs.get('count', None) + self.encryption_at_host = kwargs.get('encryption_at_host', None) + self.disk_encryption_set_id = kwargs.get('disk_encryption_set_id', None) diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py new file mode 100644 index 00000000000..9948402c352 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py @@ -0,0 +1,1832 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._azure_red_hat_open_shift_client_enums import * + + +class APIServerProfile(msrest.serialization.Model): + """APIServerProfile represents an API server profile. + + :ivar visibility: API server visibility. Possible values include: "Private", "Public". + :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.Visibility + :ivar url: The URL to access the cluster API server. + :vartype url: str + :ivar ip: The IP of the cluster API server. + :vartype ip: str + """ + + _attribute_map = { + 'visibility': {'key': 'visibility', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'ip': {'key': 'ip', 'type': 'str'}, + } + + def __init__( + self, + *, + visibility: Optional[Union[str, "Visibility"]] = None, + url: Optional[str] = None, + ip: Optional[str] = None, + **kwargs + ): + """ + :keyword visibility: API server visibility. Possible values include: "Private", "Public". + :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.Visibility + :keyword url: The URL to access the cluster API server. + :paramtype url: str + :keyword ip: The IP of the cluster API server. + :paramtype ip: str + """ + super(APIServerProfile, self).__init__(**kwargs) + self.visibility = visibility + self.url = url + self.ip = ip + + +class CloudErrorBody(msrest.serialization.Model): + """CloudErrorBody represents the body of a cloud error. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.CloudErrorBody] + """ + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ClusterProfile(msrest.serialization.Model): + """ClusterProfile represents a cluster profile. + + :ivar pull_secret: The pull secret for the cluster. + :vartype pull_secret: str + :ivar domain: The domain for the cluster. + :vartype domain: str + :ivar version: The version of the cluster. + :vartype version: str + :ivar resource_group_id: The ID of the cluster resource group. + :vartype resource_group_id: str + :ivar fips_validated_modules: If FIPS validated crypto modules are used. Possible values + include: "Disabled", "Enabled". + :vartype fips_validated_modules: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.FipsValidatedModules + """ + + _attribute_map = { + 'pull_secret': {'key': 'pullSecret', 'type': 'str'}, + 'domain': {'key': 'domain', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'resource_group_id': {'key': 'resourceGroupId', 'type': 'str'}, + 'fips_validated_modules': {'key': 'fipsValidatedModules', 'type': 'str'}, + } + + def __init__( + self, + *, + pull_secret: Optional[str] = None, + domain: Optional[str] = None, + version: Optional[str] = None, + resource_group_id: Optional[str] = None, + fips_validated_modules: Optional[Union[str, "FipsValidatedModules"]] = None, + **kwargs + ): + """ + :keyword pull_secret: The pull secret for the cluster. + :paramtype pull_secret: str + :keyword domain: The domain for the cluster. + :paramtype domain: str + :keyword version: The version of the cluster. + :paramtype version: str + :keyword resource_group_id: The ID of the cluster resource group. + :paramtype resource_group_id: str + :keyword fips_validated_modules: If FIPS validated crypto modules are used. Possible values + include: "Disabled", "Enabled". + :paramtype fips_validated_modules: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.FipsValidatedModules + """ + super(ClusterProfile, self).__init__(**kwargs) + self.pull_secret = pull_secret + self.domain = domain + self.version = version + self.resource_group_id = resource_group_id + self.fips_validated_modules = fips_validated_modules + + +class ConsoleProfile(msrest.serialization.Model): + """ConsoleProfile represents a console profile. + + :ivar url: The URL to access the cluster console. + :vartype url: str + """ + + _attribute_map = { + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__( + self, + *, + url: Optional[str] = None, + **kwargs + ): + """ + :keyword url: The URL to access the cluster console. + :paramtype url: str + """ + super(ConsoleProfile, self).__init__(**kwargs) + self.url = url + + +class Display(msrest.serialization.Model): + """Display represents the display details of an operation. + + :ivar provider: Friendly name of the resource provider. + :vartype provider: str + :ivar resource: Resource type on which the operation is performed. + :vartype resource: str + :ivar operation: Operation type: read, write, delete, listKeys/action, etc. + :vartype operation: str + :ivar description: Friendly name of the operation. + :vartype description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword provider: Friendly name of the resource provider. + :paramtype provider: str + :keyword resource: Resource type on which the operation is performed. + :paramtype resource: str + :keyword operation: Operation type: read, write, delete, listKeys/action, etc. + :paramtype operation: str + :keyword description: Friendly name of the operation. + :paramtype description: str + """ + super(Display, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class EffectiveOutboundIP(msrest.serialization.Model): + """EffectiveOutboundIP represents an effective outbound IP resource of the cluster public load balancer. + + :ivar id: The fully qualified Azure resource id of an IP address resource. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: The fully qualified Azure resource id of an IP address resource. + :paramtype id: str + """ + super(EffectiveOutboundIP, self).__init__(**kwargs) + self.id = id + + +class IngressProfile(msrest.serialization.Model): + """IngressProfile represents an ingress profile. + + :ivar name: The ingress profile name. + :vartype name: str + :ivar visibility: Ingress visibility. Possible values include: "Private", "Public". + :vartype visibility: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.Visibility + :ivar ip: The IP of the ingress. + :vartype ip: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'visibility': {'key': 'visibility', 'type': 'str'}, + 'ip': {'key': 'ip', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + visibility: Optional[Union[str, "Visibility"]] = None, + ip: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The ingress profile name. + :paramtype name: str + :keyword visibility: Ingress visibility. Possible values include: "Private", "Public". + :paramtype visibility: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.Visibility + :keyword ip: The IP of the ingress. + :paramtype ip: str + """ + super(IngressProfile, self).__init__(**kwargs) + self.name = name + self.visibility = visibility + self.ip = ip + + +class LoadBalancerProfile(msrest.serialization.Model): + """LoadBalancerProfile represents the profile of the cluster public load balancer. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar managed_outbound_ips: The desired managed outbound IPs for the cluster public load + balancer. + :vartype managed_outbound_ips: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ManagedOutboundIPs + :ivar effective_outbound_ips: The list of effective outbound IP addresses of the public load + balancer. + :vartype effective_outbound_ips: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.EffectiveOutboundIP] + :ivar outbound_ips: The desired outbound IP resources for the cluster load balancer. + :vartype outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIP] + :ivar outbound_ip_prefixes: The desired outbound IP Prefix resources for the cluster load + balancer. + :vartype outbound_ip_prefixes: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIPPrefix] + :ivar allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed + values are in the range of 0 to 64000 (inclusive). The default value is 1024. + :vartype allocated_outbound_ports: int + """ + + _validation = { + 'effective_outbound_ips': {'readonly': True}, + } + + _attribute_map = { + 'managed_outbound_ips': {'key': 'managedOutboundIps', 'type': 'ManagedOutboundIPs'}, + 'effective_outbound_ips': {'key': 'effectiveOutboundIps', 'type': '[EffectiveOutboundIP]'}, + 'outbound_ips': {'key': 'outboundIps', 'type': '[OutboundIP]'}, + 'outbound_ip_prefixes': {'key': 'outboundIpPrefixes', 'type': '[OutboundIPPrefix]'}, + 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, + } + + def __init__( + self, + *, + managed_outbound_ips: Optional["ManagedOutboundIPs"] = None, + outbound_ips: Optional[List["OutboundIP"]] = None, + outbound_ip_prefixes: Optional[List["OutboundIPPrefix"]] = None, + allocated_outbound_ports: Optional[int] = None, + **kwargs + ): + """ + :keyword managed_outbound_ips: The desired managed outbound IPs for the cluster public load + balancer. + :paramtype managed_outbound_ips: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ManagedOutboundIPs + :keyword outbound_ips: The desired outbound IP resources for the cluster load balancer. + :paramtype outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIP] + :keyword outbound_ip_prefixes: The desired outbound IP Prefix resources for the cluster load + balancer. + :paramtype outbound_ip_prefixes: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIPPrefix] + :keyword allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed + values are in the range of 0 to 64000 (inclusive). The default value is 1024. + :paramtype allocated_outbound_ports: int + """ + super(LoadBalancerProfile, self).__init__(**kwargs) + self.managed_outbound_ips = managed_outbound_ips + self.effective_outbound_ips = None + self.outbound_ips = outbound_ips + self.outbound_ip_prefixes = outbound_ip_prefixes + self.allocated_outbound_ports = allocated_outbound_ports + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class MachinePool(ProxyResource): + """MachinePool represents a MachinePool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar resources: + :vartype resources: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'resources': {'key': 'properties.resources', 'type': 'str'}, + } + + def __init__( + self, + *, + resources: Optional[str] = None, + **kwargs + ): + """ + :keyword resources: + :paramtype resources: str + """ + super(MachinePool, self).__init__(**kwargs) + self.resources = resources + + +class MachinePoolList(msrest.serialization.Model): + """MachinePoolList represents a list of MachinePools. + + :ivar value: The list of Machine Pools. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MachinePool]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["MachinePool"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of Machine Pools. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super(MachinePoolList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class MachinePoolUpdate(msrest.serialization.Model): + """MachinePool represents a MachinePool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar resources: + :vartype resources: str + """ + + _validation = { + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'resources': {'key': 'properties.resources', 'type': 'str'}, + } + + def __init__( + self, + *, + resources: Optional[str] = None, + **kwargs + ): + """ + :keyword resources: + :paramtype resources: str + """ + super(MachinePoolUpdate, self).__init__(**kwargs) + self.system_data = None + self.resources = resources + + +class ManagedOutboundIPs(msrest.serialization.Model): + """ManagedOutboundIPs represents the desired managed outbound IPs for the cluster public load balancer. + + :ivar count: Count represents the desired number of IPv4 outbound IPs created and managed by + Azure for the cluster public load balancer. Allowed values are in the range of 1 - 20. The + default value is 1. + :vartype count: int + """ + + _attribute_map = { + 'count': {'key': 'count', 'type': 'int'}, + } + + def __init__( + self, + *, + count: Optional[int] = None, + **kwargs + ): + """ + :keyword count: Count represents the desired number of IPv4 outbound IPs created and managed by + Azure for the cluster public load balancer. Allowed values are in the range of 1 - 20. The + default value is 1. + :paramtype count: int + """ + super(ManagedOutboundIPs, self).__init__(**kwargs) + self.count = count + + +class MasterProfile(msrest.serialization.Model): + """MasterProfile represents a master profile. + + :ivar vm_size: The size of the master VMs. + :vartype vm_size: str + :ivar subnet_id: The Azure resource ID of the master subnet. + :vartype subnet_id: str + :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Possible + values include: "Disabled", "Enabled". + :vartype encryption_at_host: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.EncryptionAtHost + :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if + applicable. + :vartype disk_encryption_set_id: str + """ + + _attribute_map = { + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'str'}, + 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + } + + def __init__( + self, + *, + vm_size: Optional[str] = None, + subnet_id: Optional[str] = None, + encryption_at_host: Optional[Union[str, "EncryptionAtHost"]] = None, + disk_encryption_set_id: Optional[str] = None, + **kwargs + ): + """ + :keyword vm_size: The size of the master VMs. + :paramtype vm_size: str + :keyword subnet_id: The Azure resource ID of the master subnet. + :paramtype subnet_id: str + :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Possible + values include: "Disabled", "Enabled". + :paramtype encryption_at_host: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.EncryptionAtHost + :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if + applicable. + :paramtype disk_encryption_set_id: str + """ + super(MasterProfile, self).__init__(**kwargs) + self.vm_size = vm_size + self.subnet_id = subnet_id + self.encryption_at_host = encryption_at_host + self.disk_encryption_set_id = disk_encryption_set_id + + +class NetworkProfile(msrest.serialization.Model): + """NetworkProfile represents a network profile. + + :ivar pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. + :vartype pod_cidr: str + :ivar service_cidr: The CIDR used for OpenShift/Kubernetes Services. + :vartype service_cidr: str + :ivar outbound_type: The OutboundType used for egress traffic. Possible values include: + "Loadbalancer", "UserDefinedRouting". + :vartype outbound_type: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundType + :ivar load_balancer_profile: The cluster load balancer profile. + :vartype load_balancer_profile: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.LoadBalancerProfile + :ivar preconfigured_nsg: Specifies whether subnets are pre-attached with an NSG. Possible + values include: "Disabled", "Enabled". + :vartype preconfigured_nsg: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.PreconfiguredNSG + """ + + _attribute_map = { + 'pod_cidr': {'key': 'podCidr', 'type': 'str'}, + 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, + 'outbound_type': {'key': 'outboundType', 'type': 'str'}, + 'load_balancer_profile': {'key': 'loadBalancerProfile', 'type': 'LoadBalancerProfile'}, + 'preconfigured_nsg': {'key': 'preconfiguredNSG', 'type': 'str'}, + } + + def __init__( + self, + *, + pod_cidr: Optional[str] = None, + service_cidr: Optional[str] = None, + outbound_type: Optional[Union[str, "OutboundType"]] = None, + load_balancer_profile: Optional["LoadBalancerProfile"] = None, + preconfigured_nsg: Optional[Union[str, "PreconfiguredNSG"]] = None, + **kwargs + ): + """ + :keyword pod_cidr: The CIDR used for OpenShift/Kubernetes Pods. + :paramtype pod_cidr: str + :keyword service_cidr: The CIDR used for OpenShift/Kubernetes Services. + :paramtype service_cidr: str + :keyword outbound_type: The OutboundType used for egress traffic. Possible values include: + "Loadbalancer", "UserDefinedRouting". + :paramtype outbound_type: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundType + :keyword load_balancer_profile: The cluster load balancer profile. + :paramtype load_balancer_profile: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.LoadBalancerProfile + :keyword preconfigured_nsg: Specifies whether subnets are pre-attached with an NSG. Possible + values include: "Disabled", "Enabled". + :paramtype preconfigured_nsg: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.PreconfiguredNSG + """ + super(NetworkProfile, self).__init__(**kwargs) + self.pod_cidr = pod_cidr + self.service_cidr = service_cidr + self.outbound_type = outbound_type + self.load_balancer_profile = load_balancer_profile + self.preconfigured_nsg = preconfigured_nsg + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class OpenShiftCluster(TrackedResource): + """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The cluster provisioning state. Possible values include: + "AdminUpdating", "Cancelled", "Creating", "Deleting", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ProvisioningState + :ivar cluster_profile: The cluster profile. + :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ClusterProfile + :ivar console_profile: The console profile. + :vartype console_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ConsoleProfile + :ivar service_principal_profile: The cluster service principal profile. + :vartype service_principal_profile: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ServicePrincipalProfile + :ivar network_profile: The cluster network profile. + :vartype network_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.NetworkProfile + :ivar master_profile: The cluster master profile. + :vartype master_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MasterProfile + :ivar worker_profiles: The cluster worker profiles. + :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :ivar worker_profiles_status: The cluster worker profiles status. + :vartype worker_profiles_status: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :ivar apiserver_profile: The cluster API server profile. + :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.APIServerProfile + :ivar ingress_profiles: The cluster ingress profiles. + :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.IngressProfile] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'worker_profiles_status': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'cluster_profile': {'key': 'properties.clusterProfile', 'type': 'ClusterProfile'}, + 'console_profile': {'key': 'properties.consoleProfile', 'type': 'ConsoleProfile'}, + 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ServicePrincipalProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, + 'master_profile': {'key': 'properties.masterProfile', 'type': 'MasterProfile'}, + 'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'}, + 'worker_profiles_status': {'key': 'properties.workerProfilesStatus', 'type': '[WorkerProfile]'}, + 'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'}, + 'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + cluster_profile: Optional["ClusterProfile"] = None, + console_profile: Optional["ConsoleProfile"] = None, + service_principal_profile: Optional["ServicePrincipalProfile"] = None, + network_profile: Optional["NetworkProfile"] = None, + master_profile: Optional["MasterProfile"] = None, + worker_profiles: Optional[List["WorkerProfile"]] = None, + apiserver_profile: Optional["APIServerProfile"] = None, + ingress_profiles: Optional[List["IngressProfile"]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword provisioning_state: The cluster provisioning state. Possible values include: + "AdminUpdating", "Cancelled", "Creating", "Deleting", "Failed", "Succeeded", "Updating". + :paramtype provisioning_state: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ProvisioningState + :keyword cluster_profile: The cluster profile. + :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ClusterProfile + :keyword console_profile: The console profile. + :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ConsoleProfile + :keyword service_principal_profile: The cluster service principal profile. + :paramtype service_principal_profile: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ServicePrincipalProfile + :keyword network_profile: The cluster network profile. + :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.NetworkProfile + :keyword master_profile: The cluster master profile. + :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MasterProfile + :keyword worker_profiles: The cluster worker profiles. + :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :keyword apiserver_profile: The cluster API server profile. + :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.APIServerProfile + :keyword ingress_profiles: The cluster ingress profiles. + :paramtype ingress_profiles: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.IngressProfile] + """ + super(OpenShiftCluster, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = provisioning_state + self.cluster_profile = cluster_profile + self.console_profile = console_profile + self.service_principal_profile = service_principal_profile + self.network_profile = network_profile + self.master_profile = master_profile + self.worker_profiles = worker_profiles + self.worker_profiles_status = None + self.apiserver_profile = apiserver_profile + self.ingress_profiles = ingress_profiles + + +class OpenShiftClusterAdminKubeconfig(msrest.serialization.Model): + """OpenShiftClusterAdminKubeconfig represents an OpenShift cluster's admin kubeconfig. + + :ivar kubeconfig: The base64-encoded kubeconfig file. + :vartype kubeconfig: str + """ + + _attribute_map = { + 'kubeconfig': {'key': 'kubeconfig', 'type': 'str'}, + } + + def __init__( + self, + *, + kubeconfig: Optional[str] = None, + **kwargs + ): + """ + :keyword kubeconfig: The base64-encoded kubeconfig file. + :paramtype kubeconfig: str + """ + super(OpenShiftClusterAdminKubeconfig, self).__init__(**kwargs) + self.kubeconfig = kubeconfig + + +class OpenShiftClusterCredentials(msrest.serialization.Model): + """OpenShiftClusterCredentials represents an OpenShift cluster's credentials. + + :ivar kubeadmin_username: The username for the kubeadmin user. + :vartype kubeadmin_username: str + :ivar kubeadmin_password: The password for the kubeadmin user. + :vartype kubeadmin_password: str + """ + + _attribute_map = { + 'kubeadmin_username': {'key': 'kubeadminUsername', 'type': 'str'}, + 'kubeadmin_password': {'key': 'kubeadminPassword', 'type': 'str'}, + } + + def __init__( + self, + *, + kubeadmin_username: Optional[str] = None, + kubeadmin_password: Optional[str] = None, + **kwargs + ): + """ + :keyword kubeadmin_username: The username for the kubeadmin user. + :paramtype kubeadmin_username: str + :keyword kubeadmin_password: The password for the kubeadmin user. + :paramtype kubeadmin_password: str + """ + super(OpenShiftClusterCredentials, self).__init__(**kwargs) + self.kubeadmin_username = kubeadmin_username + self.kubeadmin_password = kubeadmin_password + + +class OpenShiftClusterList(msrest.serialization.Model): + """OpenShiftClusterList represents a list of OpenShift clusters. + + :ivar value: The list of OpenShift clusters. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OpenShiftCluster]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OpenShiftCluster"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of OpenShift clusters. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super(OpenShiftClusterList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OpenShiftClusterUpdate(msrest.serialization.Model): + """OpenShiftCluster represents an Azure Red Hat OpenShift cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar provisioning_state: The cluster provisioning state. Possible values include: + "AdminUpdating", "Cancelled", "Creating", "Deleting", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ProvisioningState + :ivar cluster_profile: The cluster profile. + :vartype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ClusterProfile + :ivar console_profile: The console profile. + :vartype console_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ConsoleProfile + :ivar service_principal_profile: The cluster service principal profile. + :vartype service_principal_profile: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ServicePrincipalProfile + :ivar network_profile: The cluster network profile. + :vartype network_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.NetworkProfile + :ivar master_profile: The cluster master profile. + :vartype master_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MasterProfile + :ivar worker_profiles: The cluster worker profiles. + :vartype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :ivar worker_profiles_status: The cluster worker profiles status. + :vartype worker_profiles_status: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :ivar apiserver_profile: The cluster API server profile. + :vartype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.APIServerProfile + :ivar ingress_profiles: The cluster ingress profiles. + :vartype ingress_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.IngressProfile] + """ + + _validation = { + 'system_data': {'readonly': True}, + 'worker_profiles_status': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'cluster_profile': {'key': 'properties.clusterProfile', 'type': 'ClusterProfile'}, + 'console_profile': {'key': 'properties.consoleProfile', 'type': 'ConsoleProfile'}, + 'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ServicePrincipalProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, + 'master_profile': {'key': 'properties.masterProfile', 'type': 'MasterProfile'}, + 'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'}, + 'worker_profiles_status': {'key': 'properties.workerProfilesStatus', 'type': '[WorkerProfile]'}, + 'apiserver_profile': {'key': 'properties.apiserverProfile', 'type': 'APIServerProfile'}, + 'ingress_profiles': {'key': 'properties.ingressProfiles', 'type': '[IngressProfile]'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + cluster_profile: Optional["ClusterProfile"] = None, + console_profile: Optional["ConsoleProfile"] = None, + service_principal_profile: Optional["ServicePrincipalProfile"] = None, + network_profile: Optional["NetworkProfile"] = None, + master_profile: Optional["MasterProfile"] = None, + worker_profiles: Optional[List["WorkerProfile"]] = None, + apiserver_profile: Optional["APIServerProfile"] = None, + ingress_profiles: Optional[List["IngressProfile"]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. The resource tags. + :paramtype tags: dict[str, str] + :keyword provisioning_state: The cluster provisioning state. Possible values include: + "AdminUpdating", "Cancelled", "Creating", "Deleting", "Failed", "Succeeded", "Updating". + :paramtype provisioning_state: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ProvisioningState + :keyword cluster_profile: The cluster profile. + :paramtype cluster_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ClusterProfile + :keyword console_profile: The console profile. + :paramtype console_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ConsoleProfile + :keyword service_principal_profile: The cluster service principal profile. + :paramtype service_principal_profile: + ~azure.mgmt.redhatopenshift.v2023_11_22.models.ServicePrincipalProfile + :keyword network_profile: The cluster network profile. + :paramtype network_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.NetworkProfile + :keyword master_profile: The cluster master profile. + :paramtype master_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MasterProfile + :keyword worker_profiles: The cluster worker profiles. + :paramtype worker_profiles: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.WorkerProfile] + :keyword apiserver_profile: The cluster API server profile. + :paramtype apiserver_profile: ~azure.mgmt.redhatopenshift.v2023_11_22.models.APIServerProfile + :keyword ingress_profiles: The cluster ingress profiles. + :paramtype ingress_profiles: + list[~azure.mgmt.redhatopenshift.v2023_11_22.models.IngressProfile] + """ + super(OpenShiftClusterUpdate, self).__init__(**kwargs) + self.tags = tags + self.system_data = None + self.provisioning_state = provisioning_state + self.cluster_profile = cluster_profile + self.console_profile = console_profile + self.service_principal_profile = service_principal_profile + self.network_profile = network_profile + self.master_profile = master_profile + self.worker_profiles = worker_profiles + self.worker_profiles_status = None + self.apiserver_profile = apiserver_profile + self.ingress_profiles = ingress_profiles + + +class OpenShiftVersion(ProxyResource): + """OpenShiftVersion represents an OpenShift version that can be installed. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar version: Version represents the version to create the cluster at. + :vartype version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version represents the version to create the cluster at. + :paramtype version: str + """ + super(OpenShiftVersion, self).__init__(**kwargs) + self.version = version + + +class OpenShiftVersionList(msrest.serialization.Model): + """OpenShiftVersionList represents a List of available versions. + + :ivar value: The List of available versions. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftVersion] + :ivar next_link: Next Link to next operation. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OpenShiftVersion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OpenShiftVersion"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The List of available versions. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftVersion] + :keyword next_link: Next Link to next operation. + :paramtype next_link: str + """ + super(OpenShiftVersionList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Operation(msrest.serialization.Model): + """Operation represents an RP operation. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that describes the operation. + :vartype display: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Display + :ivar origin: Sources of requests to this operation. Comma separated list with valid values + user or system, e.g. "user,system". + :vartype origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'Display'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["Display"] = None, + origin: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that describes the operation. + :paramtype display: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Display + :keyword origin: Sources of requests to this operation. Comma separated list with valid values + user or system, e.g. "user,system". + :paramtype origin: str + """ + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + + +class OperationList(msrest.serialization.Model): + """OperationList represents an RP operation list. + + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.Operation] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: List of operations supported by the resource provider. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.Operation] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super(OperationList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OutboundIP(msrest.serialization.Model): + """OutboundIP represents a desired outbound IP resource for the cluster load balancer. + + :ivar id: The fully qualified Azure resource id of an IP address resource. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: The fully qualified Azure resource id of an IP address resource. + :paramtype id: str + """ + super(OutboundIP, self).__init__(**kwargs) + self.id = id + + +class OutboundIPPrefix(msrest.serialization.Model): + """OutboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load balancer. + + :ivar id: The fully qualified Azure resource id of an IP address resource. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: The fully qualified Azure resource id of an IP address resource. + :paramtype id: str + """ + super(OutboundIPPrefix, self).__init__(**kwargs) + self.id = id + + +class Secret(ProxyResource): + """Secret represents a secret. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar secret_resources: The Secrets Resources. + :vartype secret_resources: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'secret_resources': {'key': 'properties.secretResources', 'type': 'str'}, + } + + def __init__( + self, + *, + secret_resources: Optional[str] = None, + **kwargs + ): + """ + :keyword secret_resources: The Secrets Resources. + :paramtype secret_resources: str + """ + super(Secret, self).__init__(**kwargs) + self.secret_resources = secret_resources + + +class SecretList(msrest.serialization.Model): + """SecretList represents a list of Secrets. + + :ivar value: The list of secrets. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Secret]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Secret"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of secrets. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super(SecretList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SecretUpdate(msrest.serialization.Model): + """Secret represents a secret. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar secret_resources: The Secrets Resources. + :vartype secret_resources: str + """ + + _validation = { + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'secret_resources': {'key': 'properties.secretResources', 'type': 'str'}, + } + + def __init__( + self, + *, + secret_resources: Optional[str] = None, + **kwargs + ): + """ + :keyword secret_resources: The Secrets Resources. + :paramtype secret_resources: str + """ + super(SecretUpdate, self).__init__(**kwargs) + self.system_data = None + self.secret_resources = secret_resources + + +class ServicePrincipalProfile(msrest.serialization.Model): + """ServicePrincipalProfile represents a service principal profile. + + :ivar client_id: The client ID used for the cluster. + :vartype client_id: str + :ivar client_secret: The client secret used for the cluster. + :vartype client_secret: str + """ + + _attribute_map = { + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'client_secret': {'key': 'clientSecret', 'type': 'str'}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + **kwargs + ): + """ + :keyword client_id: The client ID used for the cluster. + :paramtype client_id: str + :keyword client_secret: The client secret used for the cluster. + :paramtype client_secret: str + """ + super(ServicePrincipalProfile, self).__init__(**kwargs) + self.client_id = client_id + self.client_secret = client_secret + + +class SyncIdentityProvider(ProxyResource): + """SyncIdentityProvider represents a SyncIdentityProvider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar resources: + :vartype resources: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'resources': {'key': 'properties.resources', 'type': 'str'}, + } + + def __init__( + self, + *, + resources: Optional[str] = None, + **kwargs + ): + """ + :keyword resources: + :paramtype resources: str + """ + super(SyncIdentityProvider, self).__init__(**kwargs) + self.resources = resources + + +class SyncIdentityProviderList(msrest.serialization.Model): + """SyncSetList represents a list of SyncSets. + + :ivar value: The list of sync identity providers. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SyncIdentityProvider]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SyncIdentityProvider"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of sync identity providers. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super(SyncIdentityProviderList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SyncIdentityProviderUpdate(msrest.serialization.Model): + """SyncIdentityProvider represents a SyncIdentityProvider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar resources: + :vartype resources: str + """ + + _validation = { + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'resources': {'key': 'properties.resources', 'type': 'str'}, + } + + def __init__( + self, + *, + resources: Optional[str] = None, + **kwargs + ): + """ + :keyword resources: + :paramtype resources: str + """ + super(SyncIdentityProviderUpdate, self).__init__(**kwargs) + self.system_data = None + self.resources = resources + + +class SyncSet(ProxyResource): + """SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar resources: Resources represents the SyncSets configuration. + :vartype resources: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'resources': {'key': 'properties.resources', 'type': 'str'}, + } + + def __init__( + self, + *, + resources: Optional[str] = None, + **kwargs + ): + """ + :keyword resources: Resources represents the SyncSets configuration. + :paramtype resources: str + """ + super(SyncSet, self).__init__(**kwargs) + self.resources = resources + + +class SyncSetList(msrest.serialization.Model): + """SyncSetList represents a list of SyncSets. + + :ivar value: The list of syncsets. + :vartype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet] + :ivar next_link: The link used to get the next page of operations. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SyncSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SyncSet"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of syncsets. + :paramtype value: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet] + :keyword next_link: The link used to get the next page of operations. + :paramtype next_link: str + """ + super(SyncSetList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SyncSetUpdate(msrest.serialization.Model): + """SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar system_data: The system meta data relating to this resource. + :vartype system_data: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SystemData + :ivar resources: Resources represents the SyncSets configuration. + :vartype resources: str + """ + + _validation = { + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'resources': {'key': 'properties.resources', 'type': 'str'}, + } + + def __init__( + self, + *, + resources: Optional[str] = None, + **kwargs + ): + """ + :keyword resources: Resources represents the SyncSets configuration. + :paramtype resources: str + """ + super(SyncSetUpdate, self).__init__(**kwargs) + self.system_data = None + self.resources = resources + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.redhatopenshift.v2023_11_22.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class WorkerProfile(msrest.serialization.Model): + """WorkerProfile represents a worker profile. + + :ivar name: The worker profile name. + :vartype name: str + :ivar vm_size: The size of the worker VMs. + :vartype vm_size: str + :ivar disk_size_gb: The disk size of the worker VMs. + :vartype disk_size_gb: int + :ivar subnet_id: The Azure resource ID of the worker subnet. + :vartype subnet_id: str + :ivar count: The number of worker VMs. + :vartype count: int + :ivar encryption_at_host: Whether master virtual machines are encrypted at host. Possible + values include: "Disabled", "Enabled". + :vartype encryption_at_host: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.EncryptionAtHost + :ivar disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if + applicable. + :vartype disk_encryption_set_id: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'str'}, + 'disk_encryption_set_id': {'key': 'diskEncryptionSetId', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + vm_size: Optional[str] = None, + disk_size_gb: Optional[int] = None, + subnet_id: Optional[str] = None, + count: Optional[int] = None, + encryption_at_host: Optional[Union[str, "EncryptionAtHost"]] = None, + disk_encryption_set_id: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The worker profile name. + :paramtype name: str + :keyword vm_size: The size of the worker VMs. + :paramtype vm_size: str + :keyword disk_size_gb: The disk size of the worker VMs. + :paramtype disk_size_gb: int + :keyword subnet_id: The Azure resource ID of the worker subnet. + :paramtype subnet_id: str + :keyword count: The number of worker VMs. + :paramtype count: int + :keyword encryption_at_host: Whether master virtual machines are encrypted at host. Possible + values include: "Disabled", "Enabled". + :paramtype encryption_at_host: str or + ~azure.mgmt.redhatopenshift.v2023_11_22.models.EncryptionAtHost + :keyword disk_encryption_set_id: The resource ID of an associated DiskEncryptionSet, if + applicable. + :paramtype disk_encryption_set_id: str + """ + super(WorkerProfile, self).__init__(**kwargs) + self.name = name + self.vm_size = vm_size + self.disk_size_gb = disk_size_gb + self.subnet_id = subnet_id + self.count = count + self.encryption_at_host = encryption_at_host + self.disk_encryption_set_id = disk_encryption_set_id diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/__init__.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/__init__.py new file mode 100644 index 00000000000..3227f81cb2c --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._open_shift_versions_operations import OpenShiftVersionsOperations +from ._open_shift_clusters_operations import OpenShiftClustersOperations +from ._machine_pools_operations import MachinePoolsOperations +from ._secrets_operations import SecretsOperations +from ._sync_identity_providers_operations import SyncIdentityProvidersOperations +from ._sync_sets_operations import SyncSetsOperations + +__all__ = [ + 'Operations', + 'OpenShiftVersionsOperations', + 'OpenShiftClustersOperations', + 'MachinePoolsOperations', + 'SecretsOperations', + 'SyncIdentityProvidersOperations', + 'SyncSetsOperations', +] diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_machine_pools_operations.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_machine_pools_operations.py new file mode 100644 index 00000000000..68ae0d97c81 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_machine_pools_operations.py @@ -0,0 +1,621 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/machinePools") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class MachinePoolsOperations(object): + """MachinePoolsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.redhatopenshift.v2023_11_22.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.MachinePoolList"] + """Lists MachinePools that belong to that Azure Red Hat OpenShift Cluster. + + The operation returns properties of each MachinePool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MachinePoolList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePoolList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.MachinePoolList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MachinePoolList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/machinePools"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MachinePool" + """Gets a MachinePool with the specified subscription, resource group and resource name. + + The operation returns properties of a MachinePool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the MachinePool resource. + :type child_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MachinePool, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MachinePool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MachinePool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + parameters, # type: "_models.MachinePool" + **kwargs # type: Any + ): + # type: (...) -> "_models.MachinePool" + """Creates or updates a MachinePool with the specified subscription, resource group and resource + name. + + The operation returns properties of a MachinePool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the MachinePool resource. + :type child_resource_name: str + :param parameters: The MachinePool resource. + :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MachinePool, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MachinePool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'MachinePool') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MachinePool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('MachinePool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a MachinePool with the specified subscription, resource group and resource name. + + The operation returns nothing. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the MachinePool resource. + :type child_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + parameters, # type: "_models.MachinePoolUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.MachinePool" + """Updates a MachinePool with the specified subscription, resource group and resource name. + + The operation returns properties of a MachinePool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the MachinePool resource. + :type child_resource_name: str + :param parameters: The MachinePool resource. + :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePoolUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MachinePool, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.MachinePool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MachinePool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'MachinePoolUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MachinePool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}"} # type: ignore + diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_clusters_operations.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_clusters_operations.py new file mode 100644 index 00000000000..7c2f1f92166 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_clusters_operations.py @@ -0,0 +1,1076 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id, # type: str + resource_group_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_admin_credentials_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listAdminCredentials") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_credentials_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listCredentials") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class OpenShiftClustersOperations(object): + """OpenShiftClustersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.redhatopenshift.v2023_11_22.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OpenShiftClusterList"] + """Lists OpenShift clusters in the specified subscription. + + The operation returns properties of each OpenShift cluster. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OpenShiftClusterList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftClusterList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OpenShiftClusterList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OpenShiftClusterList"] + """Lists OpenShift clusters in the specified subscription and resource group. + + The operation returns properties of each OpenShift cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OpenShiftClusterList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftClusterList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OpenShiftClusterList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.OpenShiftCluster" + """Gets a OpenShift cluster with the specified subscription, resource group and resource name. + + The operation returns properties of a OpenShift cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OpenShiftCluster, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftCluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OpenShiftCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.OpenShiftCluster" + **kwargs # type: Any + ): + # type: (...) -> "_models.OpenShiftCluster" + cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftCluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OpenShiftCluster') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('OpenShiftCluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('OpenShiftCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.OpenShiftCluster" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.OpenShiftCluster"] + """Creates or updates a OpenShift cluster with the specified subscription, resource group and + resource name. + + The operation returns properties of a OpenShift cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param parameters: The OpenShift cluster resource. + :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftCluster"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OpenShiftCluster', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a OpenShift cluster with the specified subscription, resource group and resource name. + + The operation returns nothing. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}"} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.OpenShiftClusterUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.OpenShiftCluster" + cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftCluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'OpenShiftClusterUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('OpenShiftCluster', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('OpenShiftCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name, # type: str + resource_name, # type: str + parameters, # type: "_models.OpenShiftClusterUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.OpenShiftCluster"] + """Creates or updates a OpenShift cluster with the specified subscription, resource group and + resource name. + + The operation returns properties of a OpenShift cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param parameters: The OpenShift cluster resource. + :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OpenShiftCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftCluster] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftCluster"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('OpenShiftCluster', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}"} # type: ignore + + @distributed_trace + def list_admin_credentials( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.OpenShiftClusterAdminKubeconfig" + """Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group + and resource name. + + The operation returns the admin kubeconfig. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OpenShiftClusterAdminKubeconfig, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterAdminKubeconfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftClusterAdminKubeconfig"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + + request = build_list_admin_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.list_admin_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OpenShiftClusterAdminKubeconfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_admin_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listAdminCredentials"} # type: ignore + + + @distributed_trace + def list_credentials( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.OpenShiftClusterCredentials" + """Lists credentials of an OpenShift cluster with the specified subscription, resource group and + resource name. + + The operation returns the credentials. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OpenShiftClusterCredentials, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftClusterCredentials + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftClusterCredentials"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + + request = build_list_credentials_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.list_credentials.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OpenShiftClusterCredentials', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_credentials.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listCredentials"} # type: ignore + diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_versions_operations.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_versions_operations.py new file mode 100644 index 00000000000..eaa064d0d36 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_open_shift_versions_operations.py @@ -0,0 +1,178 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/openshiftversions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class OpenShiftVersionsOperations(object): + """OpenShiftVersionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.redhatopenshift.v2023_11_22.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OpenShiftVersionList"] + """Lists all OpenShift versions available to install in the specified location. + + The operation returns the installable OpenShift versions as strings. + + :param location: The name of Azure region. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OpenShiftVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.OpenShiftVersionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.OpenShiftVersionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OpenShiftVersionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/openshiftversions"} # type: ignore diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_operations.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_operations.py new file mode 100644 index 00000000000..797cec39b2b --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_operations.py @@ -0,0 +1,162 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.RedHatOpenShift/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.redhatopenshift.v2023_11_22.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationList"] + """Lists all of the available RP operations. + + The operation returns the RP operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.OperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.RedHatOpenShift/operations"} # type: ignore diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_secrets_operations.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_secrets_operations.py new file mode 100644 index 00000000000..0330803fa22 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_secrets_operations.py @@ -0,0 +1,619 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/secrets") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class SecretsOperations(object): + """SecretsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.redhatopenshift.v2023_11_22.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SecretList"] + """Lists Secrets that belong to that Azure Red Hat OpenShift Cluster. + + The operation returns properties of each Secret. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.SecretList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SecretList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/secrets"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Secret" + """Gets a Secret with the specified subscription, resource group and resource name. + + The operation returns properties of a Secret. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the Secret resource. + :type child_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + parameters, # type: "_models.Secret" + **kwargs # type: Any + ): + # type: (...) -> "_models.Secret" + """Creates or updates a Secret with the specified subscription, resource group and resource name. + + The operation returns properties of a Secret. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the Secret resource. + :type child_resource_name: str + :param parameters: The Secret resource. + :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Secret') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Secret', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a Secret with the specified subscription, resource group and resource name. + + The operation returns nothing. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the Secret resource. + :type child_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + parameters, # type: "_models.SecretUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.Secret" + """Updates a Secret with the specified subscription, resource group and resource name. + + The operation returns properties of a Secret. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the Secret resource. + :type child_resource_name: str + :param parameters: The Secret resource. + :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SecretUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SecretUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}"} # type: ignore + diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_identity_providers_operations.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_identity_providers_operations.py new file mode 100644 index 00000000000..98125267936 --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_identity_providers_operations.py @@ -0,0 +1,624 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncIdentityProviders") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class SyncIdentityProvidersOperations(object): + """SyncIdentityProvidersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.redhatopenshift.v2023_11_22.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SyncIdentityProviderList"] + """Lists SyncIdentityProviders that belong to that Azure Red Hat OpenShift Cluster. + + The operation returns properties of each SyncIdentityProvider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SyncIdentityProviderList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProviderList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncIdentityProviderList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SyncIdentityProviderList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncIdentityProviders"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SyncIdentityProvider" + """Gets a SyncIdentityProvider with the specified subscription, resource group and resource name. + + The operation returns properties of a SyncIdentityProvider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the SyncIdentityProvider resource. + :type child_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncIdentityProvider, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncIdentityProvider"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SyncIdentityProvider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + parameters, # type: "_models.SyncIdentityProvider" + **kwargs # type: Any + ): + # type: (...) -> "_models.SyncIdentityProvider" + """Creates or updates a SyncIdentityProvider with the specified subscription, resource group and + resource name. + + The operation returns properties of a SyncIdentityProvider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the SyncIdentityProvider resource. + :type child_resource_name: str + :param parameters: The SyncIdentityProvider resource. + :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncIdentityProvider, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncIdentityProvider"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SyncIdentityProvider') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SyncIdentityProvider', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SyncIdentityProvider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a SyncIdentityProvider with the specified subscription, resource group and resource + name. + + The operation returns nothing. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the SyncIdentityProvider resource. + :type child_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + parameters, # type: "_models.SyncIdentityProviderUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.SyncIdentityProvider" + """Updates a SyncIdentityProvider with the specified subscription, resource group and resource + name. + + The operation returns properties of a SyncIdentityProvider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the SyncIdentityProvider resource. + :type child_resource_name: str + :param parameters: The SyncIdentityProvider resource. + :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProviderUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncIdentityProvider, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncIdentityProvider + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncIdentityProvider"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SyncIdentityProviderUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SyncIdentityProvider', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}"} # type: ignore + diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_sets_operations.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_sets_operations.py new file mode 100644 index 00000000000..d37f2fae4ce --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/operations/_sync_sets_operations.py @@ -0,0 +1,620 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncSets") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id, # type: str + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + "childResourceName": _SERIALIZER.url("child_resource_name", child_resource_name, 'str', max_length=63, min_length=1, pattern=r'^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class SyncSetsOperations(object): + """SyncSetsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.redhatopenshift.v2023_11_22.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SyncSetList"] + """Lists SyncSets that belong to that Azure Red Hat OpenShift Cluster. + + The operation returns properties of each SyncSet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SyncSetList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSetList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncSetList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SyncSetList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncSets"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SyncSet" + """Gets a SyncSet with the specified subscription, resource group and resource name. + + The operation returns properties of a SyncSet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the SyncSet resource. + :type child_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncSet, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SyncSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + parameters, # type: "_models.SyncSet" + **kwargs # type: Any + ): + # type: (...) -> "_models.SyncSet" + """Creates or updates a SyncSet with the specified subscription, resource group and resource name. + + The operation returns properties of a SyncSet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the SyncSet resource. + :type child_resource_name: str + :param parameters: The SyncSet resource. + :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncSet, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SyncSet') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SyncSet', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SyncSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes a SyncSet with the specified subscription, resource group and resource name. + + The operation returns nothing. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the SyncSet resource. + :type child_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name, # type: str + resource_name, # type: str + child_resource_name, # type: str + parameters, # type: "_models.SyncSetUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.SyncSet" + """Updates a SyncSet with the specified subscription, resource group and resource name. + + The operation returns properties of a SyncSet. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the OpenShift cluster resource. + :type resource_name: str + :param child_resource_name: The name of the SyncSet resource. + :type child_resource_name: str + :param parameters: The SyncSet resource. + :type parameters: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSetUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SyncSet, or the result of cls(response) + :rtype: ~azure.mgmt.redhatopenshift.v2023_11_22.models.SyncSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SyncSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2023-11-22") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SyncSetUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + child_resource_name=child_resource_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SyncSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}"} # type: ignore + diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/py.typed b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_CreateOrUpdate.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_CreateOrUpdate.json new file mode 100644 index 00000000000..01e39c9f557 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_CreateOrUpdate.json @@ -0,0 +1,36 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName", + "parameters": { + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K" + } + } + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/machinePools/myMachinePool", + "name": "myMachinePool", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/MachinePools", + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K" + } + } + }, + "201": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/machinePools/myMachinePool", + "name": "myMachinePool", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/MachinePools", + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K" + } + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_Delete.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_Delete.json new file mode 100644 index 00000000000..3d5a2cd49b5 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_Delete.json @@ -0,0 +1,13 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName" + }, + "responses": { + "200": {}, + "204": {} + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_Get.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_Get.json new file mode 100644 index 00000000000..a50ef4f5b6a --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_Get.json @@ -0,0 +1,21 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName" + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/machinePools/myMachinePool", + "name": "myMachinePool", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/MachinePools", + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K" + } + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_List.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_List.json new file mode 100644 index 00000000000..4067f4cf627 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_List.json @@ -0,0 +1,24 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/machinePools/myMachinePool", + "name": "myMachinePool", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/MachinePools", + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K" + } + } + ] + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_Update.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_Update.json new file mode 100644 index 00000000000..af796d529f7 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/MachinePools_Update.json @@ -0,0 +1,26 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName", + "parameters": { + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K" + } + } + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/machinePools/myMachinePool", + "name": "myMachinePool", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/MachinePools", + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiTWFjaGluZVBvb2wiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3Rlci13b3JrZXIiLAogICAgICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LVhYWFhYWFhYWFhYWCIKICAgIH0sCiAgICAic3BlYyI6IHsKICAgICAgICAiY2x1c3RlckRlcGxveW1lbnRSZWYiOiB7CiAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICB9LAogICAgICAgICJuYW1lIjogIndvcmtlciIsCiAgICAgICAgInBsYXRmb3JtIjogewogICAgICAgICAgICAiYXdzIjogewogICAgICAgICAgICAgICAgInJvb3RWb2x1bWUiOiB7CiAgICAgICAgICAgICAgICAgICAgImlvcHMiOiAwLAogICAgICAgICAgICAgICAgICAgICJzaXplIjogMzAwLAogICAgICAgICAgICAgICAgICAgICJ0eXBlIjogImdwMyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidHlwZSI6ICJtNS54bGFyZ2UiLAogICAgICAgICAgICAgICAgInpvbmVzIjogWwogICAgICAgICAgICAgICAgICAgICJ1cy1lYXN0LTFhIgogICAgICAgICAgICAgICAgXQogICAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAicmVwbGljYXMiOiAyCiAgICB9LAogICAgInN0YXR1cyI6IHsKICAgICAgICAiY29uZGl0aW9ucyI6IFsKICAgICAgICBdCiAgICB9Cn0K" + } + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_CreateOrUpdate.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_CreateOrUpdate.json new file mode 100644 index 00000000000..10a69393cac --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_CreateOrUpdate.json @@ -0,0 +1,188 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "parameters": { + "location": "location", + "tags": { + "key": "value" + }, + "properties": { + "clusterProfile": { + "pullSecret": "{\"auths\":{\"registry.connect.redhat.com\":{\"auth\":\"\"},\"registry.redhat.io\":{\"auth\":\"\"}}}", + "domain": "cluster.location.aroapp.io", + "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup", + "fipsValidatedModules": "Enabled" + }, + "consoleProfile": {}, + "servicePrincipalProfile": { + "clientId": "clientId", + "clientSecret": "clientSecret" + }, + "networkProfile": { + "podCidr": "10.128.0.0/14", + "serviceCidr": "172.30.0.0/16", + "loadBalancerProfile": { + "managedOutboundIps": { + "count": 1 + } + }, + "preconfiguredNSG": "Disabled" + }, + "masterProfile": { + "vmSize": "Standard_D8s_v3", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master", + "encryptionAtHost": "Enabled" + }, + "workerProfiles": [ + { + "name": "worker", + "vmSize": "Standard_D2s_v3", + "diskSizeGB": 128, + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "count": 3 + } + ], + "apiserverProfile": { + "visibility": "Public" + }, + "ingressProfiles": [ + { + "name": "default", + "visibility": "Public" + } + ] + } + } + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName", + "name": "resourceName", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters", + "location": "location", + "systemData": { + "createdBy": "string", + "createdByType": "Application", + "createdAt": "2020-02-03T01:01:01.1075056Z", + "lastModifiedBy": "string", + "lastModifiedByType": "Application", + "lastModifiedAt": "2020-02-03T01:01:01.1075056Z" + }, + "tags": { + "key": "value" + }, + "properties": { + "provisioningState": "Succeeded", + "clusterProfile": { + "domain": "cluster.location.aroapp.io", + "version": "4.11.0", + "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup" + }, + "consoleProfile": { + "url": "https://console-openshift-console.apps.cluster.location.aroapp.io/" + }, + "servicePrincipalProfile": { + "clientId": "clientId" + }, + "networkProfile": { + "podCidr": "10.128.0.0/14", + "serviceCidr": "172.30.0.0/16", + "preconfiguredNSG": "Disabled" + }, + "masterProfile": { + "vmSize": "Standard_D8s_v3", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master" + }, + "workerProfiles": [ + { + "name": "worker", + "vmSize": "Standard_D2s_v3", + "diskSizeGB": 128, + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "count": 3 + } + ], + "apiserverProfile": { + "visibility": "Public", + "url": "https://api.cluster.location.aroapp.io:6443/", + "ip": "1.2.3.4" + }, + "ingressProfiles": [ + { + "name": "default", + "visibility": "Public", + "ip": "1.2.3.4" + } + ] + } + } + }, + "201": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName", + "name": "resourceName", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters", + "location": "location", + "systemData": { + "createdBy": "string", + "createdByType": "Application", + "createdAt": "2020-02-03T01:01:01.1075056Z", + "lastModifiedBy": "string", + "lastModifiedByType": "Application", + "lastModifiedAt": "2020-02-03T01:01:01.1075056Z" + }, + "tags": { + "key": "value" + }, + "properties": { + "provisioningState": "Succeeded", + "clusterProfile": { + "domain": "cluster.location.aroapp.io", + "version": "4.11.0", + "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup" + }, + "consoleProfile": { + "url": "https://console-openshift-console.apps.cluster.location.aroapp.io/" + }, + "servicePrincipalProfile": { + "clientId": "clientId" + }, + "networkProfile": { + "podCidr": "10.128.0.0/14", + "serviceCidr": "172.30.0.0/16", + "preconfiguredNSG": "Disabled" + }, + "masterProfile": { + "vmSize": "Standard_D8s_v3", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master" + }, + "workerProfiles": [ + { + "name": "worker", + "vmSize": "Standard_D2s_v3", + "diskSizeGB": 128, + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "count": 3 + } + ], + "apiserverProfile": { + "visibility": "Public", + "url": "https://api.cluster.location.aroapp.io:6443/", + "ip": "1.2.3.4" + }, + "ingressProfiles": [ + { + "name": "default", + "visibility": "Public", + "ip": "1.2.3.4" + } + ] + } + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_Delete.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_Delete.json new file mode 100644 index 00000000000..dde1c91aa8f --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_Delete.json @@ -0,0 +1,16 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName" + }, + "responses": { + "202": { + "headers": { + "location": "https://management.azure.com/subscriptions/subid/providers/Microsoft.Cache/...pathToOperationResult..." + } + }, + "204": {} + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_Get.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_Get.json new file mode 100644 index 00000000000..fc6a923c044 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_Get.json @@ -0,0 +1,83 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName" + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName", + "name": "resourceName", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters", + "location": "location", + "systemData": { + "createdBy": "string", + "createdByType": "Application", + "createdAt": "2020-02-03T01:01:01.1075056Z", + "lastModifiedBy": "string", + "lastModifiedByType": "Application", + "lastModifiedAt": "2020-02-03T01:01:01.1075056Z" + }, + "tags": { + "key": "value" + }, + "properties": { + "provisioningState": "Succeeded", + "clusterProfile": { + "domain": "cluster.location.aroapp.io", + "version": "4.11.0", + "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup" + }, + "consoleProfile": { + "url": "https://console-openshift-console.apps.cluster.location.aroapp.io/" + }, + "servicePrincipalProfile": { + "clientId": "clientId" + }, + "networkProfile": { + "podCidr": "10.128.0.0/14", + "serviceCidr": "172.30.0.0/16", + "loadBalancerProfile": { + "managedOutboundIps": { + "count": 1 + }, + "effectiveOutboundIps": [ + { + "id": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup/providers/Microsoft.Network/publicIPAddresses/publicIPAddressName" + } + ] + }, + "preconfiguredNSG": "Disabled" + }, + "masterProfile": { + "vmSize": "Standard_D8s_v3", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master" + }, + "workerProfiles": [ + { + "name": "worker", + "vmSize": "Standard_D2s_v3", + "diskSizeGB": 128, + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "count": 3 + } + ], + "apiserverProfile": { + "visibility": "Public", + "url": "https://api.cluster.location.aroapp.io:6443/", + "ip": "1.2.3.4" + }, + "ingressProfiles": [ + { + "name": "default", + "visibility": "Public", + "ip": "1.2.3.4" + } + ] + } + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_List.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_List.json new file mode 100644 index 00000000000..54ec68db332 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_List.json @@ -0,0 +1,85 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName", + "name": "resourceName", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters", + "location": "location", + "systemData": { + "createdBy": "string", + "createdByType": "Application", + "createdAt": "2020-02-03T01:01:01.1075056Z", + "lastModifiedBy": "string", + "lastModifiedByType": "Application", + "lastModifiedAt": "2020-02-03T01:01:01.1075056Z" + }, + "tags": { + "key": "value" + }, + "properties": { + "provisioningState": "Succeeded", + "clusterProfile": { + "domain": "cluster.location.aroapp.io", + "version": "4.11.0", + "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup" + }, + "consoleProfile": { + "url": "https://console-openshift-console.apps.cluster.location.aroapp.io/" + }, + "servicePrincipalProfile": { + "clientId": "clientId" + }, + "networkProfile": { + "podCidr": "10.128.0.0/14", + "serviceCidr": "172.30.0.0/16", + "loadBalancerProfile": { + "managedOutboundIps": { + "count": 1 + }, + "effectiveOutboundIps": [ + { + "id": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup/providers/Microsoft.Network/publicIPAddresses/publicIPAddressName" + } + ] + }, + "preconfiguredNSG": "Disabled" + }, + "masterProfile": { + "vmSize": "Standard_D8s_v3", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master" + }, + "workerProfiles": [ + { + "name": "worker", + "vmSize": "Standard_D2s_v3", + "diskSizeGB": 128, + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "count": 3 + } + ], + "apiserverProfile": { + "visibility": "Public", + "url": "https://api.cluster.location.aroapp.io:6443/", + "ip": "1.2.3.4" + }, + "ingressProfiles": [ + { + "name": "default", + "visibility": "Public", + "ip": "1.2.3.4" + } + ] + } + } + ] + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_ListAdminCredentials.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_ListAdminCredentials.json new file mode 100644 index 00000000000..0df1631773f --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_ListAdminCredentials.json @@ -0,0 +1,15 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName" + }, + "responses": { + "200": { + "body": { + "kubeconfig": "e30=" + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_ListByResourceGroup.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_ListByResourceGroup.json new file mode 100644 index 00000000000..39e8fe37893 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_ListByResourceGroup.json @@ -0,0 +1,86 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName", + "name": "resourceName", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters", + "location": "location", + "systemData": { + "createdBy": "string", + "createdByType": "Application", + "createdAt": "2020-02-03T01:01:01.1075056Z", + "lastModifiedBy": "string", + "lastModifiedByType": "Application", + "lastModifiedAt": "2020-02-03T01:01:01.1075056Z" + }, + "tags": { + "key": "value" + }, + "properties": { + "provisioningState": "Succeeded", + "clusterProfile": { + "domain": "cluster.location.aroapp.io", + "version": "4.11.0", + "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup" + }, + "consoleProfile": { + "url": "https://console-openshift-console.apps.cluster.location.aroapp.io/" + }, + "servicePrincipalProfile": { + "clientId": "clientId" + }, + "networkProfile": { + "podCidr": "10.128.0.0/14", + "serviceCidr": "172.30.0.0/16", + "loadBalancerProfile": { + "managedOutboundIps": { + "count": 1 + }, + "effectiveOutboundIps": [ + { + "id": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup/providers/Microsoft.Network/publicIPAddresses/publicIPAddressName" + } + ] + }, + "preconfiguredNSG": "Disabled" + }, + "masterProfile": { + "vmSize": "Standard_D8s_v3", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master" + }, + "workerProfiles": [ + { + "name": "worker", + "vmSize": "Standard_D2s_v3", + "diskSizeGB": 128, + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "count": 3 + } + ], + "apiserverProfile": { + "visibility": "Public", + "url": "https://api.cluster.location.aroapp.io:6443/", + "ip": "1.2.3.4" + }, + "ingressProfiles": [ + { + "name": "default", + "visibility": "Public", + "ip": "1.2.3.4" + } + ] + } + } + ] + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_ListCredentials.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_ListCredentials.json new file mode 100644 index 00000000000..4dabb731de3 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_ListCredentials.json @@ -0,0 +1,16 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName" + }, + "responses": { + "200": { + "body": { + "kubeadminUsername": "kubeadmin", + "kubeadminPassword": "password" + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_Update.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_Update.json new file mode 100644 index 00000000000..fd1ce095749 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftClusters_Update.json @@ -0,0 +1,187 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "parameters": { + "tags": { + "key": "value" + }, + "properties": { + "clusterProfile": { + "pullSecret": "{\"auths\":{\"registry.connect.redhat.com\":{\"auth\":\"\"},\"registry.redhat.io\":{\"auth\":\"\"}}}", + "domain": "cluster.location.aroapp.io", + "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup", + "fipsValidatedModules": "Enabled" + }, + "consoleProfile": {}, + "servicePrincipalProfile": { + "clientId": "clientId", + "clientSecret": "clientSecret" + }, + "networkProfile": { + "podCidr": "10.128.0.0/14", + "serviceCidr": "172.30.0.0/16", + "loadBalancerProfile": { + "managedOutboundIps": { + "count": 1 + } + }, + "preconfiguredNSG": "Disabled" + }, + "masterProfile": { + "vmSize": "Standard_D8s_v3", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master", + "encryptionAtHost": "Enabled" + }, + "workerProfiles": [ + { + "name": "worker", + "vmSize": "Standard_D2s_v3", + "diskSizeGB": 128, + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "count": 3 + } + ], + "apiserverProfile": { + "visibility": "Public" + }, + "ingressProfiles": [ + { + "name": "default", + "visibility": "Public" + } + ] + } + } + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName", + "name": "resourceName", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters", + "location": "location", + "systemData": { + "createdBy": "string", + "createdByType": "Application", + "createdAt": "2020-02-03T01:01:01.1075056Z", + "lastModifiedBy": "string", + "lastModifiedByType": "Application", + "lastModifiedAt": "2020-02-03T01:01:01.1075056Z" + }, + "tags": { + "key": "value" + }, + "properties": { + "provisioningState": "Succeeded", + "clusterProfile": { + "domain": "cluster.location.aroapp.io", + "version": "4.11.0", + "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup" + }, + "consoleProfile": { + "url": "https://console-openshift-console.apps.cluster.location.aroapp.io/" + }, + "servicePrincipalProfile": { + "clientId": "clientId" + }, + "networkProfile": { + "podCidr": "10.128.0.0/14", + "serviceCidr": "172.30.0.0/16", + "preconfiguredNSG": "Disabled" + }, + "masterProfile": { + "vmSize": "Standard_D8s_v3", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master" + }, + "workerProfiles": [ + { + "name": "worker", + "vmSize": "Standard_D2s_v3", + "diskSizeGB": 128, + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "count": 3 + } + ], + "apiserverProfile": { + "visibility": "Public", + "url": "https://api.cluster.location.aroapp.io:6443/", + "ip": "1.2.3.4" + }, + "ingressProfiles": [ + { + "name": "default", + "visibility": "Public", + "ip": "1.2.3.4" + } + ] + } + } + }, + "201": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName", + "name": "resourceName", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters", + "location": "location", + "systemData": { + "createdBy": "string", + "createdByType": "Application", + "createdAt": "2020-02-03T01:01:01.1075056Z", + "lastModifiedBy": "string", + "lastModifiedByType": "Application", + "lastModifiedAt": "2020-02-03T01:01:01.1075056Z" + }, + "tags": { + "key": "value" + }, + "properties": { + "provisioningState": "Succeeded", + "clusterProfile": { + "domain": "cluster.location.aroapp.io", + "version": "4.11.0", + "resourceGroupId": "/subscriptions/subscriptionId/resourceGroups/clusterResourceGroup" + }, + "consoleProfile": { + "url": "https://console-openshift-console.apps.cluster.location.aroapp.io/" + }, + "servicePrincipalProfile": { + "clientId": "clientId" + }, + "networkProfile": { + "podCidr": "10.128.0.0/14", + "serviceCidr": "172.30.0.0/16", + "preconfiguredNSG": "Disabled" + }, + "masterProfile": { + "vmSize": "Standard_D8s_v3", + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/master" + }, + "workerProfiles": [ + { + "name": "worker", + "vmSize": "Standard_D2s_v3", + "diskSizeGB": 128, + "subnetId": "/subscriptions/subscriptionId/resourceGroups/vnetResourceGroup/providers/Microsoft.Network/virtualNetworks/vnet/subnets/worker", + "count": 3 + } + ], + "apiserverProfile": { + "visibility": "Public", + "url": "https://api.cluster.location.aroapp.io:6443/", + "ip": "1.2.3.4" + }, + "ingressProfiles": [ + { + "name": "default", + "visibility": "Public", + "ip": "1.2.3.4" + } + ] + } + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftVersions_List.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftVersions_List.json new file mode 100644 index 00000000000..91a8ad7872f --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/OpenShiftVersions_List.json @@ -0,0 +1,21 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "location": "location" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "00000000-0000-0000-0000-000000000000", + "properties": { + "version": "4.10.20" + } + } + ] + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Operations_List.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Operations_List.json new file mode 100644 index 00000000000..a90f71333f9 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Operations_List.json @@ -0,0 +1,21 @@ +{ + "parameters": { + "api-version": "2023-11-22" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "Microsoft.RedHatOpenShift/openShiftClusters/read", + "display": { + "provider": "Azure Red Hat OpenShift", + "resource": "openShiftClusters", + "operation": "Read OpenShift cluster" + } + } + ] + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_CreateOrUpdate.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_CreateOrUpdate.json new file mode 100644 index 00000000000..98f64f5e212 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_CreateOrUpdate.json @@ -0,0 +1,30 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName", + "parameters": { + "properties": {} + } + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/secret/mySecret", + "name": "mySecret", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/Secrets", + "properties": {} + } + }, + "201": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/secret/mySecret", + "name": "mySecret", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/Secrets", + "properties": {} + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_Delete.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_Delete.json new file mode 100644 index 00000000000..3d5a2cd49b5 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_Delete.json @@ -0,0 +1,13 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName" + }, + "responses": { + "200": {}, + "204": {} + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_Get.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_Get.json new file mode 100644 index 00000000000..569d39c301c --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_Get.json @@ -0,0 +1,19 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName" + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/secret/mySecret", + "name": "mySecret", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/Secrets", + "properties": {} + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_List.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_List.json new file mode 100644 index 00000000000..b44854cbd27 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_List.json @@ -0,0 +1,22 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/secret/mySecret", + "name": "mySecret", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/Secrets", + "properties": {} + } + ] + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_Update.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_Update.json new file mode 100644 index 00000000000..d7653907e0d --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/Secrets_Update.json @@ -0,0 +1,22 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName", + "parameters": { + "properties": {} + } + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/secret/mySecret", + "name": "mySecret", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/Secrets", + "properties": {} + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_CreateOrUpdate.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_CreateOrUpdate.json new file mode 100644 index 00000000000..ed46e62809a --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_CreateOrUpdate.json @@ -0,0 +1,36 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName", + "parameters": { + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==" + } + } + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/syncidentityprovider/mySyncIdentityProvider", + "name": "mySyncIdentityProvider", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/SyncIdentityProviders", + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==" + } + } + }, + "201": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/syncidentityprovider/mySyncIdentityProvider", + "name": "mySyncIdentityProvider", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/SyncIdentityProviders", + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==" + } + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_Delete.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_Delete.json new file mode 100644 index 00000000000..3d5a2cd49b5 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_Delete.json @@ -0,0 +1,13 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName" + }, + "responses": { + "200": {}, + "204": {} + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_Get.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_Get.json new file mode 100644 index 00000000000..3acf8cc6c3a --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_Get.json @@ -0,0 +1,21 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName" + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/syncidentityprovider/mySyncIdentityProvider", + "name": "mySyncIdentityProvider", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/SyncIdentityProviders", + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==" + } + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_List.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_List.json new file mode 100644 index 00000000000..6d2db20590c --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_List.json @@ -0,0 +1,24 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/syncidentityprovider/mySyncIdentityProvider", + "name": "mySyncIdentityProvider", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/SyncIdentityProviders", + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==" + } + } + ] + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_Update.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_Update.json new file mode 100644 index 00000000000..f2f59b597e3 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncIdentityProviders_Update.json @@ -0,0 +1,26 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName", + "parameters": { + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==" + } + } + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/syncidentityprovider/mySyncIdentityProvider", + "name": "mySyncIdentityProvider", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/SyncIdentityProviders", + "properties": { + "resources": "ewogICAgImFwaVZlcnNpb24iOiAiaGl2ZS5vcGVuc2hpZnQuaW8vdjEiLAogICAgImtpbmQiOiAiU3luY0lkZW50aXR5UHJvdmlkZXIiLAogICAgIm1ldGFkYXRhIjogewogICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIsCiAgICAgICAgIm5hbWVzcGFjZSI6ICJhcm8tZjYwYWU4YTItYmNhMS00OTg3LTkwNTYtWFhYWFhYWFhYWFhYIgogICAgfSwKICAgICJzcGVjIjogewogICAgICAgICJjbHVzdGVyRGVwbG95bWVudFJlZnMiOiBbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICJuYW1lIjogInRlc3QtY2x1c3RlciIKICAgICAgICAgICAgfQogICAgICAgIF0sCiAgICAgICAgImlkZW50aXR5UHJvdmlkZXJzIjogWwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiaHRwYXNzd2QiOiB7CiAgICAgICAgICAgICAgICAgICAgImZpbGVEYXRhIjogewogICAgICAgICAgICAgICAgICAgICAgICAibmFtZSI6ICJodHBhc3N3ZC1zZWNyZXQiCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJtYXBwaW5nTWV0aG9kIjogImNsYWltIiwKICAgICAgICAgICAgICAgICJuYW1lIjogIkhUUGFzc3dkIiwKICAgICAgICAgICAgICAgICJ0eXBlIjogIkhUUGFzc3dkIgogICAgICAgICAgICB9CiAgICAgICAgXQogICAgfSwKICAgICJzdGF0dXMiOiB7fQp9Cg==" + } + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_CreateOrUpdate.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_CreateOrUpdate.json new file mode 100644 index 00000000000..7a00651e976 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_CreateOrUpdate.json @@ -0,0 +1,36 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName", + "parameters": { + "properties": { + "resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=" + } + } + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/syncSets/mySyncSet", + "name": "mySyncSet", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/SyncSets", + "properties": { + "resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=" + } + } + }, + "201": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/syncSets/mySyncSet", + "name": "mySyncSet", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/SyncSets", + "properties": { + "resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=" + } + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_Delete.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_Delete.json new file mode 100644 index 00000000000..3d5a2cd49b5 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_Delete.json @@ -0,0 +1,13 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName" + }, + "responses": { + "200": {}, + "204": {} + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_Get.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_Get.json new file mode 100644 index 00000000000..565d95e1f7b --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_Get.json @@ -0,0 +1,21 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName" + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/syncSets/mySyncSet", + "name": "mySyncSet", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/SyncSets", + "properties": { + "resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=" + } + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_List.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_List.json new file mode 100644 index 00000000000..e61ed10c099 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_List.json @@ -0,0 +1,24 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/syncSets/mySyncSet", + "name": "mySyncSet", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/SyncSets", + "properties": { + "resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=" + } + } + ] + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_Update.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_Update.json new file mode 100644 index 00000000000..478ea709c24 --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/examples/SyncSets_Update.json @@ -0,0 +1,26 @@ +{ + "parameters": { + "api-version": "2023-11-22", + "subscriptionId": "subscriptionId", + "resourceGroupName": "resourceGroup", + "resourceName": "resourceName", + "childResourceName": "childResourceName", + "parameters": { + "properties": { + "resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=" + } + } + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/Microsoft.RedHatOpenShift/OpenShiftClusters/resourceName/syncSets/mySyncSet", + "name": "mySyncSet", + "type": "Microsoft.RedHatOpenShift/OpenShiftClusters/SyncSets", + "properties": { + "resources": "eyAKICAiYXBpVmVyc2lvbiI6ICJoaXZlLm9wZW5zaGlmdC5pby92MSIsCiAgImtpbmQiOiAiU3luY1NldCIsCiAgIm1ldGFkYXRhIjogewogICAgIm5hbWUiOiAic2FtcGxlIiwKICAgICJuYW1lc3BhY2UiOiAiYXJvLWY2MGFlOGEyLWJjYTEtNDk4Ny05MDU2LWYyZjZhMTgzN2NhYSIKICB9LAogICJzcGVjIjogewogICAgImNsdXN0ZXJEZXBsb3ltZW50UmVmcyI6IFtdLAogICAgInJlc291cmNlcyI6IFsKICAgICAgewogICAgICAgICJhcGlWZXJzaW9uIjogInYxIiwKICAgICAgICAia2luZCI6ICJDb25maWdNYXAiLAogICAgICAgICJtZXRhZGF0YSI6IHsKICAgICAgICAgICJuYW1lIjogIm15Y29uZmlnbWFwIgogICAgICAgIH0KICAgICAgfQogICAgXQogIH0KfQo=" + } + } + } + } +} diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json new file mode 100644 index 00000000000..e17e6e4ee9f --- /dev/null +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json @@ -0,0 +1,2644 @@ +{ + "swagger": "2.0", + "info": { + "title": "Azure Red Hat OpenShift Client", + "description": "Rest API for Azure Red Hat OpenShift 4", + "version": "2023-11-22" + }, + "host": "management.azure.com", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/providers/Microsoft.RedHatOpenShift/operations": { + "get": { + "tags": [ + "Operations" + ], + "summary": "Lists all of the available RP operations.", + "description": "The operation returns the RP operations.", + "operationId": "Operations_List", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/OperationList" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Lists all of the available RP operations.": { + "$ref": "./examples/Operations_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/locations/{location}/openshiftversions": { + "get": { + "tags": [ + "OpenShiftVersions" + ], + "summary": "Lists all OpenShift versions available to install in the specified location.", + "description": "The operation returns the installable OpenShift versions as strings.", + "operationId": "OpenShiftVersions_List", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/LocationParameter" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/OpenShiftVersionList" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Lists all OpenShift versions available to install in the specified location.": { + "$ref": "./examples/OpenShiftVersions_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters": { + "get": { + "tags": [ + "OpenShiftClusters" + ], + "summary": "Lists OpenShift clusters in the specified subscription.", + "description": "The operation returns properties of each OpenShift cluster.", + "operationId": "OpenShiftClusters_List", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/OpenShiftClusterList" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Lists OpenShift clusters in the specified subscription.": { + "$ref": "./examples/OpenShiftClusters_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/machinePools": { + "get": { + "tags": [ + "MachinePools" + ], + "summary": "Lists MachinePools that belong to that Azure Red Hat OpenShift Cluster.", + "description": "The operation returns properties of each MachinePool.", + "operationId": "MachinePools_List", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/MachinePoolList" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Lists MachinePools that belong to that Azure Red Hat OpenShift Cluster.": { + "$ref": "./examples/MachinePools_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/secrets": { + "get": { + "tags": [ + "Secrets" + ], + "summary": "Lists Secrets that belong to that Azure Red Hat OpenShift Cluster.", + "description": "The operation returns properties of each Secret.", + "operationId": "Secrets_List", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SecretList" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Lists Secrets that belong to that Azure Red Hat OpenShift Cluster.": { + "$ref": "./examples/Secrets_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncIdentityProviders": { + "get": { + "tags": [ + "SyncIdentityProviders" + ], + "summary": "Lists SyncIdentityProviders that belong to that Azure Red Hat OpenShift Cluster.", + "description": "The operation returns properties of each SyncIdentityProvider.", + "operationId": "SyncIdentityProviders_List", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SyncIdentityProviderList" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Lists SyncIdentityProviders that belong to that Azure Red Hat OpenShift Cluster.": { + "$ref": "./examples/SyncIdentityProviders_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftCluster/{resourceName}/syncSets": { + "get": { + "tags": [ + "SyncSets" + ], + "summary": "Lists SyncSets that belong to that Azure Red Hat OpenShift Cluster.", + "description": "The operation returns properties of each SyncSet.", + "operationId": "SyncSets_List", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SyncSetList" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Lists SyncSets that belong to that Azure Red Hat OpenShift Cluster.": { + "$ref": "./examples/SyncSets_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters": { + "get": { + "tags": [ + "OpenShiftClusters" + ], + "summary": "Lists OpenShift clusters in the specified subscription and resource group.", + "description": "The operation returns properties of each OpenShift cluster.", + "operationId": "OpenShiftClusters_ListByResourceGroup", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/OpenShiftClusterList" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Lists OpenShift clusters in the specified subscription and resource group.": { + "$ref": "./examples/OpenShiftClusters_ListByResourceGroup.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}": { + "get": { + "tags": [ + "OpenShiftClusters" + ], + "summary": "Gets a OpenShift cluster with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a OpenShift cluster.", + "operationId": "OpenShiftClusters_Get", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/OpenShiftCluster" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Gets a OpenShift cluster with the specified subscription, resource group and resource name.": { + "$ref": "./examples/OpenShiftClusters_Get.json" + } + } + }, + "put": { + "tags": [ + "OpenShiftClusters" + ], + "summary": "Creates or updates a OpenShift cluster with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a OpenShift cluster.", + "operationId": "OpenShiftClusters_CreateOrUpdate", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string" + }, + { + "name": "parameters", + "in": "body", + "description": "The OpenShift cluster resource.", + "required": true, + "schema": { + "$ref": "#/definitions/OpenShiftCluster" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/OpenShiftCluster" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/OpenShiftCluster" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "Creates or updates a OpenShift cluster with the specified subscription, resource group and resource name.": { + "$ref": "./examples/OpenShiftClusters_CreateOrUpdate.json" + } + } + }, + "delete": { + "tags": [ + "OpenShiftClusters" + ], + "summary": "Deletes a OpenShift cluster with the specified subscription, resource group and resource name.", + "description": "The operation returns nothing.", + "operationId": "OpenShiftClusters_Delete", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string" + } + ], + "responses": { + "202": { + "description": "Accepted" + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "Deletes a OpenShift cluster with the specified subscription, resource group and resource name.": { + "$ref": "./examples/OpenShiftClusters_Delete.json" + } + } + }, + "patch": { + "tags": [ + "OpenShiftClusters" + ], + "summary": "Creates or updates a OpenShift cluster with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a OpenShift cluster.", + "operationId": "OpenShiftClusters_Update", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string" + }, + { + "name": "parameters", + "in": "body", + "description": "The OpenShift cluster resource.", + "required": true, + "schema": { + "$ref": "#/definitions/OpenShiftClusterUpdate" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/OpenShiftCluster" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/OpenShiftCluster" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-long-running-operation": true, + "x-ms-examples": { + "Creates or updates a OpenShift cluster with the specified subscription, resource group and resource name.": { + "$ref": "./examples/OpenShiftClusters_Update.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listAdminCredentials": { + "post": { + "tags": [ + "OpenShiftClusters" + ], + "summary": "Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group and resource name.", + "description": "The operation returns the admin kubeconfig.", + "operationId": "OpenShiftClusters_ListAdminCredentials", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/OpenShiftClusterAdminKubeconfig" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Lists admin kubeconfig of an OpenShift cluster with the specified subscription, resource group and resource name.": { + "$ref": "./examples/OpenShiftClusters_ListAdminCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/listCredentials": { + "post": { + "tags": [ + "OpenShiftClusters" + ], + "summary": "Lists credentials of an OpenShift cluster with the specified subscription, resource group and resource name.", + "description": "The operation returns the credentials.", + "operationId": "OpenShiftClusters_ListCredentials", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/OpenShiftClusterCredentials" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Lists credentials of an OpenShift cluster with the specified subscription, resource group and resource name.": { + "$ref": "./examples/OpenShiftClusters_ListCredentials.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/machinePool/{childResourceName}": { + "get": { + "tags": [ + "MachinePools" + ], + "summary": "Gets a MachinePool with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a MachinePool.", + "operationId": "MachinePools_Get", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the MachinePool resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/MachinePool" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Gets a MachinePool with the specified subscription, resource group and resource name.": { + "$ref": "./examples/MachinePools_Get.json" + } + } + }, + "put": { + "tags": [ + "MachinePools" + ], + "summary": "Creates or updates a MachinePool with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a MachinePool.", + "operationId": "MachinePools_CreateOrUpdate", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the MachinePool resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "parameters", + "in": "body", + "description": "The MachinePool resource.", + "required": true, + "schema": { + "$ref": "#/definitions/MachinePool" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/MachinePool" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/MachinePool" + } + }, + "default": { + "description": "Error response describing why the operation failed. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Creates or updates a MachinePool with the specified subscription, resource group and resource name.": { + "$ref": "./examples/MachinePools_CreateOrUpdate.json" + } + } + }, + "delete": { + "tags": [ + "MachinePools" + ], + "summary": "Deletes a MachinePool with the specified subscription, resource group and resource name.", + "description": "The operation returns nothing.", + "operationId": "MachinePools_Delete", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the MachinePool resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + } + ], + "responses": { + "200": { + "description": "OK" + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Deletes a MachinePool with the specified subscription, resource group and resource name.": { + "$ref": "./examples/MachinePools_Delete.json" + } + } + }, + "patch": { + "tags": [ + "MachinePools" + ], + "summary": "Updates a MachinePool with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a MachinePool.", + "operationId": "MachinePools_Update", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the MachinePool resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "parameters", + "in": "body", + "description": "The MachinePool resource.", + "required": true, + "schema": { + "$ref": "#/definitions/MachinePoolUpdate" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/MachinePool" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Updates a MachinePool with the specified subscription, resource group and resource name.": { + "$ref": "./examples/MachinePools_Update.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/secret/{childResourceName}": { + "get": { + "tags": [ + "Secrets" + ], + "summary": "Gets a Secret with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a Secret.", + "operationId": "Secrets_Get", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the Secret resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Secret" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Gets a Secret with the specified subscription, resource group and resource name.": { + "$ref": "./examples/Secrets_Get.json" + } + } + }, + "put": { + "tags": [ + "Secrets" + ], + "summary": "Creates or updates a Secret with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a Secret.", + "operationId": "Secrets_CreateOrUpdate", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the Secret resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "parameters", + "in": "body", + "description": "The Secret resource.", + "required": true, + "schema": { + "$ref": "#/definitions/Secret" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Secret" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/Secret" + } + }, + "default": { + "description": "Error response describing why the operation failed. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Creates or updates a Secret with the specified subscription, resource group and resource name.": { + "$ref": "./examples/Secrets_CreateOrUpdate.json" + } + } + }, + "delete": { + "tags": [ + "Secrets" + ], + "summary": "Deletes a Secret with the specified subscription, resource group and resource name.", + "description": "The operation returns nothing.", + "operationId": "Secrets_Delete", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the Secret resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + } + ], + "responses": { + "200": { + "description": "OK" + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Deletes a Secret with the specified subscription, resource group and resource name.": { + "$ref": "./examples/Secrets_Delete.json" + } + } + }, + "patch": { + "tags": [ + "Secrets" + ], + "summary": "Updates a Secret with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a Secret.", + "operationId": "Secrets_Update", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the Secret resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "parameters", + "in": "body", + "description": "The Secret resource.", + "required": true, + "schema": { + "$ref": "#/definitions/SecretUpdate" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Secret" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Updates a Secret with the specified subscription, resource group and resource name.": { + "$ref": "./examples/Secrets_Update.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncIdentityProvider/{childResourceName}": { + "get": { + "tags": [ + "SyncIdentityProviders" + ], + "summary": "Gets a SyncIdentityProvider with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a SyncIdentityProvider.", + "operationId": "SyncIdentityProviders_Get", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the SyncIdentityProvider resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SyncIdentityProvider" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Gets a SyncIdentityProvider with the specified subscription, resource group and resource name.": { + "$ref": "./examples/SyncIdentityProviders_Get.json" + } + } + }, + "put": { + "tags": [ + "SyncIdentityProviders" + ], + "summary": "Creates or updates a SyncIdentityProvider with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a SyncIdentityProvider.", + "operationId": "SyncIdentityProviders_CreateOrUpdate", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the SyncIdentityProvider resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "parameters", + "in": "body", + "description": "The SyncIdentityProvider resource.", + "required": true, + "schema": { + "$ref": "#/definitions/SyncIdentityProvider" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SyncIdentityProvider" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/SyncIdentityProvider" + } + }, + "default": { + "description": "Error response describing why the operation failed. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Creates or updates a SyncIdentityProvider with the specified subscription, resource group and resource name.": { + "$ref": "./examples/SyncIdentityProviders_CreateOrUpdate.json" + } + } + }, + "delete": { + "tags": [ + "SyncIdentityProviders" + ], + "summary": "Deletes a SyncIdentityProvider with the specified subscription, resource group and resource name.", + "description": "The operation returns nothing.", + "operationId": "SyncIdentityProviders_Delete", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the SyncIdentityProvider resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + } + ], + "responses": { + "200": { + "description": "OK" + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Deletes a SyncIdentityProvider with the specified subscription, resource group and resource name.": { + "$ref": "./examples/SyncIdentityProviders_Delete.json" + } + } + }, + "patch": { + "tags": [ + "SyncIdentityProviders" + ], + "summary": "Updates a SyncIdentityProvider with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a SyncIdentityProvider.", + "operationId": "SyncIdentityProviders_Update", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the SyncIdentityProvider resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "parameters", + "in": "body", + "description": "The SyncIdentityProvider resource.", + "required": true, + "schema": { + "$ref": "#/definitions/SyncIdentityProviderUpdate" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SyncIdentityProvider" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Updates a SyncIdentityProvider with the specified subscription, resource group and resource name.": { + "$ref": "./examples/SyncIdentityProviders_Update.json" + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openshiftclusters/{resourceName}/syncSet/{childResourceName}": { + "get": { + "tags": [ + "SyncSets" + ], + "summary": "Gets a SyncSet with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a SyncSet.", + "operationId": "SyncSets_Get", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the SyncSet resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SyncSet" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Gets a SyncSet with the specified subscription, resource group and resource name.": { + "$ref": "./examples/SyncSets_Get.json" + } + } + }, + "put": { + "tags": [ + "SyncSets" + ], + "summary": "Creates or updates a SyncSet with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a SyncSet.", + "operationId": "SyncSets_CreateOrUpdate", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the SyncSet resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "parameters", + "in": "body", + "description": "The SyncSet resource.", + "required": true, + "schema": { + "$ref": "#/definitions/SyncSet" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SyncSet" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/SyncSet" + } + }, + "default": { + "description": "Error response describing why the operation failed. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Creates or updates a SyncSet with the specified subscription, resource group and resource name.": { + "$ref": "./examples/SyncSets_CreateOrUpdate.json" + } + } + }, + "delete": { + "tags": [ + "SyncSets" + ], + "summary": "Deletes a SyncSet with the specified subscription, resource group and resource name.", + "description": "The operation returns nothing.", + "operationId": "SyncSets_Delete", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the SyncSet resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + } + ], + "responses": { + "200": { + "description": "OK" + }, + "204": { + "description": "No Content" + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Deletes a SyncSet with the specified subscription, resource group and resource name.": { + "$ref": "./examples/SyncSets_Delete.json" + } + } + }, + "patch": { + "tags": [ + "SyncSets" + ], + "summary": "Updates a SyncSet with the specified subscription, resource group and resource name.", + "description": "The operation returns properties of a SyncSet.", + "operationId": "SyncSets_Update", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/SubscriptionIdParameter" + }, + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ResourceGroupNameParameter" + }, + { + "name": "resourceName", + "in": "path", + "description": "The name of the OpenShift cluster resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "childResourceName", + "in": "path", + "description": "The name of the SyncSet resource.", + "required": true, + "type": "string", + "maxLength": 63, + "minLength": 1, + "pattern": "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]*[a-zA-Z0-9]$" + }, + { + "name": "parameters", + "in": "body", + "description": "The SyncSet resource.", + "required": true, + "schema": { + "$ref": "#/definitions/SyncSetUpdate" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/SyncSet" + } + }, + "default": { + "description": "Error response describing why the operation failed. If the resource doesn't exist, 404 (Not Found) is returned. If any of the input parameters is wrong, 400 (Bad Request) is returned.", + "schema": { + "$ref": "#/definitions/CloudError" + } + } + }, + "x-ms-examples": { + "Updates a SyncSet with the specified subscription, resource group and resource name.": { + "$ref": "./examples/SyncSets_Update.json" + } + } + } + } + }, + "definitions": { + "APIServerProfile": { + "description": "APIServerProfile represents an API server profile.", + "type": "object", + "properties": { + "visibility": { + "$ref": "#/definitions/Visibility", + "description": "API server visibility." + }, + "url": { + "description": "The URL to access the cluster API server.", + "type": "string" + }, + "ip": { + "description": "The IP of the cluster API server.", + "type": "string" + } + } + }, + "CloudError": { + "description": "CloudError represents a cloud error.", + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/CloudErrorBody", + "description": "An error response from the service." + } + } + }, + "CloudErrorBody": { + "description": "CloudErrorBody represents the body of a cloud error.", + "type": "object", + "properties": { + "code": { + "description": "An identifier for the error. Codes are invariant and are intended to be consumed programmatically.", + "type": "string" + }, + "message": { + "description": "A message describing the error, intended to be suitable for display in a user interface.", + "type": "string" + }, + "target": { + "description": "The target of the particular error. For example, the name of the property in error.", + "type": "string" + }, + "details": { + "description": "A list of additional details about the error.", + "type": "array", + "items": { + "$ref": "#/definitions/CloudErrorBody" + }, + "x-ms-identifiers": [] + } + } + }, + "ClusterProfile": { + "description": "ClusterProfile represents a cluster profile.", + "type": "object", + "properties": { + "pullSecret": { + "description": "The pull secret for the cluster.", + "type": "string" + }, + "domain": { + "description": "The domain for the cluster.", + "type": "string" + }, + "version": { + "description": "The version of the cluster.", + "type": "string" + }, + "resourceGroupId": { + "description": "The ID of the cluster resource group.", + "type": "string" + }, + "fipsValidatedModules": { + "$ref": "#/definitions/FipsValidatedModules", + "description": "If FIPS validated crypto modules are used" + } + } + }, + "ConsoleProfile": { + "description": "ConsoleProfile represents a console profile.", + "type": "object", + "properties": { + "url": { + "description": "The URL to access the cluster console.", + "type": "string" + } + } + }, + "Display": { + "description": "Display represents the display details of an operation.", + "type": "object", + "properties": { + "provider": { + "description": "Friendly name of the resource provider.", + "type": "string" + }, + "resource": { + "description": "Resource type on which the operation is performed.", + "type": "string" + }, + "operation": { + "description": "Operation type: read, write, delete, listKeys/action, etc.", + "type": "string" + }, + "description": { + "description": "Friendly name of the operation.", + "type": "string" + } + } + }, + "EffectiveOutboundIP": { + "description": "EffectiveOutboundIP represents an effective outbound IP resource of the cluster public load balancer.", + "type": "object", + "properties": { + "id": { + "description": "The fully qualified Azure resource id of an IP address resource.", + "type": "string" + } + } + }, + "EncryptionAtHost": { + "description": "EncryptionAtHost represents encryption at host state", + "enum": [ + "Disabled", + "Enabled" + ], + "type": "string", + "x-ms-enum": { + "name": "EncryptionAtHost", + "modelAsString": true + } + }, + "FipsValidatedModules": { + "description": "FipsValidatedModules determines if FIPS is used.", + "enum": [ + "Disabled", + "Enabled" + ], + "type": "string", + "x-ms-enum": { + "name": "FipsValidatedModules", + "modelAsString": true + } + }, + "IngressProfile": { + "description": "IngressProfile represents an ingress profile.", + "type": "object", + "properties": { + "name": { + "description": "The ingress profile name.", + "type": "string" + }, + "visibility": { + "$ref": "#/definitions/Visibility", + "description": "Ingress visibility." + }, + "ip": { + "description": "The IP of the ingress.", + "type": "string" + } + } + }, + "LoadBalancerProfile": { + "description": "LoadBalancerProfile represents the profile of the cluster public load balancer.", + "type": "object", + "properties": { + "managedOutboundIps": { + "$ref": "#/definitions/ManagedOutboundIPs", + "description": "The desired managed outbound IPs for the cluster public load balancer." + }, + "effectiveOutboundIps": { + "description": "The list of effective outbound IP addresses of the public load balancer.", + "type": "array", + "items": { + "$ref": "#/definitions/EffectiveOutboundIP" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "outboundIps": { + "description": "The desired outbound IP resources for the cluster load balancer.", + "type": "array", + "items": { + "$ref": "#/definitions/OutboundIP" + }, + "x-ms-identifiers": [] + }, + "outboundIpPrefixes": { + "description": "The desired outbound IP Prefix resources for the cluster load balancer.", + "type": "array", + "items": { + "$ref": "#/definitions/OutboundIPPrefix" + }, + "x-ms-identifiers": [] + }, + "allocatedOutboundPorts": { + "format": "int32", + "description": "The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 1024.", + "type": "integer" + } + } + }, + "MachinePool": { + "description": "MachinePool represents a MachinePool", + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ProxyResource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/MachinePoolProperties", + "description": "The MachinePool Properties", + "x-ms-client-flatten": true + }, + "systemData": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData", + "description": "The system meta data relating to this resource.", + "readOnly": true + } + } + }, + "MachinePoolList": { + "description": "MachinePoolList represents a list of MachinePools", + "type": "object", + "properties": { + "value": { + "description": "The list of Machine Pools.", + "type": "array", + "items": { + "$ref": "#/definitions/MachinePool" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "description": "The link used to get the next page of operations.", + "type": "string" + } + } + }, + "MachinePoolProperties": { + "description": "MachinePoolProperties represents the properties of a MachinePool", + "type": "object", + "properties": { + "resources": { + "type": "string" + } + } + }, + "MachinePoolUpdate": { + "description": "MachinePool represents a MachinePool", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/MachinePoolProperties", + "description": "The MachinePool Properties", + "x-ms-client-flatten": true + }, + "systemData": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData", + "description": "The system meta data relating to this resource.", + "readOnly": true + } + } + }, + "ManagedOutboundIPs": { + "description": "ManagedOutboundIPs represents the desired managed outbound IPs for the cluster public load balancer.", + "type": "object", + "properties": { + "count": { + "format": "int32", + "description": "Count represents the desired number of IPv4 outbound IPs created and managed by Azure for the cluster public load balancer. Allowed values are in the range of 1 - 20. The default value is 1.", + "type": "integer" + } + } + }, + "MasterProfile": { + "description": "MasterProfile represents a master profile.", + "type": "object", + "properties": { + "vmSize": { + "$ref": "#/definitions/VMSize", + "description": "The size of the master VMs." + }, + "subnetId": { + "description": "The Azure resource ID of the master subnet.", + "type": "string" + }, + "encryptionAtHost": { + "$ref": "#/definitions/EncryptionAtHost", + "description": "Whether master virtual machines are encrypted at host." + }, + "diskEncryptionSetId": { + "description": "The resource ID of an associated DiskEncryptionSet, if applicable.", + "type": "string" + } + } + }, + "NetworkProfile": { + "description": "NetworkProfile represents a network profile.", + "type": "object", + "properties": { + "podCidr": { + "description": "The CIDR used for OpenShift/Kubernetes Pods.", + "type": "string" + }, + "serviceCidr": { + "description": "The CIDR used for OpenShift/Kubernetes Services.", + "type": "string" + }, + "outboundType": { + "$ref": "#/definitions/OutboundType", + "description": "The OutboundType used for egress traffic." + }, + "loadBalancerProfile": { + "$ref": "#/definitions/LoadBalancerProfile", + "description": "The cluster load balancer profile." + }, + "preconfiguredNSG": { + "$ref": "#/definitions/PreconfiguredNSG", + "description": "Specifies whether subnets are pre-attached with an NSG" + } + } + }, + "OpenShiftCluster": { + "description": "OpenShiftCluster represents an Azure Red Hat OpenShift cluster.", + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/TrackedResource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/OpenShiftClusterProperties", + "description": "The cluster properties.", + "x-ms-client-flatten": true + }, + "systemData": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData", + "description": "The system meta data relating to this resource.", + "readOnly": true + } + } + }, + "OpenShiftClusterAdminKubeconfig": { + "description": "OpenShiftClusterAdminKubeconfig represents an OpenShift cluster's admin kubeconfig.", + "type": "object", + "properties": { + "kubeconfig": { + "description": "The base64-encoded kubeconfig file.", + "type": "string", + "x-ms-secret": true + } + } + }, + "OpenShiftClusterCredentials": { + "description": "OpenShiftClusterCredentials represents an OpenShift cluster's credentials.", + "type": "object", + "properties": { + "kubeadminUsername": { + "description": "The username for the kubeadmin user.", + "type": "string" + }, + "kubeadminPassword": { + "description": "The password for the kubeadmin user.", + "type": "string", + "x-ms-secret": true + } + } + }, + "OpenShiftClusterList": { + "description": "OpenShiftClusterList represents a list of OpenShift clusters.", + "type": "object", + "properties": { + "value": { + "description": "The list of OpenShift clusters.", + "type": "array", + "items": { + "$ref": "#/definitions/OpenShiftCluster" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "description": "The link used to get the next page of operations.", + "type": "string" + } + } + }, + "OpenShiftClusterProperties": { + "description": "OpenShiftClusterProperties represents an OpenShift cluster's properties.", + "type": "object", + "properties": { + "provisioningState": { + "$ref": "#/definitions/ProvisioningState", + "description": "The cluster provisioning state." + }, + "clusterProfile": { + "$ref": "#/definitions/ClusterProfile", + "description": "The cluster profile." + }, + "consoleProfile": { + "$ref": "#/definitions/ConsoleProfile", + "description": "The console profile." + }, + "servicePrincipalProfile": { + "$ref": "#/definitions/ServicePrincipalProfile", + "description": "The cluster service principal profile." + }, + "networkProfile": { + "$ref": "#/definitions/NetworkProfile", + "description": "The cluster network profile." + }, + "masterProfile": { + "$ref": "#/definitions/MasterProfile", + "description": "The cluster master profile." + }, + "workerProfiles": { + "description": "The cluster worker profiles.", + "type": "array", + "items": { + "$ref": "#/definitions/WorkerProfile" + }, + "x-ms-identifiers": [] + }, + "workerProfilesStatus": { + "description": "The cluster worker profiles status.", + "type": "array", + "items": { + "$ref": "#/definitions/WorkerProfile" + }, + "readOnly": true, + "x-ms-identifiers": [] + }, + "apiserverProfile": { + "$ref": "#/definitions/APIServerProfile", + "description": "The cluster API server profile." + }, + "ingressProfiles": { + "description": "The cluster ingress profiles.", + "type": "array", + "items": { + "$ref": "#/definitions/IngressProfile" + }, + "x-ms-identifiers": [] + } + } + }, + "OpenShiftClusterUpdate": { + "description": "OpenShiftCluster represents an Azure Red Hat OpenShift cluster.", + "type": "object", + "properties": { + "tags": { + "$ref": "#/definitions/Tags", + "description": "The resource tags." + }, + "properties": { + "$ref": "#/definitions/OpenShiftClusterProperties", + "description": "The cluster properties.", + "x-ms-client-flatten": true + }, + "systemData": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData", + "description": "The system meta data relating to this resource.", + "readOnly": true + } + } + }, + "OpenShiftVersion": { + "description": "OpenShiftVersion represents an OpenShift version that can be installed.", + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ProxyResource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/OpenShiftVersionProperties", + "description": "The properties for the OpenShiftVersion resource.", + "x-ms-client-flatten": true + }, + "systemData": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData", + "description": "The system meta data relating to this resource.", + "readOnly": true + } + } + }, + "OpenShiftVersionList": { + "description": "OpenShiftVersionList represents a List of available versions.", + "type": "object", + "properties": { + "value": { + "description": "The List of available versions.", + "type": "array", + "items": { + "$ref": "#/definitions/OpenShiftVersion" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "description": "Next Link to next operation.", + "type": "string" + } + } + }, + "OpenShiftVersionProperties": { + "description": "OpenShiftVersionProperties represents the properties of an OpenShiftVersion.", + "type": "object", + "properties": { + "version": { + "description": "Version represents the version to create the cluster at.", + "type": "string" + } + } + }, + "Operation": { + "description": "Operation represents an RP operation.", + "type": "object", + "properties": { + "name": { + "description": "Operation name: {provider}/{resource}/{operation}.", + "type": "string" + }, + "display": { + "$ref": "#/definitions/Display", + "description": "The object that describes the operation." + }, + "origin": { + "description": "Sources of requests to this operation. Comma separated list with valid values user or system, e.g. \"user,system\".", + "type": "string" + } + } + }, + "OperationList": { + "description": "OperationList represents an RP operation list.", + "type": "object", + "properties": { + "value": { + "description": "List of operations supported by the resource provider.", + "type": "array", + "items": { + "$ref": "#/definitions/Operation" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "description": "The link used to get the next page of operations.", + "type": "string" + } + } + }, + "OutboundIP": { + "description": "OutboundIP represents a desired outbound IP resource for the cluster load balancer.", + "type": "object", + "properties": { + "id": { + "description": "The fully qualified Azure resource id of an IP address resource.", + "type": "string" + } + } + }, + "OutboundIPPrefix": { + "description": "OutboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load balancer.", + "type": "object", + "properties": { + "id": { + "description": "The fully qualified Azure resource id of an IP address resource.", + "type": "string" + } + } + }, + "OutboundType": { + "description": "The outbound routing strategy used to provide your cluster egress to the internet.", + "enum": [ + "Loadbalancer", + "UserDefinedRouting" + ], + "type": "string", + "x-ms-enum": { + "name": "OutboundType", + "modelAsString": true + } + }, + "PreconfiguredNSG": { + "description": "PreconfiguredNSG represents whether customers want to use their own NSG attached to the subnets", + "enum": [ + "Disabled", + "Enabled" + ], + "type": "string" + }, + "ProvisioningState": { + "description": "ProvisioningState represents a provisioning state.", + "enum": [ + "AdminUpdating", + "Cancelled", + "Creating", + "Deleting", + "Failed", + "Succeeded", + "Updating" + ], + "type": "string" + }, + "Secret": { + "description": "Secret represents a secret.", + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ProxyResource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/SecretProperties", + "description": "The Secret Properties", + "x-ms-client-flatten": true + }, + "systemData": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData", + "description": "The system meta data relating to this resource.", + "readOnly": true + } + } + }, + "SecretList": { + "description": "SecretList represents a list of Secrets", + "type": "object", + "properties": { + "value": { + "description": "The list of secrets.", + "type": "array", + "items": { + "$ref": "#/definitions/Secret" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "description": "The link used to get the next page of operations.", + "type": "string" + } + } + }, + "SecretProperties": { + "description": "SecretProperties represents the properties of a Secret", + "type": "object", + "properties": { + "secretResources": { + "description": "The Secrets Resources.", + "type": "string", + "x-ms-secret": true + } + } + }, + "SecretUpdate": { + "description": "Secret represents a secret.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/SecretProperties", + "description": "The Secret Properties", + "x-ms-client-flatten": true + }, + "systemData": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData", + "description": "The system meta data relating to this resource.", + "readOnly": true + } + } + }, + "ServicePrincipalProfile": { + "description": "ServicePrincipalProfile represents a service principal profile.", + "type": "object", + "properties": { + "clientId": { + "description": "The client ID used for the cluster.", + "type": "string" + }, + "clientSecret": { + "description": "The client secret used for the cluster.", + "type": "string" + } + } + }, + "SyncIdentityProvider": { + "description": "SyncIdentityProvider represents a SyncIdentityProvider", + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ProxyResource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/SyncIdentityProviderProperties", + "description": "The SyncIdentityProvider Properties", + "x-ms-client-flatten": true + }, + "systemData": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData", + "description": "The system meta data relating to this resource.", + "readOnly": true + } + } + }, + "SyncIdentityProviderList": { + "description": "SyncSetList represents a list of SyncSets", + "type": "object", + "properties": { + "value": { + "description": "The list of sync identity providers", + "type": "array", + "items": { + "$ref": "#/definitions/SyncIdentityProvider" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "description": "The link used to get the next page of operations.", + "type": "string" + } + } + }, + "SyncIdentityProviderProperties": { + "description": "SyncSetProperties represents the properties of a SyncSet", + "type": "object", + "properties": { + "resources": { + "type": "string" + } + } + }, + "SyncIdentityProviderUpdate": { + "description": "SyncIdentityProvider represents a SyncIdentityProvider", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/SyncIdentityProviderProperties", + "description": "The SyncIdentityProvider Properties", + "x-ms-client-flatten": true + }, + "systemData": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData", + "description": "The system meta data relating to this resource.", + "readOnly": true + } + } + }, + "SyncSet": { + "description": "SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster.", + "type": "object", + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ProxyResource" + } + ], + "properties": { + "properties": { + "$ref": "#/definitions/SyncSetProperties", + "description": "The Syncsets properties", + "x-ms-client-flatten": true + }, + "systemData": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData", + "description": "The system meta data relating to this resource.", + "readOnly": true + } + } + }, + "SyncSetList": { + "description": "SyncSetList represents a list of SyncSets", + "type": "object", + "properties": { + "value": { + "description": "The list of syncsets.", + "type": "array", + "items": { + "$ref": "#/definitions/SyncSet" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "description": "The link used to get the next page of operations.", + "type": "string" + } + } + }, + "SyncSetProperties": { + "description": "SyncSetProperties represents the properties of a SyncSet", + "type": "object", + "properties": { + "resources": { + "description": "Resources represents the SyncSets configuration.", + "type": "string" + } + } + }, + "SyncSetUpdate": { + "description": "SyncSet represents a SyncSet for an Azure Red Hat OpenShift Cluster.", + "type": "object", + "properties": { + "properties": { + "$ref": "#/definitions/SyncSetProperties", + "description": "The Syncsets properties", + "x-ms-client-flatten": true + }, + "systemData": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/systemData", + "description": "The system meta data relating to this resource.", + "readOnly": true + } + } + }, + "Tags": { + "description": "Tags represents an OpenShift cluster's tags.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "VMSize": { + "description": "VM size availability varies by region.\nIf a node contains insufficient compute resources (memory, cpu, etc.), pods might fail to run correctly.\nFor more details on restricted VM sizes, see: https://docs.microsoft.com/en-us/azure/openshift/support-policies-v4#supported-virtual-machine-sizes", + "type": "string" + }, + "Visibility": { + "description": "Visibility represents visibility.", + "enum": [ + "Private", + "Public" + ], + "type": "string", + "x-ms-enum": { + "name": "Visibility", + "modelAsString": true + } + }, + "WorkerProfile": { + "description": "WorkerProfile represents a worker profile.", + "type": "object", + "properties": { + "name": { + "description": "The worker profile name.", + "type": "string" + }, + "vmSize": { + "$ref": "#/definitions/VMSize", + "description": "The size of the worker VMs." + }, + "diskSizeGB": { + "format": "int32", + "description": "The disk size of the worker VMs.", + "type": "integer" + }, + "subnetId": { + "description": "The Azure resource ID of the worker subnet.", + "type": "string" + }, + "count": { + "format": "int32", + "description": "The number of worker VMs.", + "type": "integer" + }, + "encryptionAtHost": { + "$ref": "#/definitions/EncryptionAtHost", + "description": "Whether master virtual machines are encrypted at host." + }, + "diskEncryptionSetId": { + "description": "The resource ID of an associated DiskEncryptionSet, if applicable.", + "type": "string" + } + } + } + }, + "parameters": { + "api-version": { + "name": "api-version", + "in": "query", + "description": "The version of the API the caller wants to use.", + "required": true, + "type": "string", + "pattern": "^\\d{2}-\\d{2}-\\d{4}(-preview)?$", + "x-ms-parameter-location": "client" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "description": "Azure Active Directory OAuth2 Flow", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + } + } + }, + "security": [ + { + "azure_auth": [ + "user_impersonation" + ] + } + ] +} From 8ac47deda760e53f3405d82ba7f5b399216f0134 Mon Sep 17 00:00:00 2001 From: b-jhoreman Date: Wed, 10 Jan 2024 11:48:20 -0800 Subject: [PATCH 2/4] adding 2023-11-22 stable --- .sha256sum | 2 +- pkg/api/v20231122/openshiftcluster.go | 6 -- pkg/api/v20231122/openshiftcluster_convert.go | 38 --------- .../openshiftcluster_validatestatic.go | 46 +---------- .../mgmt/2023-11-22/redhatopenshift/models.go | 28 ------- .../redhatopenshift/openshiftclusters.go | 54 +++++++++++++ .../openshiftclusters_addons.go | 72 +++++++++++++++++ .../2023-11-22/redhatopenshift/operations.go | 48 ++++++++++++ .../redhatopenshift/operations_addons.go | 33 ++++++++ pkg/util/cluster/cluster.go | 22 +++--- .../v2023_11_22/models/__init__.py | 6 -- .../v2023_11_22/models/_models.py | 70 ----------------- .../v2023_11_22/models/_models_py3.py | 77 ------------------- .../stable/2023-11-22/redhatopenshift.json | 41 ---------- 14 files changed, 223 insertions(+), 320 deletions(-) create mode 100644 pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters.go create mode 100644 pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters_addons.go create mode 100644 pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations.go create mode 100644 pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations_addons.go diff --git a/.sha256sum b/.sha256sum index 1f308d74a62..29d20d7987d 100644 --- a/.sha256sum +++ b/.sha256sum @@ -5,4 +5,4 @@ b1f1de0fe40d05de90742b17928968923b936adc294000f58974f50a297581dd swagger/redhat 01ba9562a8dac2824998ff0ad0d2465f79e6a66597bdb321e9409b9f2d12d222 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-04-01/redhatopenshift.json c023515341196746454c0ae7af077d40d3ec13f6b88b33cb558f0a7ab17a5a24 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2023-07-01-preview/redhatopenshift.json 440748951dd1c3b34b5ccbdcb7cd966e3b89490887a1f1d64429561fad789515 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-09-04/redhatopenshift.json -695bf8dea5e971d23b77e9468f64cbc8abf877b86cd1486b84d6150b5e717ce0 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json +98b241e3225ff4bbe96f4046aea98dae06c2bac2cc0e25ab8d85583bfc7f1861 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json diff --git a/pkg/api/v20231122/openshiftcluster.go b/pkg/api/v20231122/openshiftcluster.go index 73b68fb1d65..583af85e698 100644 --- a/pkg/api/v20231122/openshiftcluster.go +++ b/pkg/api/v20231122/openshiftcluster.go @@ -152,12 +152,6 @@ type LoadBalancerProfile struct { ManagedOutboundIPs *ManagedOutboundIPs `json:"managedOutboundIps,omitempty" mutable:"true"` // The list of effective outbound IP addresses of the public load balancer. EffectiveOutboundIPs []EffectiveOutboundIP `json:"effectiveOutboundIps,omitempty" swagger:"readOnly"` - // The desired outbound IP resources for the cluster load balancer. - OutboundIPs []OutboundIP `json:"outboundIps,omitempty" mutable:"true"` - // The desired outbound IP Prefix resources for the cluster load balancer. - OutboundIPPrefixes []OutboundIPPrefix `json:"outboundIpPrefixes,omitempty" mutable:"true"` - // The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 1024. - AllocatedOutboundPorts *int `json:"allocatedOutboundPorts,omitempty" mutable:"true"` } // EffectiveOutboundIP represents an effective outbound IP resource of the cluster public load balancer. diff --git a/pkg/api/v20231122/openshiftcluster_convert.go b/pkg/api/v20231122/openshiftcluster_convert.go index 539213f1de9..3cb76a517a8 100644 --- a/pkg/api/v20231122/openshiftcluster_convert.go +++ b/pkg/api/v20231122/openshiftcluster_convert.go @@ -58,10 +58,6 @@ func (c openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interfac if oc.Properties.NetworkProfile.LoadBalancerProfile != nil { out.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{} - if oc.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts != nil { - out.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts = oc.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts - } - if oc.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs != nil { out.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs = &ManagedOutboundIPs{ Count: oc.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count, @@ -76,24 +72,6 @@ func (c openShiftClusterConverter) ToExternal(oc *api.OpenShiftCluster) interfac }) } } - - if oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs != nil { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs = make([]OutboundIP, 0, len(oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs)) - for _, outboundIP := range oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs = append(out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs, OutboundIP{ - ID: outboundIP.ID, - }) - } - } - - if oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes != nil { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes = make([]OutboundIPPrefix, 0, len(oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes)) - for _, outboundIPPrefix := range oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes = append(out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes, OutboundIPPrefix{ - ID: outboundIPPrefix.ID, - }) - } - } } if oc.Properties.WorkerProfiles != nil { @@ -216,27 +194,11 @@ func (c openShiftClusterConverter) ToInternal(_oc interface{}, out *api.OpenShif out.Properties.NetworkProfile.LoadBalancerProfile = &loadBalancerProfile - if oc.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts != nil { - out.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts = oc.Properties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts - } - if oc.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs != nil { out.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs = &api.ManagedOutboundIPs{ Count: oc.Properties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count, } } - if oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs != nil { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs = make([]api.OutboundIP, len(oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs)) - for i := range oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs[i].ID = oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPs[i].ID - } - } - if oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes != nil { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes = make([]api.OutboundIPPrefix, len(oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes)) - for i := range oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes { - out.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes[i].ID = oc.Properties.NetworkProfile.LoadBalancerProfile.OutboundIPPrefixes[i].ID - } - } if oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs != nil { out.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs = make([]api.EffectiveOutboundIP, len(oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs)) for i := range oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs { diff --git a/pkg/api/v20231122/openshiftcluster_validatestatic.go b/pkg/api/v20231122/openshiftcluster_validatestatic.go index c8cab37fb0a..6a3fb6ab4b9 100644 --- a/pkg/api/v20231122/openshiftcluster_validatestatic.go +++ b/pkg/api/v20231122/openshiftcluster_validatestatic.go @@ -98,6 +98,9 @@ func (sv openShiftClusterStaticValidator) validateProperties(path string, p *Ope if err := sv.validateNetworkProfile(path+".networkProfile", &p.NetworkProfile, p.APIServerProfile.Visibility, p.IngressProfiles[0].Visibility); err != nil { return err } + if err := sv.validateLoadBalancerProfile(path+".networkProfile.loadBalancerProfile", p.NetworkProfile.LoadBalancerProfile, isCreate); err != nil { + return err + } if err := sv.validateMasterProfile(path+".masterProfile", &p.MasterProfile); err != nil { return err } @@ -245,33 +248,13 @@ func (sv openShiftClusterStaticValidator) validateLoadBalancerProfile(path strin return nil } - err := checkPickedExactlyOne(path, lbp) - if err != nil { - return err - } - switch { case lbp.ManagedOutboundIPs != nil: err := validateManagedOutboundIPs(path, *lbp.ManagedOutboundIPs) if err != nil { return err } - case lbp.OutboundIPs != nil: - err := validateOutboundIPs(path, lbp.OutboundIPs) - if err != nil { - return err - } - case lbp.OutboundIPPrefixes != nil: - err := validateOutboundIPPrefixes(path, lbp.OutboundIPPrefixes) - if err != nil { - return err - } } - - if lbp.AllocatedOutboundPorts != nil { - return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".allocatedOutboundPorts", "The field allocatedOutboundPorts is not implemented at this time, please check back later.") - } - // Prevents EffectiveOutboundIPs from being set during create, // during update validateDelta will prevent the field from being changed. if lbp.EffectiveOutboundIPs != nil && isCreate { @@ -280,21 +263,6 @@ func (sv openShiftClusterStaticValidator) validateLoadBalancerProfile(path strin return nil } -func checkPickedExactlyOne(path string, lbp *LoadBalancerProfile) error { - var isManagedOutboundIPCount = lbp.ManagedOutboundIPs != nil - var isOutboundIPs = lbp.OutboundIPs != nil - var isOutboundIPPrefixes = lbp.OutboundIPPrefixes != nil - - if !isManagedOutboundIPCount && !isOutboundIPPrefixes && !isOutboundIPs { - return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path, "The provided loadBalancerProfile is invalid: must specify one of managedOutboundIps, outboundIps, or outboundIpPrefixes.") - } else if !((isManagedOutboundIPCount && !isOutboundIPs && !isOutboundIPPrefixes) || - (!isManagedOutboundIPCount && isOutboundIPs && !isOutboundIPPrefixes) || - (!isManagedOutboundIPCount && !isOutboundIPs && isOutboundIPPrefixes)) { - return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path, "The provided loadBalancerProfile is invalid: can only use one of managedOutboundIps, outboundIps, or outboundIpPrefixes at a time.") - } - return nil -} - func validateManagedOutboundIPs(path string, managedOutboundIPs ManagedOutboundIPs) error { if !(managedOutboundIPs.Count > 0 && managedOutboundIPs.Count <= 20) { return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".managedOutboundIps.count", "The provided managedOutboundIps.count %d is invalid: managedOutboundIps.count must be in the range of 1 to 20 (inclusive).", managedOutboundIPs.Count) @@ -302,14 +270,6 @@ func validateManagedOutboundIPs(path string, managedOutboundIPs ManagedOutboundI return nil } -func validateOutboundIPs(path string, outboundIPs []OutboundIP) error { - return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".outboundIps", "The field outboundIps is not implemented at this time, please check back later.") -} - -func validateOutboundIPPrefixes(path string, outboundIPPrefixes []OutboundIPPrefix) error { - return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".outboundIpPrefixes", "The field outboundIpPrefixes is not implemented at this time, please check back later.") -} - func (sv openShiftClusterStaticValidator) validateMasterProfile(path string, mp *MasterProfile) error { if !validate.VMSizeIsValid(api.VMSize(mp.VMSize), sv.requireD2sV3Workers, true) { return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".vmSize", "The provided master VM size '%s' is invalid.", mp.VMSize) diff --git a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/models.go b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/models.go index 384b598fcd1..0b52821a121 100644 --- a/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/models.go +++ b/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift/models.go @@ -135,12 +135,6 @@ type LoadBalancerProfile struct { ManagedOutboundIps *ManagedOutboundIPs `json:"managedOutboundIps,omitempty"` // EffectiveOutboundIps - READ-ONLY; The list of effective outbound IP addresses of the public load balancer. EffectiveOutboundIps *[]EffectiveOutboundIP `json:"effectiveOutboundIps,omitempty"` - // OutboundIps - The desired outbound IP resources for the cluster load balancer. - OutboundIps *[]OutboundIP `json:"outboundIps,omitempty"` - // OutboundIPPrefixes - The desired outbound IP Prefix resources for the cluster load balancer. - OutboundIPPrefixes *[]OutboundIPPrefix `json:"outboundIpPrefixes,omitempty"` - // AllocatedOutboundPorts - The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 1024. - AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` } // MarshalJSON is the custom marshaler for LoadBalancerProfile. @@ -149,15 +143,6 @@ func (lbp LoadBalancerProfile) MarshalJSON() ([]byte, error) { if lbp.ManagedOutboundIps != nil { objectMap["managedOutboundIps"] = lbp.ManagedOutboundIps } - if lbp.OutboundIps != nil { - objectMap["outboundIps"] = lbp.OutboundIps - } - if lbp.OutboundIPPrefixes != nil { - objectMap["outboundIpPrefixes"] = lbp.OutboundIPPrefixes - } - if lbp.AllocatedOutboundPorts != nil { - objectMap["allocatedOutboundPorts"] = lbp.AllocatedOutboundPorts - } return json.Marshal(objectMap) } @@ -1441,19 +1426,6 @@ func NewOperationListPage(cur OperationList, getNextPage func(context.Context, O } } -// OutboundIP outboundIP represents a desired outbound IP resource for the cluster load balancer. -type OutboundIP struct { - // ID - The fully qualified Azure resource id of an IP address resource. - ID *string `json:"id,omitempty"` -} - -// OutboundIPPrefix outboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load -// balancer. -type OutboundIPPrefix struct { - // ID - The fully qualified Azure resource id of an IP address resource. - ID *string `json:"id,omitempty"` -} - // ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not // have tags and a location type ProxyResource struct { diff --git a/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters.go b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters.go new file mode 100644 index 00000000000..8161800aa09 --- /dev/null +++ b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters.go @@ -0,0 +1,54 @@ +package redhatopenshift + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "context" + "crypto/tls" + "net/http" + "time" + + "github.com/Azure/go-autorest/autorest" + + mgmtredhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift" + "github.com/Azure/ARO-RP/pkg/env" + "github.com/Azure/ARO-RP/pkg/util/azureclient" +) + +// OpenShiftClustersClient is a minimal interface for azure OpenshiftClustersClient +type OpenShiftClustersClient interface { + ListCredentials(ctx context.Context, resourceGroupName string, resourceName string) (result mgmtredhatopenshift20231122.OpenShiftClusterCredentials, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result mgmtredhatopenshift20231122.OpenShiftCluster, err error) + OpenShiftClustersClientAddons +} + +type openShiftClustersClient struct { + mgmtredhatopenshift20231122.OpenShiftClustersClient +} + +var _ OpenShiftClustersClient = &openShiftClustersClient{} + +// NewOpenShiftClustersClient creates a new OpenShiftClustersClient +func NewOpenShiftClustersClient(environment *azureclient.AROEnvironment, subscriptionID string, authorizer autorest.Authorizer) OpenShiftClustersClient { + var client mgmtredhatopenshift20231122.OpenShiftClustersClient + if env.IsLocalDevelopmentMode() { + client = mgmtredhatopenshift20231122.NewOpenShiftClustersClientWithBaseURI("https://localhost:8443", subscriptionID) + client.Sender = &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, // #nosec G402 + }, + }, + } + } else { + client = mgmtredhatopenshift20231122.NewOpenShiftClustersClientWithBaseURI(environment.ResourceManagerEndpoint, subscriptionID) + client.Authorizer = authorizer + } + client.PollingDelay = 10 * time.Second + client.PollingDuration = 2 * time.Hour + + return &openShiftClustersClient{ + OpenShiftClustersClient: client, + } +} diff --git a/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters_addons.go b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters_addons.go new file mode 100644 index 00000000000..990d196f71a --- /dev/null +++ b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/openshiftclusters_addons.go @@ -0,0 +1,72 @@ +package redhatopenshift + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "context" + + mgmtredhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift" +) + +// OpenShiftClustersClientAddons contains addons for OpenShiftClustersClient +type OpenShiftClustersClientAddons interface { + CreateOrUpdateAndWait(ctx context.Context, resourceGroupName string, resourceName string, parameters mgmtredhatopenshift20231122.OpenShiftCluster) error + DeleteAndWait(ctx context.Context, resourceGroupName string, resourceName string) error + List(ctx context.Context) (clusters []mgmtredhatopenshift20231122.OpenShiftCluster, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (clusters []mgmtredhatopenshift20231122.OpenShiftCluster, err error) +} + +func (c *openShiftClustersClient) CreateOrUpdateAndWait(ctx context.Context, resourceGroupName string, resourceName string, parameters mgmtredhatopenshift20231122.OpenShiftCluster) error { + future, err := c.CreateOrUpdate(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + return err + } + + return future.WaitForCompletionRef(ctx, c.Client) +} + +func (c *openShiftClustersClient) DeleteAndWait(ctx context.Context, resourceGroupName string, resourceName string) error { + future, err := c.Delete(ctx, resourceGroupName, resourceName) + if err != nil { + return err + } + + return future.WaitForCompletionRef(ctx, c.Client) +} + +func (c *openShiftClustersClient) List(ctx context.Context) (clusters []mgmtredhatopenshift20231122.OpenShiftCluster, err error) { + page, err := c.OpenShiftClustersClient.List(ctx) + if err != nil { + return nil, err + } + + for page.NotDone() { + clusters = append(clusters, page.Values()...) + + err = page.NextWithContext(ctx) + if err != nil { + return nil, err + } + } + + return clusters, nil +} + +func (c *openShiftClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (clusters []mgmtredhatopenshift20231122.OpenShiftCluster, err error) { + page, err := c.OpenShiftClustersClient.ListByResourceGroup(ctx, resourceGroupName) + if err != nil { + return nil, err + } + + for page.NotDone() { + clusters = append(clusters, page.Values()...) + + err = page.NextWithContext(ctx) + if err != nil { + return nil, err + } + } + + return clusters, nil +} diff --git a/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations.go b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations.go new file mode 100644 index 00000000000..9fd1ed394b8 --- /dev/null +++ b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations.go @@ -0,0 +1,48 @@ +package redhatopenshift + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "crypto/tls" + "net/http" + + "github.com/Azure/go-autorest/autorest" + + mgmtredhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift" + "github.com/Azure/ARO-RP/pkg/env" + "github.com/Azure/ARO-RP/pkg/util/azureclient" +) + +// OperationsClient is a minimal interface for azure OperationsClient +type OperationsClient interface { + OperationsClientAddons +} + +type operationsClient struct { + mgmtredhatopenshift20231122.OperationsClient +} + +var _ OperationsClient = &operationsClient{} + +// NewOperationsClient creates a new OperationsClient +func NewOperationsClient(environment *azureclient.AROEnvironment, subscriptionID string, authorizer autorest.Authorizer) OperationsClient { + var client mgmtredhatopenshift20231122.OperationsClient + if env.IsLocalDevelopmentMode() { + client = mgmtredhatopenshift20231122.NewOperationsClientWithBaseURI("https://localhost:8443", subscriptionID) + client.Sender = &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + InsecureSkipVerify: true, // #nosec G402 + }, + }, + } + } else { + client = mgmtredhatopenshift20231122.NewOperationsClientWithBaseURI(environment.ResourceManagerEndpoint, subscriptionID) + client.Authorizer = authorizer + } + + return &operationsClient{ + OperationsClient: client, + } +} diff --git a/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations_addons.go b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations_addons.go new file mode 100644 index 00000000000..56960e23f5f --- /dev/null +++ b/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift/operations_addons.go @@ -0,0 +1,33 @@ +package redhatopenshift + +// Copyright (c) Microsoft Corporation. +// Licensed under the Apache License 2.0. + +import ( + "context" + + mgmtredhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift" +) + +// OperationsClientAddons contains addons for OperationsClient +type OperationsClientAddons interface { + List(ctx context.Context) (operations []mgmtredhatopenshift20231122.Operation, err error) +} + +func (c *operationsClient) List(ctx context.Context) (operations []mgmtredhatopenshift20231122.Operation, err error) { + page, err := c.OperationsClient.List(ctx) + if err != nil { + return nil, err + } + + for page.NotDone() { + operations = append(operations, page.Values()...) + + err = page.NextWithContext(ctx) + if err != nil { + return nil, err + } + } + + return operations, nil +} diff --git a/pkg/util/cluster/cluster.go b/pkg/util/cluster/cluster.go index 888cf9496b1..fe0d5cd8e27 100644 --- a/pkg/util/cluster/cluster.go +++ b/pkg/util/cluster/cluster.go @@ -28,8 +28,8 @@ import ( "k8s.io/apimachinery/pkg/util/wait" "github.com/Azure/ARO-RP/pkg/api" - v20220904 "github.com/Azure/ARO-RP/pkg/api/v20220904" - mgmtredhatopenshift20220904 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2022-09-04/redhatopenshift" + v20231122 "github.com/Azure/ARO-RP/pkg/api/v20231122" + mgmtredhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/client/services/redhatopenshift/mgmt/2023-11-22/redhatopenshift" "github.com/Azure/ARO-RP/pkg/deploy/assets" "github.com/Azure/ARO-RP/pkg/deploy/generator" "github.com/Azure/ARO-RP/pkg/env" @@ -41,7 +41,7 @@ import ( redhatopenshift20200430 "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/redhatopenshift/2020-04-30/redhatopenshift" redhatopenshift20210901preview "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/redhatopenshift/2021-09-01-preview/redhatopenshift" redhatopenshift20220401 "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/redhatopenshift/2022-04-01/redhatopenshift" - redhatopenshift20220904 "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/redhatopenshift/2022-09-04/redhatopenshift" + redhatopenshift20231122 "github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/redhatopenshift/2023-11-22/redhatopenshift" utilgraph "github.com/Azure/ARO-RP/pkg/util/graph" "github.com/Azure/ARO-RP/pkg/util/rbac" "github.com/Azure/ARO-RP/pkg/util/uuid" @@ -60,7 +60,8 @@ type Cluster struct { openshiftclustersv20200430 redhatopenshift20200430.OpenShiftClustersClient openshiftclustersv20210901preview redhatopenshift20210901preview.OpenShiftClustersClient openshiftclustersv20220401 redhatopenshift20220401.OpenShiftClustersClient - openshiftclustersv20220904 redhatopenshift20220904.OpenShiftClustersClient + openshiftclustersv20220904 redhatopenshift20231122.OpenShiftClustersClient + openshiftclustersv20231122 redhatopenshift20231122.OpenShiftClustersClient securitygroups network.SecurityGroupsClient subnets network.SubnetsClient routetables network.RouteTablesClient @@ -115,7 +116,8 @@ func New(log *logrus.Entry, environment env.Core, ci bool) (*Cluster, error) { openshiftclustersv20200430: redhatopenshift20200430.NewOpenShiftClustersClient(environment.Environment(), environment.SubscriptionID(), authorizer), openshiftclustersv20210901preview: redhatopenshift20210901preview.NewOpenShiftClustersClient(environment.Environment(), environment.SubscriptionID(), authorizer), openshiftclustersv20220401: redhatopenshift20220401.NewOpenShiftClustersClient(environment.Environment(), environment.SubscriptionID(), authorizer), - openshiftclustersv20220904: redhatopenshift20220904.NewOpenShiftClustersClient(environment.Environment(), environment.SubscriptionID(), authorizer), + openshiftclustersv20220904: redhatopenshift20231122.NewOpenShiftClustersClient(environment.Environment(), environment.SubscriptionID(), authorizer), + openshiftclustersv20231122: redhatopenshift20231122.NewOpenShiftClustersClient(environment.Environment(), environment.SubscriptionID(), authorizer), securitygroups: network.NewSecurityGroupsClient(environment.Environment(), environment.SubscriptionID(), authorizer), subnets: network.NewSubnetsClient(environment.Environment(), environment.SubscriptionID(), authorizer), routetables: network.NewRouteTablesClient(environment.Environment(), environment.SubscriptionID(), authorizer), @@ -140,9 +142,9 @@ func New(log *logrus.Entry, environment env.Core, ci bool) (*Cluster, error) { } func (c *Cluster) Create(ctx context.Context, vnetResourceGroup, clusterName string, osClusterVersion string) error { - clusterGet, err := c.openshiftclustersv20220904.Get(ctx, vnetResourceGroup, clusterName) + clusterGet, err := c.openshiftclustersv20231122.Get(ctx, vnetResourceGroup, clusterName) if err == nil { - if clusterGet.ProvisioningState == mgmtredhatopenshift20220904.Failed { + if clusterGet.ProvisioningState == mgmtredhatopenshift20231122.Failed { return fmt.Errorf("cluster exists and is in failed provisioning state, please delete and retry") } c.log.Print("cluster already exists, skipping create") @@ -501,19 +503,19 @@ func (c *Cluster) createCluster(ctx context.Context, vnetResourceGroup, clusterN oc.Properties.WorkerProfiles[0].VMSize = api.VMSizeStandardD2sV3 } - ext := api.APIs[v20220904.APIVersion].OpenShiftClusterConverter.ToExternal(&oc) + ext := api.APIs[v20231122.APIVersion].OpenShiftClusterConverter.ToExternal(&oc) data, err := json.Marshal(ext) if err != nil { return err } - ocExt := mgmtredhatopenshift20220904.OpenShiftCluster{} + ocExt := mgmtredhatopenshift20231122.OpenShiftCluster{} err = json.Unmarshal(data, &ocExt) if err != nil { return err } - return c.openshiftclustersv20220904.CreateOrUpdateAndWait(ctx, vnetResourceGroup, clusterName, ocExt) + return c.openshiftclustersv20231122.CreateOrUpdateAndWait(ctx, vnetResourceGroup, clusterName, ocExt) } func (c *Cluster) registerSubscription(ctx context.Context) error { diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py index 04fa6db30f2..f06920c51cb 100644 --- a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/__init__.py @@ -38,8 +38,6 @@ from ._models_py3 import OpenShiftVersionList from ._models_py3 import Operation from ._models_py3 import OperationList - from ._models_py3 import OutboundIP - from ._models_py3 import OutboundIPPrefix from ._models_py3 import ProxyResource from ._models_py3 import Resource from ._models_py3 import Secret @@ -79,8 +77,6 @@ from ._models import OpenShiftVersionList # type: ignore from ._models import Operation # type: ignore from ._models import OperationList # type: ignore - from ._models import OutboundIP # type: ignore - from ._models import OutboundIPPrefix # type: ignore from ._models import ProxyResource # type: ignore from ._models import Resource # type: ignore from ._models import Secret # type: ignore @@ -131,8 +127,6 @@ 'OpenShiftVersionList', 'Operation', 'OperationList', - 'OutboundIP', - 'OutboundIPPrefix', 'ProxyResource', 'Resource', 'Secret', diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models.py index e79467eec33..b182f547a86 100644 --- a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models.py +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models.py @@ -285,15 +285,6 @@ class LoadBalancerProfile(msrest.serialization.Model): balancer. :vartype effective_outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.EffectiveOutboundIP] - :ivar outbound_ips: The desired outbound IP resources for the cluster load balancer. - :vartype outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIP] - :ivar outbound_ip_prefixes: The desired outbound IP Prefix resources for the cluster load - balancer. - :vartype outbound_ip_prefixes: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIPPrefix] - :ivar allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed - values are in the range of 0 to 64000 (inclusive). The default value is 1024. - :vartype allocated_outbound_ports: int """ _validation = { @@ -303,9 +294,6 @@ class LoadBalancerProfile(msrest.serialization.Model): _attribute_map = { 'managed_outbound_ips': {'key': 'managedOutboundIps', 'type': 'ManagedOutboundIPs'}, 'effective_outbound_ips': {'key': 'effectiveOutboundIps', 'type': '[EffectiveOutboundIP]'}, - 'outbound_ips': {'key': 'outboundIps', 'type': '[OutboundIP]'}, - 'outbound_ip_prefixes': {'key': 'outboundIpPrefixes', 'type': '[OutboundIPPrefix]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, } def __init__( @@ -317,22 +305,10 @@ def __init__( balancer. :paramtype managed_outbound_ips: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ManagedOutboundIPs - :keyword outbound_ips: The desired outbound IP resources for the cluster load balancer. - :paramtype outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIP] - :keyword outbound_ip_prefixes: The desired outbound IP Prefix resources for the cluster load - balancer. - :paramtype outbound_ip_prefixes: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIPPrefix] - :keyword allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed - values are in the range of 0 to 64000 (inclusive). The default value is 1024. - :paramtype allocated_outbound_ports: int """ super(LoadBalancerProfile, self).__init__(**kwargs) self.managed_outbound_ips = kwargs.get('managed_outbound_ips', None) self.effective_outbound_ips = None - self.outbound_ips = kwargs.get('outbound_ips', None) - self.outbound_ip_prefixes = kwargs.get('outbound_ip_prefixes', None) - self.allocated_outbound_ports = kwargs.get('allocated_outbound_ports', None) class Resource(msrest.serialization.Model): @@ -1159,52 +1135,6 @@ def __init__( self.next_link = kwargs.get('next_link', None) -class OutboundIP(msrest.serialization.Model): - """OutboundIP represents a desired outbound IP resource for the cluster load balancer. - - :ivar id: The fully qualified Azure resource id of an IP address resource. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: The fully qualified Azure resource id of an IP address resource. - :paramtype id: str - """ - super(OutboundIP, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class OutboundIPPrefix(msrest.serialization.Model): - """OutboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load balancer. - - :ivar id: The fully qualified Azure resource id of an IP address resource. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - :keyword id: The fully qualified Azure resource id of an IP address resource. - :paramtype id: str - """ - super(OutboundIPPrefix, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - class Secret(ProxyResource): """Secret represents a secret. diff --git a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py index 9948402c352..97c198d0319 100644 --- a/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py +++ b/python/client/azure/mgmt/redhatopenshift/v2023_11_22/models/_models_py3.py @@ -318,15 +318,6 @@ class LoadBalancerProfile(msrest.serialization.Model): balancer. :vartype effective_outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.EffectiveOutboundIP] - :ivar outbound_ips: The desired outbound IP resources for the cluster load balancer. - :vartype outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIP] - :ivar outbound_ip_prefixes: The desired outbound IP Prefix resources for the cluster load - balancer. - :vartype outbound_ip_prefixes: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIPPrefix] - :ivar allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed - values are in the range of 0 to 64000 (inclusive). The default value is 1024. - :vartype allocated_outbound_ports: int """ _validation = { @@ -336,18 +327,12 @@ class LoadBalancerProfile(msrest.serialization.Model): _attribute_map = { 'managed_outbound_ips': {'key': 'managedOutboundIps', 'type': 'ManagedOutboundIPs'}, 'effective_outbound_ips': {'key': 'effectiveOutboundIps', 'type': '[EffectiveOutboundIP]'}, - 'outbound_ips': {'key': 'outboundIps', 'type': '[OutboundIP]'}, - 'outbound_ip_prefixes': {'key': 'outboundIpPrefixes', 'type': '[OutboundIPPrefix]'}, - 'allocated_outbound_ports': {'key': 'allocatedOutboundPorts', 'type': 'int'}, } def __init__( self, *, managed_outbound_ips: Optional["ManagedOutboundIPs"] = None, - outbound_ips: Optional[List["OutboundIP"]] = None, - outbound_ip_prefixes: Optional[List["OutboundIPPrefix"]] = None, - allocated_outbound_ports: Optional[int] = None, **kwargs ): """ @@ -355,22 +340,10 @@ def __init__( balancer. :paramtype managed_outbound_ips: ~azure.mgmt.redhatopenshift.v2023_11_22.models.ManagedOutboundIPs - :keyword outbound_ips: The desired outbound IP resources for the cluster load balancer. - :paramtype outbound_ips: list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIP] - :keyword outbound_ip_prefixes: The desired outbound IP Prefix resources for the cluster load - balancer. - :paramtype outbound_ip_prefixes: - list[~azure.mgmt.redhatopenshift.v2023_11_22.models.OutboundIPPrefix] - :keyword allocated_outbound_ports: The desired number of allocated SNAT ports per VM. Allowed - values are in the range of 0 to 64000 (inclusive). The default value is 1024. - :paramtype allocated_outbound_ports: int """ super(LoadBalancerProfile, self).__init__(**kwargs) self.managed_outbound_ips = managed_outbound_ips self.effective_outbound_ips = None - self.outbound_ips = outbound_ips - self.outbound_ip_prefixes = outbound_ip_prefixes - self.allocated_outbound_ports = allocated_outbound_ports class Resource(msrest.serialization.Model): @@ -1263,56 +1236,6 @@ def __init__( self.next_link = next_link -class OutboundIP(msrest.serialization.Model): - """OutboundIP represents a desired outbound IP resource for the cluster load balancer. - - :ivar id: The fully qualified Azure resource id of an IP address resource. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): - """ - :keyword id: The fully qualified Azure resource id of an IP address resource. - :paramtype id: str - """ - super(OutboundIP, self).__init__(**kwargs) - self.id = id - - -class OutboundIPPrefix(msrest.serialization.Model): - """OutboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load balancer. - - :ivar id: The fully qualified Azure resource id of an IP address resource. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): - """ - :keyword id: The fully qualified Azure resource id of an IP address resource. - :paramtype id: str - """ - super(OutboundIPPrefix, self).__init__(**kwargs) - self.id = id - - class Secret(ProxyResource): """Secret represents a secret. diff --git a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json index e17e6e4ee9f..ef92b1dd5a7 100644 --- a/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json +++ b/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/stable/2023-11-22/redhatopenshift.json @@ -1914,27 +1914,6 @@ }, "readOnly": true, "x-ms-identifiers": [] - }, - "outboundIps": { - "description": "The desired outbound IP resources for the cluster load balancer.", - "type": "array", - "items": { - "$ref": "#/definitions/OutboundIP" - }, - "x-ms-identifiers": [] - }, - "outboundIpPrefixes": { - "description": "The desired outbound IP Prefix resources for the cluster load balancer.", - "type": "array", - "items": { - "$ref": "#/definitions/OutboundIPPrefix" - }, - "x-ms-identifiers": [] - }, - "allocatedOutboundPorts": { - "format": "int32", - "description": "The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 1024.", - "type": "integer" } } }, @@ -2290,26 +2269,6 @@ } } }, - "OutboundIP": { - "description": "OutboundIP represents a desired outbound IP resource for the cluster load balancer.", - "type": "object", - "properties": { - "id": { - "description": "The fully qualified Azure resource id of an IP address resource.", - "type": "string" - } - } - }, - "OutboundIPPrefix": { - "description": "OutboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load balancer.", - "type": "object", - "properties": { - "id": { - "description": "The fully qualified Azure resource id of an IP address resource.", - "type": "string" - } - } - }, "OutboundType": { "description": "The outbound routing strategy used to provide your cluster egress to the internet.", "enum": [ From c52200835a755aef4cea55e2e1ea0e9476c816fc Mon Sep 17 00:00:00 2001 From: b-jhoreman Date: Mon, 15 Jan 2024 15:22:06 -0800 Subject: [PATCH 3/4] fixing delta between versions for test and removing unused defs --- pkg/api/v20231122/openshiftcluster.go | 6 - .../openshiftcluster_validatestatic_test.go | 118 ++++++++++++++++++ 2 files changed, 118 insertions(+), 6 deletions(-) diff --git a/pkg/api/v20231122/openshiftcluster.go b/pkg/api/v20231122/openshiftcluster.go index 583af85e698..b2667b62b34 100644 --- a/pkg/api/v20231122/openshiftcluster.go +++ b/pkg/api/v20231122/openshiftcluster.go @@ -163,12 +163,6 @@ type ManagedOutboundIPs struct { Count int `json:"count,omitempty"` } -// OutboundIP represents a desired outbound IP resource for the cluster load balancer. -type OutboundIP ResourceReference - -// OutboundIPPrefix represents a desired outbound IP Prefix resource for the cluster load balancer. -type OutboundIPPrefix ResourceReference - // NetworkProfile represents a network profile. type NetworkProfile struct { // The CIDR used for OpenShift/Kubernetes Pods. diff --git a/pkg/api/v20231122/openshiftcluster_validatestatic_test.go b/pkg/api/v20231122/openshiftcluster_validatestatic_test.go index 36101be3817..03de661d722 100644 --- a/pkg/api/v20231122/openshiftcluster_validatestatic_test.go +++ b/pkg/api/v20231122/openshiftcluster_validatestatic_test.go @@ -538,8 +538,94 @@ func TestOpenShiftClusterStaticValidateNetworkProfile(t *testing.T) { }, wantErr: "", }, + { + name: "LoadBalancerProfile invalid when used with UserDefinedRouting", + current: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.OutboundType = OutboundTypeUserDefinedRouting + oc.Properties.IngressProfiles[0].Visibility = VisibilityPrivate + oc.Properties.APIServerProfile.Visibility = VisibilityPrivate + oc.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{ + ManagedOutboundIPs: &ManagedOutboundIPs{ + Count: 3, + }, + } + }, + wantErr: "400: InvalidParameter: properties.networkProfile.loadBalancerProfile: The provided loadBalancerProfile is invalid: cannot use a loadBalancerProfile if outboundType is UserDefinedRouting.", + }, + { + name: "Not passing in a LoadBalancerProfile is valid.", + current: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.OutboundType = OutboundTypeLoadbalancer + oc.Properties.NetworkProfile.LoadBalancerProfile = nil + }, + wantErr: "", + }, + } + + runTests(t, testModeCreate, tests) + runTests(t, testModeUpdate, tests) +} + +func TestOpenShiftClusterStaticValidateLoadBalancerProfile(t *testing.T) { + tests := []*validateTest{ + { + name: "LoadBalancerProfile is valid", + wantErr: "", + }, + { + name: "LoadBalancerProfile.ManagedOutboundIPs is valid with 20 managed IPs", + current: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{ + ManagedOutboundIPs: &ManagedOutboundIPs{ + Count: 20, + }, + } + }, + wantErr: "", + }, + { + name: "LoadBalancerProfile.ManagedOutboundIPs is invalid with greater than 20 managed IPs", + current: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{ + ManagedOutboundIPs: &ManagedOutboundIPs{ + Count: 21, + }, + } + }, + wantErr: "400: InvalidParameter: properties.networkProfile.loadBalancerProfile.managedOutboundIps.count: The provided managedOutboundIps.count 21 is invalid: managedOutboundIps.count must be in the range of 1 to 20 (inclusive).", + }, + { + name: "LoadBalancerProfile.ManagedOutboundIPs is invalid with less than 1 managed IP", + current: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{ + ManagedOutboundIPs: &ManagedOutboundIPs{ + Count: 0, + }, + } + }, + wantErr: "400: InvalidParameter: properties.networkProfile.loadBalancerProfile.managedOutboundIps.count: The provided managedOutboundIps.count 0 is invalid: managedOutboundIps.count must be in the range of 1 to 20 (inclusive).", + }, } + createTests := []*validateTest{ + { + name: "LoadBalancerProfile.EffectiveOutboundIPs is read only", + current: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{ + ManagedOutboundIPs: &ManagedOutboundIPs{ + Count: 1, + }, + EffectiveOutboundIPs: []EffectiveOutboundIP{ + { + ID: "someId", + }, + }, + } + }, + wantErr: "400: InvalidParameter: properties.networkProfile.loadBalancerProfile.effectiveOutboundIps: The field effectiveOutboundIps is read only.", + }, + } + runTests(t, testModeCreate, createTests) runTests(t, testModeCreate, tests) runTests(t, testModeUpdate, tests) } @@ -998,6 +1084,38 @@ func TestOpenShiftClusterStaticValidateDelta(t *testing.T) { }, wantErr: "400: PropertyChangeNotAllowed: systemData.lastModifiedBy: Changing property 'systemData.lastModifiedBy' is not allowed.", }, + { + name: "update LoadBalancerProfile.ManagedOutboundIPs.Count", + modify: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{ + ManagedOutboundIPs: &ManagedOutboundIPs{ + Count: 5, + }, + } + }, + wantErr: "", + }, + { + name: "update LoadBalancerProfile.EffectiveOutboundIPs", + current: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs = []EffectiveOutboundIP{ + {ID: "resourceId"}, + } + }, + modify: func(oc *OpenShiftCluster) { + oc.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{ + ManagedOutboundIPs: &ManagedOutboundIPs{ + Count: 5, + }, + EffectiveOutboundIPs: []EffectiveOutboundIP{ + { + ID: "BadResourceId", + }, + }, + } + }, + wantErr: "400: PropertyChangeNotAllowed: properties.networkProfile.loadBalancerProfile.effectiveOutboundIps: Changing property 'properties.networkProfile.loadBalancerProfile.effectiveOutboundIps' is not allowed.", + }, } runTests(t, testModeUpdate, tests) From 96d3beb4ca843beb26826a0c87a4098a57822ad7 Mon Sep 17 00:00:00 2001 From: b-jhoreman Date: Tue, 16 Jan 2024 13:24:16 -0800 Subject: [PATCH 4/4] fixing delta between versions for test and removing unused defs --- pkg/api/v20231122/openshiftcluster_convert.go | 1 + pkg/api/v20231122/openshiftcluster_example.go | 1 + pkg/api/v20231122/openshiftcluster_validatestatic.go | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/api/v20231122/openshiftcluster_convert.go b/pkg/api/v20231122/openshiftcluster_convert.go index 3cb76a517a8..5fd8e44d96c 100644 --- a/pkg/api/v20231122/openshiftcluster_convert.go +++ b/pkg/api/v20231122/openshiftcluster_convert.go @@ -263,6 +263,7 @@ func (c openShiftClusterConverter) ToInternal(_oc interface{}, out *api.OpenShif // ExternalNoReadOnly removes all read-only fields from the external representation. func (c openShiftClusterConverter) ExternalNoReadOnly(_oc interface{}) { oc := _oc.(*OpenShiftCluster) + oc.Properties.WorkerProfilesStatus = nil if oc.Properties.NetworkProfile.LoadBalancerProfile != nil { oc.Properties.NetworkProfile.LoadBalancerProfile.EffectiveOutboundIPs = nil } diff --git a/pkg/api/v20231122/openshiftcluster_example.go b/pkg/api/v20231122/openshiftcluster_example.go index 5d506575eee..e0ec6d1bc59 100644 --- a/pkg/api/v20231122/openshiftcluster_example.go +++ b/pkg/api/v20231122/openshiftcluster_example.go @@ -54,6 +54,7 @@ func ExampleOpenShiftClusterGetResponse() interface{} { oc := exampleOpenShiftCluster() oc.Properties.ClusterProfile.PullSecret = "" oc.Properties.ServicePrincipalProfile.ClientSecret = "" + oc.Properties.WorkerProfilesStatus = nil oc.Properties.NetworkProfile.LoadBalancerProfile = &LoadBalancerProfile{ EffectiveOutboundIPs: []EffectiveOutboundIP{ { diff --git a/pkg/api/v20231122/openshiftcluster_validatestatic.go b/pkg/api/v20231122/openshiftcluster_validatestatic.go index 6a3fb6ab4b9..d891ac0e27d 100644 --- a/pkg/api/v20231122/openshiftcluster_validatestatic.go +++ b/pkg/api/v20231122/openshiftcluster_validatestatic.go @@ -82,7 +82,7 @@ func (sv openShiftClusterStaticValidator) validateProperties(path string, p *Ope switch p.ProvisioningState { case ProvisioningStateCreating, ProvisioningStateUpdating, ProvisioningStateAdminUpdating, ProvisioningStateDeleting, - ProvisioningStateSucceeded, ProvisioningStateFailed: + ProvisioningStateSucceeded, ProvisioningStateFailed, ProvisioningStateCancelled: default: return api.NewCloudError(http.StatusBadRequest, api.CloudErrorCodeInvalidParameter, path+".provisioningState", "The provided provisioning state '%s' is invalid.", p.ProvisioningState) }