ImportCertificate
Imports a certificate file.
Operation description
You must purchase DataWorks Basic Edition or higher to use this feature.
You must have at least one of the following roles in the DataWorks workspace: tenant owner, workspace administrator, project owner, or O&M engineer.
Java SDK file upload example
Pass the client initialized for the target region. Before you call the operation, replace 0L in the example with the ID of the DataWorks workspace where you want to import the certificate, and update the local certificate file path ca.crt as needed. This method does not require an OSS bucket or a public download URL.
import com.aliyun.dataworks_public20240518.Client;
import com.aliyun.dataworks_public20240518.models.ImportCertificateAdvanceRequest;
import com.aliyun.teautil.models.RuntimeOptions;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
public final class ImportCertificateExample {
public static void importLocalCertificate(Client client) throws Exception {
try (InputStream file = Files.newInputStream(Paths.get("ca.crt"))) {
ImportCertificateAdvanceRequest request = new ImportCertificateAdvanceRequest()
.setProjectId(0L) // Replace with your DataWorks workspace ID
.setName("ca.crt")
.setCertificateFileObject(file);
client.importCertificateAdvance(request, new RuntimeOptions());
}
}
}
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dataworks:ImportCertificate |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ProjectId |
integer |
Yes |
The ID of the project to which the certificate file belongs. |
106560 |
| Name |
string |
Yes |
The name of the certificate file. The name must be unique within a project. |
ca1.crt |
| CertificateFile |
string |
Yes |
The OSS object URL in the HTTP request. When you use the SDK for Java to import a local certificate, pass the file stream to |
https://example-upload-bucket.oss-cn-shanghai.aliyuncs.com/certificate_01 |
| Description |
string |
No |
The description. |
This is a file |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response. |
||
| Id |
integer |
The ID of the certificate file, which is the unique identifier of the certificate file. |
676303114031776 |
| RequestId |
string |
The ID of the request, which is used to locate logs and troubleshoot issues. |
7C352CB7-CD88-50CF-9D0D-E81BDF020E7F |
Examples
Success response
JSON format
{
"Id": 676303114031776,
"RequestId": "7C352CB7-CD88-50CF-9D0D-E81BDF020E7F"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.