def delete_crl_certificate(self, service_param):
     crl_certs = self.get_crl_certificates()
     cert_name = service_param.get("cert_name")
     for crl_cert in crl_certs:
         if crl_cert.get("name") == cert_name:
             cert = Certificate(client=self.gateway.client,
                                gateway_name=self.gateway.name,
                                resource_id=crl_cert.get("object_id"))
             cert.delete_certificate()
 def test_0020_delete_service_certificate(self):
     """Delete service certificate in the gateway.
     Invokes the delete_certificate of the Certificate.
     """
     certificate_obj = Certificate(client=TestCertificates._client,
                                   gateway_name=TestCertificates._name,
                                   resource_id=TestCertificates._object_id)
     certificate_obj.delete_certificate()
     # Verify
     gateway_obj1 = TestCertificates._gateway1
     certificate_list = gateway_obj1.list_service_certificates()
     self.assertTrue(len(certificate_list) == 0)
 def test_0030_delete_ca_certificate(self):
     """Delete CA certificate in the gateway.
     Invokes the delete_ca_certificate of the Certificate.
     """
     gateway_obj1 = TestCertificates._gateway1
     certificate_list = gateway_obj1.list_ca_certificates()
     certificate = certificate_list[0]
     object_id = certificate["Object_Id"]
     certificate_obj = Certificate(client=TestCertificates._client,
                                   gateway_name=TestCertificates._name,
                                   resource_id=object_id)
     certificate_obj.delete_ca_certificate()
     # Verify
     gateway_obj1 = TestCertificates._gateway1
     certificate_list = gateway_obj1.list_ca_certificates()
     self.assertTrue(len(certificate_list) == 0)
Example #4
0
def get_service_certificate(ctx, gateway_name, id):
    """Get the sdk's certificate object.

    It will restore sessions if expired. It will read the client.
    """
    restore_session(ctx, vdc_required=True)
    client = ctx.obj['client']
    certificate = Certificate(client=client,
                              gateway_name=gateway_name,
                              resource_id=id)
    return certificate