diff --git a/privateca/snippets/create_ca_pool.py b/privateca/snippets/create_ca_pool.py index 2b11785b039b..a8fbaac560b7 100644 --- a/privateca/snippets/create_ca_pool.py +++ b/privateca/snippets/create_ca_pool.py @@ -39,9 +39,7 @@ def create_ca_pool(project_id: str, location: str, ca_pool_name: str) -> None: # Create the pool request. request = privateca_v1.CreateCaPoolRequest( - parent=location_path, - ca_pool_id=ca_pool_name, - ca_pool=ca_pool, + parent=location_path, ca_pool_id=ca_pool_name, ca_pool=ca_pool, ) # Create the CA pool. diff --git a/privateca/snippets/create_certificate.py b/privateca/snippets/create_certificate.py index 053305654296..2e1372ed31fc 100644 --- a/privateca/snippets/create_certificate.py +++ b/privateca/snippets/create_certificate.py @@ -54,8 +54,7 @@ def create_certificate( # Set the Public Key and its format. public_key = privateca_v1.PublicKey( - key=public_key_bytes, - format_=privateca_v1.PublicKey.KeyFormat.PEM, + key=public_key_bytes, format_=privateca_v1.PublicKey.KeyFormat.PEM, ) subject_config = privateca_v1.CertificateConfig.SubjectConfig( @@ -67,12 +66,10 @@ def create_certificate( x509_parameters = privateca_v1.X509Parameters( key_usage=privateca_v1.KeyUsage( base_key_usage=privateca_v1.KeyUsage.KeyUsageOptions( - digital_signature=True, - key_encipherment=True, + digital_signature=True, key_encipherment=True, ), extended_key_usage=privateca_v1.KeyUsage.ExtendedKeyUsageOptions( - server_auth=True, - client_auth=True, + server_auth=True, client_auth=True, ), ), ) diff --git a/privateca/snippets/create_certificate_authority.py b/privateca/snippets/create_certificate_authority.py index 2cb0c65ec17d..2856f7d31c18 100644 --- a/privateca/snippets/create_certificate_authority.py +++ b/privateca/snippets/create_certificate_authority.py @@ -58,13 +58,10 @@ def create_certificate_authority( x509_parameters = privateca_v1.X509Parameters( key_usage=privateca_v1.KeyUsage( base_key_usage=privateca_v1.KeyUsage.KeyUsageOptions( - crl_sign=True, - cert_sign=True, + crl_sign=True, cert_sign=True, ) ), - ca_options=privateca_v1.X509Parameters.CaOptions( - is_ca=True, - ), + ca_options=privateca_v1.X509Parameters.CaOptions(is_ca=True,), ) # Set certificate authority settings. @@ -73,8 +70,7 @@ def create_certificate_authority( type_=privateca_v1.CertificateAuthority.Type.SELF_SIGNED, key_spec=key_version_spec, config=privateca_v1.CertificateConfig( - subject_config=subject_config, - x509_config=x509_parameters, + subject_config=subject_config, x509_config=x509_parameters, ), lifetime=duration_pb2.Duration(seconds=ca_duration), ) diff --git a/privateca/snippets/enable_certificate_authority.py b/privateca/snippets/enable_certificate_authority.py index a6ecd35580bc..691922db7eb3 100644 --- a/privateca/snippets/enable_certificate_authority.py +++ b/privateca/snippets/enable_certificate_authority.py @@ -38,9 +38,7 @@ def enable_certificate_authority( ) # Create the Enable Certificate Authority Request. - request = privateca_v1.EnableCertificateAuthorityRequest( - name=ca_path, - ) + request = privateca_v1.EnableCertificateAuthorityRequest(name=ca_path,) # Enable the Certificate Authority. operation = caServiceClient.enable_certificate_authority(request=request) diff --git a/privateca/snippets/list_certificates.py b/privateca/snippets/list_certificates.py index 9c04ed93470f..8d2d606a6fab 100644 --- a/privateca/snippets/list_certificates.py +++ b/privateca/snippets/list_certificates.py @@ -19,11 +19,7 @@ import google.cloud.security.privateca_v1 as privateca_v1 -def list_certificates( - project_id: str, - location: str, - ca_pool_name: str, -) -> None: +def list_certificates(project_id: str, location: str, ca_pool_name: str,) -> None: """ List Certificates present in the given CA pool. diff --git a/privateca/snippets/revoke_certificate.py b/privateca/snippets/revoke_certificate.py index 011999a4b92f..8cd640005ec2 100644 --- a/privateca/snippets/revoke_certificate.py +++ b/privateca/snippets/revoke_certificate.py @@ -22,10 +22,7 @@ def revoke_certificate( - project_id: str, - location: str, - ca_pool_name: str, - certificate_name: str, + project_id: str, location: str, ca_pool_name: str, certificate_name: str, ) -> None: """ Revoke an issued certificate. Once revoked, the certificate will become invalid and will expire post its lifetime. diff --git a/privateca/snippets/test_certificate_authorities.py b/privateca/snippets/test_certificate_authorities.py index 8716e189fe62..4ef01f97b62d 100644 --- a/privateca/snippets/test_certificate_authorities.py +++ b/privateca/snippets/test_certificate_authorities.py @@ -67,14 +67,8 @@ def test_enable_and_disable_certificate_authority( out, _ = capsys.readouterr() - assert re.search( - f"Enabled Certificate Authority: {CA_NAME}", - out, - ) - assert re.search( - f"Disabled Certificate Authority: {CA_NAME}", - out, - ) + assert re.search(f"Enabled Certificate Authority: {CA_NAME}", out,) + assert re.search(f"Disabled Certificate Authority: {CA_NAME}", out,) def test_delete_certificate_authority(capsys: typing.Any) -> None: @@ -90,7 +84,4 @@ def test_delete_certificate_authority(capsys: typing.Any) -> None: out, _ = capsys.readouterr() - assert re.search( - f"Successfully deleted Certificate Authority: {CA_NAME}", - out, - ) + assert re.search(f"Successfully deleted Certificate Authority: {CA_NAME}", out,) diff --git a/privateca/snippets/test_certificates.py b/privateca/snippets/test_certificates.py index 080fd5663a3a..85d707f46b71 100644 --- a/privateca/snippets/test_certificates.py +++ b/privateca/snippets/test_certificates.py @@ -75,10 +75,7 @@ def test_create_and_revoke_certificate_authority( ) revoke_certificate( - PROJECT, - LOCATION, - CA_POOL_NAME, - CERT_NAME, + PROJECT, LOCATION, CA_POOL_NAME, CERT_NAME, ) disable_certificate_authority(PROJECT, LOCATION, CA_POOL_NAME, CA_NAME)