function certificate = getCloudClusterCertificate(identifier)
% This function queries the Cloud Center client for the SSL certificate for
% the cluster with the given identifier.  This method will only work if the
% caller is the owner of the cluster.

%   Copyright 2019-2021 The MathWorks, Inc.

cloudCenterClient = parallel.internal.cloud.currentCloudCenterClient();
getClusterCertificateFcn = @() cloudCenterClient.getCertificate(identifier);
reponseWithMessages = parallel.internal.mwa.invokeWithLogin(getClusterCertificateFcn);
parallel.internal.cloud.checkAndIssueWebServiceWarnings(reponseWithMessages);

certificate = reponseWithMessages.data.Certificate;
end
