Coverage for ocp_resources/api_server.py: 0%

29 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-01-30 10:48 +0200

1# Generated using https://github.com/RedHatQE/openshift-python-wrapper/blob/main/scripts/resource/README.md 

2 

3from typing import Any, Dict, List, Optional 

4from ocp_resources.resource import Resource 

5 

6 

7class APIServer(Resource): 

8 """ 

9 APIServer holds configuration (like serving certificates, client CA and CORS domains) shared by all API servers in the system, among them especially kube-apiserver and openshift-apiserver. The canonical name of an instance is 'cluster'. 

10 Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer). 

11 """ 

12 

13 api_group: str = Resource.ApiGroup.CONFIG_OPENSHIFT_IO 

14 

15 def __init__( 

16 self, 

17 additional_cors_allowed_origins: Optional[List[Any]] = None, 

18 audit: Optional[Dict[str, Any]] = None, 

19 client_ca: Optional[Dict[str, Any]] = None, 

20 encryption: Optional[Dict[str, Any]] = None, 

21 serving_certs: Optional[Dict[str, Any]] = None, 

22 tls_security_profile: Optional[Dict[str, Any]] = None, 

23 **kwargs: Any, 

24 ) -> None: 

25 """ 

26 Args: 

27 additional_cors_allowed_origins (List[Any]): additionalCORSAllowedOrigins lists additional, user-defined regular 

28 expressions describing hosts for which the API server allows 

29 access using the CORS headers. This may be needed to access the 

30 API and the integrated OAuth server from JavaScript applications. 

31 The values are regular expressions that correspond to the Golang 

32 regular expression language. 

33 

34 audit (Dict[str, Any]): audit specifies the settings for audit configuration to be applied to 

35 all OpenShift-provided API servers in the cluster. 

36 

37 client_ca (Dict[str, Any]): clientCA references a ConfigMap containing a certificate bundle for 

38 the signers that will be recognized for incoming client 

39 certificates in addition to the operator managed signers. If this 

40 is empty, then only operator managed signers are valid. You 

41 usually only have to set this if you have your own PKI you wish to 

42 honor client certificates from. The ConfigMap must exist in the 

43 openshift-config namespace and contain the following required 

44 fields: - ConfigMap.Data["ca-bundle.crt"] - CA bundle. 

45 

46 encryption (Dict[str, Any]): encryption allows the configuration of encryption of resources at the 

47 datastore layer. 

48 

49 serving_certs (Dict[str, Any]): servingCert is the TLS cert info for serving secure traffic. If not 

50 specified, operator managed certificates will be used for serving 

51 secure traffic. 

52 

53 tls_security_profile (Dict[str, Any]): tlsSecurityProfile specifies settings for TLS connections for 

54 externally exposed servers. If unset, a default (which may 

55 change between releases) is chosen. Note that only Old, 

56 Intermediate and Custom profiles are currently supported, and the 

57 maximum available minTLSVersion is VersionTLS12. 

58 

59 """ 

60 super().__init__(**kwargs) 

61 

62 self.additional_cors_allowed_origins = additional_cors_allowed_origins 

63 self.audit = audit 

64 self.client_ca = client_ca 

65 self.encryption = encryption 

66 self.serving_certs = serving_certs 

67 self.tls_security_profile = tls_security_profile 

68 

69 def to_dict(self) -> None: 

70 super().to_dict() 

71 

72 if not self.kind_dict and not self.yaml_file: 

73 self.res["spec"] = {} 

74 _spec = self.res["spec"] 

75 

76 if self.additional_cors_allowed_origins: 

77 _spec["additionalCORSAllowedOrigins"] = self.additional_cors_allowed_origins 

78 

79 if self.audit: 

80 _spec["audit"] = self.audit 

81 

82 if self.client_ca: 

83 _spec["clientCA"] = self.client_ca 

84 

85 if self.encryption: 

86 _spec["encryption"] = self.encryption 

87 

88 if self.serving_certs: 

89 _spec["servingCerts"] = self.serving_certs 

90 

91 if self.tls_security_profile: 

92 _spec["tlsSecurityProfile"] = self.tls_security_profile 

93 

94 # End of generated code