|
| 1 | +# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md |
| 2 | + |
| 3 | + |
| 4 | +from typing import Any |
| 5 | +from ocp_resources.resource import Resource |
| 6 | + |
| 7 | + |
| 8 | +class Authentication(Resource): |
| 9 | + """ |
| 10 | + Authentication specifies cluster-wide settings for authentication (like OAuth and |
| 11 | + webhook token authenticators). The canonical name of an instance is `cluster`. |
| 12 | +
|
| 13 | + Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). |
| 14 | + """ |
| 15 | + |
| 16 | + api_group: str = Resource.ApiGroup.CONFIG_OPENSHIFT_IO |
| 17 | + |
| 18 | + def __init__( |
| 19 | + self, |
| 20 | + oauth_metadata: dict[str, Any] | None = None, |
| 21 | + oidc_providers: list[Any] | None = None, |
| 22 | + service_account_issuer: str | None = None, |
| 23 | + type: str | None = None, |
| 24 | + webhook_token_authenticator: dict[str, Any] | None = None, |
| 25 | + webhook_token_authenticators: list[Any] | None = None, |
| 26 | + **kwargs: Any, |
| 27 | + ) -> None: |
| 28 | + r""" |
| 29 | + Args: |
| 30 | + oauth_metadata (dict[str, Any]): oauthMetadata contains the discovery endpoint data for OAuth 2.0 |
| 31 | + Authorization Server Metadata for an external OAuth server. This |
| 32 | + discovery document can be viewed from its served location: oc get |
| 33 | + --raw '/.well-known/oauth-authorization-server' For further |
| 34 | + details, see the IETF Draft: https://tools.ietf.org/html/draft- |
| 35 | + ietf-oauth-discovery-04#section-2 If oauthMetadata.name is non- |
| 36 | + empty, this value has precedence over any metadata reference |
| 37 | + stored in status. The key "oauthMetadata" is used to locate the |
| 38 | + data. If specified and the config map or expected key is not |
| 39 | + found, no metadata is served. If the specified metadata is not |
| 40 | + valid, no metadata is served. The namespace for this config map is |
| 41 | + openshift-config. |
| 42 | +
|
| 43 | + oidc_providers (list[Any]): oidcProviders are OIDC identity providers that can issue tokens for |
| 44 | + this cluster Can only be set if "Type" is set to "OIDC". At most |
| 45 | + one provider can be configured. |
| 46 | +
|
| 47 | + service_account_issuer (str): serviceAccountIssuer is the identifier of the bound service account |
| 48 | + token issuer. The default is https://kubernetes.default.svc |
| 49 | + WARNING: Updating this field will not result in immediate |
| 50 | + invalidation of all bound tokens with the previous issuer value. |
| 51 | + Instead, the tokens issued by previous service account issuer will |
| 52 | + continue to be trusted for a time period chosen by the platform |
| 53 | + (currently set to 24h). This time period is subject to change over |
| 54 | + time. This allows internal components to transition to use new |
| 55 | + service account issuer without service distruption. |
| 56 | +
|
| 57 | + type (str): type identifies the cluster managed, user facing authentication mode |
| 58 | + in use. Specifically, it manages the component that responds to |
| 59 | + login attempts. The default is IntegratedOAuth. |
| 60 | +
|
| 61 | + webhook_token_authenticator (dict[str, Any]): webhookTokenAuthenticator configures a remote token reviewer. These |
| 62 | + remote authentication webhooks can be used to verify bearer tokens |
| 63 | + via the tokenreviews.authentication.k8s.io REST API. This is |
| 64 | + required to honor bearer tokens that are provisioned by an |
| 65 | + external authentication service. Can only be set if "Type" is set |
| 66 | + to "None". |
| 67 | +
|
| 68 | + webhook_token_authenticators (list[Any]): webhookTokenAuthenticators is DEPRECATED, setting it has no effect. |
| 69 | +
|
| 70 | + """ |
| 71 | + super().__init__(**kwargs) |
| 72 | + |
| 73 | + self.oauth_metadata = oauth_metadata |
| 74 | + self.oidc_providers = oidc_providers |
| 75 | + self.service_account_issuer = service_account_issuer |
| 76 | + self.type = type |
| 77 | + self.webhook_token_authenticator = webhook_token_authenticator |
| 78 | + self.webhook_token_authenticators = webhook_token_authenticators |
| 79 | + |
| 80 | + def to_dict(self) -> None: |
| 81 | + super().to_dict() |
| 82 | + |
| 83 | + if not self.kind_dict and not self.yaml_file: |
| 84 | + self.res["spec"] = {} |
| 85 | + _spec = self.res["spec"] |
| 86 | + |
| 87 | + if self.oauth_metadata is not None: |
| 88 | + _spec["oauthMetadata"] = self.oauth_metadata |
| 89 | + |
| 90 | + if self.oidc_providers is not None: |
| 91 | + _spec["oidcProviders"] = self.oidc_providers |
| 92 | + |
| 93 | + if self.service_account_issuer is not None: |
| 94 | + _spec["serviceAccountIssuer"] = self.service_account_issuer |
| 95 | + |
| 96 | + if self.type is not None: |
| 97 | + _spec["type"] = self.type |
| 98 | + |
| 99 | + if self.webhook_token_authenticator is not None: |
| 100 | + _spec["webhookTokenAuthenticator"] = self.webhook_token_authenticator |
| 101 | + |
| 102 | + if self.webhook_token_authenticators is not None: |
| 103 | + _spec["webhookTokenAuthenticators"] = self.webhook_token_authenticators |
| 104 | + |
| 105 | + # End of generated code |
0 commit comments