From 2fa6c799a0b87a1a54346467cfe5c3b0c9130d33 Mon Sep 17 00:00:00 2001 From: Guilherme Branco Date: Fri, 17 Mar 2023 10:56:10 -0300 Subject: [PATCH] fix: adjust resources to match /oidc_configs endpoints --- .../v1/hosted_oidc_config_type.model | 42 --------------- ...ource.model => oidc_config_resource.model} | 15 ++++-- model/clusters_mgmt/v1/oidc_config_type.model | 51 +++++++++++++++++++ ...urce.model => oidc_configs_resource.model} | 14 ++--- model/clusters_mgmt/v1/root_resource.model | 4 +- 5 files changed, 70 insertions(+), 56 deletions(-) delete mode 100644 model/clusters_mgmt/v1/hosted_oidc_config_type.model rename model/clusters_mgmt/v1/{hosted_oidc_config_resource.model => oidc_config_resource.model} (71%) create mode 100644 model/clusters_mgmt/v1/oidc_config_type.model rename model/clusters_mgmt/v1/{hosted_oidc_configs_resource.model => oidc_configs_resource.model} (81%) diff --git a/model/clusters_mgmt/v1/hosted_oidc_config_type.model b/model/clusters_mgmt/v1/hosted_oidc_config_type.model deleted file mode 100644 index ef727af9..00000000 --- a/model/clusters_mgmt/v1/hosted_oidc_config_type.model +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright (c) 2023 Red Hat, Inc. - -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. -*/ - -// Contains the necessary attributes to support oidc configuration hosting under Red Hat. -struct HostedOidcConfig { - // ARN of the AWS role to assume when installing the cluster, supplied in request. - InstallerRoleArn String - - // Secrets Manager ARN for the OIDC private key key, supplied in request. - OidcPrivateKeySecretArn String - - // ID for the hosted oidc config, filled in response. - ID String - - // HREF for the hosted oidc config, filled in response. - HREF String - - // Name for the oidc folder, filled in response based on secret arn private key. - OidcFolderName String - - // Organization ID, filled in response respecting token provided. - OrganizationId String - - // Oidc endpoint URL, filled in response base on secret arn for the private key. - OidcEndpointUrl String - - // Creation timestamp, filled in response. - CreationTimestamp Date -} diff --git a/model/clusters_mgmt/v1/hosted_oidc_config_resource.model b/model/clusters_mgmt/v1/oidc_config_resource.model similarity index 71% rename from model/clusters_mgmt/v1/hosted_oidc_config_resource.model rename to model/clusters_mgmt/v1/oidc_config_resource.model index bb862def..003f3f5f 100644 --- a/model/clusters_mgmt/v1/hosted_oidc_config_resource.model +++ b/model/clusters_mgmt/v1/oidc_config_resource.model @@ -14,14 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Manages a hosted oidc configuration. -resource HostedOidcConfig { - // Retrieves the details of a HostedOidcConfig +// Manages an Oidc Config configuration. +resource OidcConfig { + // Retrieves the details of an OidcConfig. method Get { - out Body HostedOidcConfig + out Body OidcConfig } - // Deletes the HostedOidcConfig. + // Updates attributes of an OidcConfig. + method Update { + in out Body OidcConfig + } + + // Deletes the OidcConfig. method Delete { } } diff --git a/model/clusters_mgmt/v1/oidc_config_type.model b/model/clusters_mgmt/v1/oidc_config_type.model new file mode 100644 index 00000000..9d24c46c --- /dev/null +++ b/model/clusters_mgmt/v1/oidc_config_type.model @@ -0,0 +1,51 @@ +/* +Copyright (c) 2023 Red Hat, Inc. + +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. +*/ + +// Contains the necessary attributes to support oidc configuration hosting under Red Hat or registering a Customer's byo oidc config. +struct OidcConfig { + // ARN of the AWS role to assume when installing the cluster as to reveal the secret, supplied in request. It is only to be used in Unmanaged Oidc Config. + InstallerRoleArn String + + // Secrets Manager ARN for the OIDC private key, supplied in request. It is only to be used in Unmanaged Oidc Config. + SecretArn String + + // ID for the oidc config, filled in response. + ID String + + // HREF for the oidc config, filled in response. + HREF String + + // Organization ID, filled in response respecting token provided. + OrganizationId String + + // Issuer URL, filled in response when Managed and supplied in Unmanaged. + IssuerUrl String + + // Creation timestamp, filled in response. + CreationTimestamp Date + + // Last used timestamp, filled by the latest cluster that used this oidc config. + LastUsedTimestamp Date + + // Last update timestamp, filled when patching a valid attribute of this oidc config. + LastUpdateTimestamp Date + + // Indicates whether it is Managed or Unmanaged (Customer hosted). + Managed boolean + + // Indicates whether the Oidc Config can be reused. + Reusable boolean +} diff --git a/model/clusters_mgmt/v1/hosted_oidc_configs_resource.model b/model/clusters_mgmt/v1/oidc_configs_resource.model similarity index 81% rename from model/clusters_mgmt/v1/hosted_oidc_configs_resource.model rename to model/clusters_mgmt/v1/oidc_configs_resource.model index 2ff5be34..b99b301d 100644 --- a/model/clusters_mgmt/v1/hosted_oidc_configs_resource.model +++ b/model/clusters_mgmt/v1/oidc_configs_resource.model @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Manages the collection hosted oidc configurations. -resource HostedOidcConfigs { - // Retrieves the list of hosted oidc configs. +// Manages the collection of oidc configurations. +resource OidcConfigs { + // Retrieves the list of oidc configs. method List { // Index of the requested page, where one corresponds to the first page. in out Page Integer = 1 @@ -28,18 +28,18 @@ resource HostedOidcConfigs { out Total Integer // Retrieved list of identity providers. - out Items []HostedOidcConfig + out Items []OidcConfig } // Creates a hosting under Red Hat's S3 bucket for byo oidc configuration method Add { - in out Body HostedOidcConfig + in out Body OidcConfig } // Reference to the service that manages an specific identity provider. - locator HostedOidcConfig { - target HostedOidcConfig + locator OidcConfig { + target OidcConfig variable ID } } diff --git a/model/clusters_mgmt/v1/root_resource.model b/model/clusters_mgmt/v1/root_resource.model index f9bb850e..e7580545 100644 --- a/model/clusters_mgmt/v1/root_resource.model +++ b/model/clusters_mgmt/v1/root_resource.model @@ -93,7 +93,7 @@ resource Root { } // Reference to the resource that manages oidc - locator HostedOidcConfigs { - target HostedOidcConfigs + locator OidcConfigs { + target OidcConfigs } }