示例#1
0
    def create_task(
        self,
        cluster,
        provider,
    ):
        """
        Generate a certificate signing request (CSR) for the client
        certificate. This overwrites any existing CSR. 
        
        The CSR will allow the certificate to be signed by a third party. Once
        the CSR is signed, certificate may be added as a client certificate. 
        
        Calling the API repeatedly will result in a generating a new CSR each
        time.. This method was added in vSphere API 7.0.0.

        :type  cluster: :class:`str`
        :param cluster: Identifier of the cluster.
            The parameter must be an identifier for the resource type:
            ``ClusterComputeResource``.
        :type  provider: :class:`str`
        :param provider: Identifier of the provider.
            The parameter must be an identifier for the resource type:
            ``com.vmware.vcenter.trusted_infrastructure.trust_authority_clusters.kms.Provider``.
        :rtype: :class:  `vmware.vapi.stdlib.client.task.Task`
        :return: Task instance
        :raise: :class:`com.vmware.vapi.std.errors_client.InvalidArgument` 
            If cluster or provider id are empty.
        :raise: :class:`com.vmware.vapi.std.errors_client.NotFound` 
            If the provider or cluster is not found.
        :raise: :class:`com.vmware.vapi.std.errors_client.Unauthenticated` 
            If the caller is not authenticated.
        :raise: :class:`com.vmware.vapi.std.errors_client.Error` 
            If any other error occurs.
        """
        task_id = self._invoke('create$task', {
            'cluster': cluster,
            'provider': provider,
        })
        task_svc = Tasks(self._config)
        task_instance = Task(task_id, task_svc,
                             type.ReferenceType(__name__, 'Csr.Info'))
        return task_instance