示例#1
0
def sample_create_certificate_authority():
    # Create a client
    client = privateca_v1beta1.CertificateAuthorityServiceClient()

    # Initialize request argument(s)
    certificate_authority = privateca_v1beta1.CertificateAuthority()
    certificate_authority.type_ = "SUBORDINATE"
    certificate_authority.tier = "DEVOPS"
    certificate_authority.config.reusable_config.reusable_config = "reusable_config_value"
    certificate_authority.key_spec.cloud_kms_key_version = "cloud_kms_key_version_value"

    request = privateca_v1beta1.CreateCertificateAuthorityRequest(
        parent="parent_value",
        certificate_authority_id="certificate_authority_id_value",
        certificate_authority=certificate_authority,
    )

    # Make the request
    operation = client.create_certificate_authority(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
def sample_get_reusable_config():
    # Create a client
    client = privateca_v1beta1.CertificateAuthorityServiceClient()

    # Initialize request argument(s)
    request = privateca_v1beta1.GetReusableConfigRequest(name="name_value", )

    # Make the request
    response = client.get_reusable_config(request=request)

    # Handle the response
    print(response)
def sample_get_certificate_revocation_list():
    # Create a client
    client = privateca_v1beta1.CertificateAuthorityServiceClient()

    # Initialize request argument(s)
    request = privateca_v1beta1.GetCertificateRevocationListRequest(
        name="name_value", )

    # Make the request
    response = client.get_certificate_revocation_list(request=request)

    # Handle the response
    print(response)
示例#4
0
def sample_fetch_certificate_authority_csr():
    # Create a client
    client = privateca_v1beta1.CertificateAuthorityServiceClient()

    # Initialize request argument(s)
    request = privateca_v1beta1.FetchCertificateAuthorityCsrRequest(
        name="name_value", )

    # Make the request
    response = client.fetch_certificate_authority_csr(request=request)

    # Handle the response
    print(response)
示例#5
0
def sample_list_certificates():
    # Create a client
    client = privateca_v1beta1.CertificateAuthorityServiceClient()

    # Initialize request argument(s)
    request = privateca_v1beta1.ListCertificatesRequest(
        parent="parent_value", )

    # Make the request
    page_result = client.list_certificates(request=request)

    # Handle the response
    for response in page_result:
        print(response)
def sample_revoke_certificate():
    # Create a client
    client = privateca_v1beta1.CertificateAuthorityServiceClient()

    # Initialize request argument(s)
    request = privateca_v1beta1.RevokeCertificateRequest(
        name="name_value",
        reason="ATTRIBUTE_AUTHORITY_COMPROMISE",
    )

    # Make the request
    response = client.revoke_certificate(request=request)

    # Handle the response
    print(response)
def sample_update_certificate_revocation_list():
    # Create a client
    client = privateca_v1beta1.CertificateAuthorityServiceClient()

    # Initialize request argument(s)
    request = privateca_v1beta1.UpdateCertificateRevocationListRequest()

    # Make the request
    operation = client.update_certificate_revocation_list(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
def sample_enable_certificate_authority():
    # Create a client
    client = privateca_v1beta1.CertificateAuthorityServiceClient()

    # Initialize request argument(s)
    request = privateca_v1beta1.EnableCertificateAuthorityRequest(
        name="name_value", )

    # Make the request
    operation = client.enable_certificate_authority(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
示例#9
0
def sample_update_certificate():
    # Create a client
    client = privateca_v1beta1.CertificateAuthorityServiceClient()

    # Initialize request argument(s)
    certificate = privateca_v1beta1.Certificate()
    certificate.pem_csr = "pem_csr_value"

    request = privateca_v1beta1.UpdateCertificateRequest(
        certificate=certificate,
    )

    # Make the request
    response = client.update_certificate(request=request)

    # Handle the response
    print(response)
示例#10
0
def sample_activate_certificate_authority():
    # Create a client
    client = privateca_v1beta1.CertificateAuthorityServiceClient()

    # Initialize request argument(s)
    subordinate_config = privateca_v1beta1.SubordinateConfig()
    subordinate_config.certificate_authority = "certificate_authority_value"

    request = privateca_v1beta1.ActivateCertificateAuthorityRequest(
        name="name_value",
        pem_ca_certificate="pem_ca_certificate_value",
        subordinate_config=subordinate_config,
    )

    # Make the request
    operation = client.activate_certificate_authority(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)